compas_brep.trim
¤
Classes¤
BrepTrim
¤
BrepTrim(
edge: BrepEdge | None,
is_reversed: bool = False,
curve_2d: NurbsCurve | None = None,
vertex: BrepVertex | None = None,
)
A coedge: a directed usage of a BrepEdge within a BrepLoop on a BrepFace.
Inspired by STEP's ORIENTED_EDGE / PCURVE model. A trim wraps a shared
BrepEdge with:
- is_reversed: whether this usage traverses the edge backward
- curve_2d: a NurbsCurve in the face surface's UV parameter space (pcurve)
The pcurve allows direct UV-space tessellation without 3D→UV inversion. The 3D curve and vertices are accessed via the underlying edge.
- API Reference
Attributes¤
curve
property
writable
¤
curve: NurbsCurve | None
The 2D parametric curve in the face's UV space (pcurve).
curve_2d
property
writable
¤
curve_2d: NurbsCurve | None
Alias for the 2D parametric curve (pcurve).
is_singular
property
¤
is_singular: bool
Whether this trim has no edge and collapses to a single vertex.
A sphere's poles are the canonical case: the trim spans the full u-range of the surface at v = min or v = max, but every point on it is the same point in 3D.
vertex
property
¤
vertex: BrepVertex | None
The vertex a singular trim collapses to. None for an ordinary trim.
Methods:¤
sample_points
¤
Sample points along this trim for visualization.
When a pcurve is available, samples via pcurve → surface evaluation so the resulting polyline lies exactly on the tessellated surface mesh. Falls back to the 3D edge curve when no pcurve is present.
Parameters: