Skip to main content

Module element

Module element 

Source
Expand description

ElementReference: an element of a target by its stable name — an edge or a face of a part’s topology, a line of a sketch — typed by the target it is in and the Kind of element it is, as a TargetReference is typed by its target. What an operation is given to build on, and what a pick in the viewport becomes (PickedElement).

The crate that defines a target defines the kinds of element it holds and how one is resolved (HasElements); an operation that builds on one depends on that crate and names the kind in its arguments’ types, so a reference of the wrong kind does not compile, and no crate needs to know every kind there is.

Structs§

ElementReference
The element of the kind K named name in the target target. Saved as {"target": "/:s1", "name": "c3"}, its target spelled as a Located — /bolt:s1 in the part placed as bolt; in a target of the part itself that is its only one of its type (HasElements::SINGLETON) as "c3"; the whole target (ElementReference::whole) as {"target": "/:s1"}.
PickedElement
An element as a pick in the viewport names it: what a front end sends and is sent, which knows no types. Only ElementReference::from_picked reads it, so an operation never matches on it.

Traits§

HasElements
A target that holds elements of the kind K, each by a stable name. Elements are the only way a target is read: one meant to be read whole — a sketch, to sweep — is a kind of its own, impl Kind for Sketch and impl HasElements<Sketch> for Sketch, its one element the empty name (ElementReference::whole).
Kind
A kind of element a target holds by stable name: an edge or a face of a topology, a line of a sketch. A unit struct, defined by the crate that defines the target.

Functions§

whole
What a target read whole resolves its one element to: itself, for the empty name (ElementReference::whole); any other names nothing.