Skip to main content

Module pick

Module pick 

Source
Expand description

Picking in Rust (R23/R24), replacing the retired raycaster + selectionMethods._pickAtEvent: returns KERNEL NAMES with the candidate priority order VERTEX > EDGE > FACE > … > SOLID, CSS-pixel thresholds for lines/points (the earlier picker’s worldPerPixel * 6 is exactly 6 CSS px), a double-sided face toggle, and a ranked candidate list feeding the host’s multi-candidate popup. Selection-filter filtering stays in the UI layer where the filter state lives — the engine reports everything under the cursor.

CPU ray/screen-space testing over the scene’s display buffers: exact, deterministic, identical on native and wasm, and cheap at CAD face counts (dense meshes use cached kernel BVHs before exact triangle tests).

Structs§

PickCandidate
PickOptions

Enums§

PickKind

Constants§

EDGE_PICK_PX
Pick thresholds in CSS pixels (ported from selectionMethods).
VERTEX_PICK_PX

Functions§

candidates_to_json
Serialize candidates for the R3 JSON boundary.
nearest_face_depth
The view depth of the nearest FACE of scene under CSS-pixel (x, y), if any: what a translucent context scene puts in front of the clicked point.
pick
Rank candidates under CSS-pixel (x, y). Ordered by the priority chain then depth; a SOLID entry per hit solid is appended at the end (the earlier “extras” behavior).
pick_filtered
The nearest hit of an ALLOWED KIND under CSS-pixel (x, y), using the same ranking as pick. filter is a set of kind strings ("SOLID", "FACE", "EDGE", "VERTEX", case-insensitive); an empty filter means any kind. This is the type-constrained pick the reference-selection widget uses so a targetSolid field resolves the SOLID under the cursor (candidates rank faces first, then the trailing SOLID entry — find walks that order and returns the first candidate whose kind is allowed). Returns the full candidate (name + owning solid + position) or None on a miss.
pick_unoccluded
pick in scene, without what context hides: a candidate deeper than the nearest context face under the cursor is behind that face. A context drawn translucent (a Work part’s surrounding assembly) is still in front, so a click on it is not a click on the part behind it. Touching faces (a mating face flush with the context) stay pickable.