Skip to main content

SelectionFilter

Struct SelectionFilter 

Source
pub struct SelectionFilter {
    pub solid: bool,
    pub sketch: bool,
    pub face: bool,
    pub edge: bool,
    pub vertex: bool,
    pub plane: bool,
    pub component: bool,
}
Expand description

Which entity KINDS a plain viewport click may select.

The default enables EVERY kind (SOLID + FACE + EDGE + VERTEX + PLANE), so out of any special mode every entity under the cursor is pickable and the highest-priority kind wins (vertices/edges/faces out-priority a construction plane, which in turn out-priorities the owning solid, matching the picker’s priority order VERTEX > EDGE > FACE > PLANE > SOLID > COMPONENT). Reference-selection mode narrows this to exactly the kinds the active field permits (see from_ref_filter + EngineState::begin_ref_select); finishing / cancelling restores this all-enabled default.

Fields§

§solid: bool§sketch: bool

Committed SKETCHES, as whole objects. A committed sketch is drawn as a synthesized sheet SOLID (SolidDisplay::is_sketch), so it arrives from the ray test as an ordinary pick::PickKind::Solid candidate — the two share a PickKind and are told apart by that flag, not by the picker (see EngineState::candidate_admitted). Splitting them into two lanes is what lets a ["SKETCH"] reference field pick a sketch in the viewport while a ["SOLID"] one (a boolean target, a mirror body) does not — a sketch sheet registers no KERNEL solid, so a sketch name in a SOLID field could never resolve anyway.

It governs WHOLE-sketch picks only. A sketch’s planar face ({sketch}:FACE) and its drawn segments ({sketch}:G{gid}) stay ordinary FACE and EDGE candidates under those lanes, deliberately: the profile fields pick a sketch THROUGH its face (["SKETCH","FACE"], then normalize_profile_alias) and the path fields pick its curves through EDGE — path sweep’s path is ["EDGE"] alone and would lose sketch curves entirely if this lane gated them.

§face: bool§edge: bool§vertex: bool§plane: bool

Construction PLANES (a P feature’s frame, a D datum’s three base planes). A real pickable kind: the drawn plane cards join the ordinary candidate list (see EngineState::pick_candidates_at), ranked right after faces, so a plane is reachable THROUGH other geometry via the pick list. Unchecking it excludes planes exactly as unchecking Face excludes faces. The reference field’s construction kinds (PLANE/DATUM) map here.

§component: bool

COMPONENT promotion: a pick landing on assembly-component geometry selects the WHOLE component (its member solids — the tree / component- action selection shape) instead of the sub-entity. Not a pick_filtered kind — it re-buckets the accepted hit. Default ON: in an assembly a plain click grabs the component; uncheck it to reach faces/edges of component geometry (constraint work). Non-component geometry never promotes, so part documents are unaffected.

Implementations§

Source§

impl SelectionFilter

Source

pub fn enabled_kinds(&self) -> Vec<String>

The enabled kinds as pick-filter strings, highest pick-priority FIRST (VERTEX > EDGE > FACE > PLANE > SOLID) — the shape EngineState::pick_top_at / pick::pick_filtered consume. EMPTY when nothing is enabled; the caller MUST treat an empty result as “select nothing” (NOT the “empty filter = any kind” case).

Source

pub fn any_enabled(&self) -> bool

Whether ANY kind is enabled (else a click can select nothing). COMPONENT counts: a component-only filter still picks component geometry.

Source

pub fn get(&self, kind: &str) -> bool

Read one kind’s pickability by name ("SOLID"/"FACE"/"EDGE"/"VERTEX"/"PLANE", case-insensitive; "DATUM" is an alias of "PLANE"); unknown kinds read false.

Source

pub fn set(&mut self, kind: &str, on: bool)

Set one kind’s pickability by name (unknown kinds are ignored).

Source

pub fn from_ref_filter(filter: &[String]) -> Self

Build a selection filter from a reference field’s allowed-type strings (its schema selectionFilter, e.g. ["SOLID"], ["FACE","EDGE"], ["PLANE","FACE"], ["DATUM"]). EVERY kind now maps one-to-one to a pickable lane: SOLID/SKETCH/FACE/EDGE/VERTEX to their own (SKETCH and SOLID split the one PickKind::Solid between them — see sketch), and the CONSTRUCTION spellings PLANE/DATUM both to plane — construction planes are ordinary pick candidates (see EngineState::pick_candidates_at), no longer a datum_pick-only path.

The result stays RESTRICTIVE: ["PLANE","FACE"] (a sketch’s sketchPlane) admits planes and faces and NOTHING else — never solids or edges — and ["PLANE"]/["DATUM"] admits only the plane cards. The all-enabled fallback fires ONLY for a genuinely empty/unknown filter, so a field is never left in the unusable “select nothing” state. Reference-selection mode installs the result as the live selection_filter so BOTH hover-highlighting and click-picking follow the field’s allowed kinds.

Trait Implementations§

Source§

impl Clone for SelectionFilter

Source§

fn clone(&self) -> SelectionFilter

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SelectionFilter

Source§

impl Debug for SelectionFilter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SelectionFilter

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for SelectionFilter

Source§

impl PartialEq for SelectionFilter

Source§

fn eq(&self, other: &SelectionFilter) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SelectionFilter

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,