Composable queries over the edges or faces of one evaluated body.
A selector is an immutable sequence of filters. Each filter operates on the preceding selection; extrema retain all ties within 1.0e-7 mm. Queries return native handles from the supplied revision, in kernel order unless explicitly sorted. Sorts are stable; tied values retain their order. That order and those handles are not persistent names across operations.
iex> top = Smith.Selector.type(:plane) |> Smith.Selector.facing(:z)
iex> {:ok, body} = Smith.box(10, 8, 6) |> Smith.evaluate()
iex> {:ok, faces} = Smith.faces(body, top)
iex> length(faces)
1Use these values in Smith.fillet/2, Smith.chamfer/2, or
Smith.shell/2 to resolve a selection at that recipe step.
Smith.edges/2 and Smith.faces/2 inspect an already evaluated result.
Queries may return an empty list. Features requiring geometry reject an
empty selection, and their optional :count guards against ambiguity.
Summary
Functions
Retains the union of queries evaluated against the preceding selection.
Matches area using the default tolerance; see area/3.
Matches area in a pipeline, or accepts a value and options; see area/3.
Retains faces by area in mm², using the value/range rules of length/3.
Keeps candidates with the greatest center coordinate along a world axis.
Keeps the least center coordinate, with the same rules as at_max/2.
Removes candidates matched by a query against the preceding selection.
Retains planar faces facing a signed world axis.
Matches length using the default tolerance; see length/3.
Matches length in a pipeline, or accepts a value and options; see length/3.
Retains edges whose length matches a value or inclusive {minimum, maximum} range.
Returns a selector containing no filters; it selects every candidate.
Retains straight edges parallel to a world axis, ignoring direction sign.
Matches radius using the default tolerance; see radius/3.
Matches radius in a pipeline, or accepts a value and options; see radius/3.
Retains circular edges or cylindrical/spherical faces by radius in mm.
Sorts ascending by a property; see sort_by/3.
Sorts a pipeline ascending, or accepts a property and order; see sort_by/3.
Sorts candidates by :length, :area, :radius, or a world axis.
Keeps the first nonnegative integer number of candidates in the current order.
Retains a geometry type reported by OCEx.
Filters candidates using a boolean predicate over geometry metadata.
Types
Functions
Retains the union of queries evaluated against the preceding selection.
Accepts a list of selector inputs, including predicates and :all.
Each branch starts from the same current candidates. Output preserves
their preceding order and contains no duplicates, regardless of branch
sorting or overlap. An empty list selects nothing. Pipeline ordinary
filters to express intersection.
@spec area(measurement()) :: t()
Matches area using the default tolerance; see area/3.
@spec area(t() | measurement(), measurement() | keyword()) :: t()
Matches area in a pipeline, or accepts a value and options; see area/3.
@spec area(t(), measurement(), keyword()) :: t()
Retains faces by area in mm², using the value/range rules of length/3.
The default tolerance is 1.0e-7 mm². Invalid for edge queries.
Keeps candidates with the greatest center coordinate along a world axis.
Faces use their area centroid; edges use their curve parameter midpoint, which need not be halfway along arc length. This is not a bounding-box extremum. All ties within 1.0e-7 mm are retained; empty input stays empty.
Keeps the least center coordinate, with the same rules as at_max/2.
Removes candidates matched by a query against the preceding selection.
Preserves the order of surviving candidates. Nested selectors obey the same validation and callback rules as a top-level query.
Retains planar faces facing a signed world axis.
Accepts :x, :y, :z for positive directions or
{:x, :negative} (and corresponding Y/Z tuples). Uses oriented face
normals and a unit-vector component threshold of 1 - 1.0e-9.
This filter is invalid for an edge query.
@spec length(measurement()) :: t()
Matches length using the default tolerance; see length/3.
@spec length(t() | measurement(), measurement() | keyword()) :: t()
Matches length in a pipeline, or accepts a value and options; see length/3.
@spec length(t(), measurement(), keyword()) :: t()
Retains edges whose length matches a value or inclusive {minimum, maximum} range.
Accepts tolerance: (default 1.0e-7 mm), applied to equality and both
range endpoints. Measurements and tolerance must be nonnegative; ranges
must be ordered. Invalid arguments fail when the selector is evaluated.
Length filters are invalid for face queries.
@spec new() :: t()
Returns a selector containing no filters; it selects every candidate.
Retains straight edges parallel to a world axis, ignoring direction sign.
On faces it retains planes whose normals are parallel to that axis. Curved edges and surfaces do not match. Alignment uses a unit-vector component threshold of 1 - 1.0e-9.
@spec radius(measurement()) :: t()
Matches radius using the default tolerance; see radius/3.
@spec radius(t() | measurement(), measurement() | keyword()) :: t()
Matches radius in a pipeline, or accepts a value and options; see radius/3.
@spec radius(t(), measurement(), keyword()) :: t()
Retains circular edges or cylindrical/spherical faces by radius in mm.
Uses the value/range rules of length/3. Candidates without a reported
radius are excluded; they are never treated as radius zero.
Sorts ascending by a property; see sort_by/3.
Sorts a pipeline ascending, or accepts a property and order; see sort_by/3.
Sorts candidates by :length, :area, :radius, or a world axis.
Length is valid only for edges, area only for faces. Axis values use the
same centers as at_max/2. Order is :asc (default) or :desc.
Equal values retain their preceding order. Missing radii come last in
either direction. Sorting does not imply persistent topology identity.
@spec take(t(), non_neg_integer()) :: t()
Keeps the first nonnegative integer number of candidates in the current order.
Zero selects nothing; a count larger than the selection retains everything.
Use after sort_by/3 to choose the smallest or largest items. This can
discard ties; use extrema when every tied candidate should be retained.
Retains a geometry type reported by OCEx.
Edge types are :line, :circle, and :other. Face types are
:plane, :cylinder, :sphere, and :other. Splines fall under
:other. A valid type absent from the candidates selects nothing.
Filters candidates using a boolean predicate over geometry metadata.
Edge metadata is OCEx.edge_info/1 plus :bounds and :midpoint.
A degenerate edge with no tangent uses its endpoint as the midpoint.
Face metadata is OCEx.face_info/1 plus :bounds. Coordinates are world
coordinates. Returning anything except a boolean produces
:invalid_selector_result; exceptions from the predicate propagate.