compas_brep.brep
¤
Brep class — thin wrapper around a native backend geometry object.
_native_brep (a TopoDS_Shape or Rhino.Geometry.Brep) is the sole source of truth.
All topology lists (_vertices, _edges, _loops, _faces) are lazy caches populated on
first access via brep_extract_topology; they are never written as authoritative data.
All operations delegate to the active backend (OCC or Rhino) via the COMPAS plugin system.
All public interface inputs and outputs are COMPAS types — no backend types leak through.
Classes¤
Brep
¤
Brep(name: str | None = None)
Thin wrapper around a native backend geometry object (OCC or Rhino).
_native_brep is the sole source of truth. Topology lists are lazy caches
populated on demand from native via _ensure_topology; they are never written
as primary data. All public interface values are COMPAS types.
-
API Reference
-
compas_brep ClassesBrep Methods:-
__add__ -
__and__ -
__sub__ -
copy -
filleted -
from_boolean_difference -
from_boolean_intersection -
from_boolean_union -
from_boolean_union_multi -
from_box -
from_brepfaces -
from_breps -
from_cone -
from_curves -
from_cylinder -
from_extrusion -
from_iges -
from_loft -
from_mesh -
from_native -
from_pipe -
from_plane -
from_polygons -
from_sphere -
from_step -
from_surface -
from_sweep -
from_torus -
offset -
overlap -
split -
trimmed
-
-
Topology
brep ClassesBrep Methods:-
__add__ -
__and__ -
__sub__ -
copy -
filleted -
from_boolean_difference -
from_boolean_intersection -
from_boolean_union -
from_boolean_union_multi -
from_box -
from_brepfaces -
from_breps -
from_cone -
from_curves -
from_cylinder -
from_extrusion -
from_iges -
from_loft -
from_mesh -
from_native -
from_pipe -
from_plane -
from_polygons -
from_sphere -
from_step -
from_surface -
from_sweep -
from_torus -
offset -
overlap -
split -
trimmed
-
-
- API Reference
Attributes¤
Methods:¤
__add__
¤
A + B. Same as :meth:from_boolean_union, so it returns a list.
__and__
¤
A & B. Same as :meth:from_boolean_intersection, so it returns a list.
__sub__
¤
A - B. Same as :meth:from_boolean_difference, so it returns a list.
contains
¤
contours
¤
edge_loops
¤
fillet
¤
filleted
¤
from_boolean_difference
classmethod
¤
Boolean subtraction: A - B.
Returns one Brep per resulting piece — a subtraction can cut a shape into several disconnected ones. Empty when nothing is left.
from_boolean_intersection
classmethod
¤
Boolean intersection: A & B.
Returns one Brep per resulting piece. Empty when the two do not overlap.
from_boolean_union
classmethod
¤
Boolean union: A + B.
Returns one Brep per resulting piece — disjoint inputs stay disjoint.
from_boolean_union_multi
classmethod
¤
Boolean union of multiple Breps, chained pairwise.
Only the first piece of each intermediate union is carried into the next step, so disjoint inputs are not all preserved. Union them pairwise if that matters.
Parameters:
-
*breps(Brep, default:()) –Two or more Breps to union.
from_brepfaces
classmethod
¤
Build a Brep from a list of BrepFace objects.
from_breps
classmethod
¤
from_curves
classmethod
¤
from_cylinder
classmethod
¤
Create a Brep from a COMPAS Cylinder.
from_extrusion
classmethod
¤
from_iges
classmethod
¤
from_loft
classmethod
¤
from_native
classmethod
¤
Create a Brep from a native backend object (OCC TopoDS_Shape or Rhino.Geometry.Brep).
Parameters:
-
native_brep(Any) –A native OCC or Rhino brep object.
from_pipe
classmethod
¤
from_plane
classmethod
¤
from_plane(
plane: Plane,
domain_u: tuple[float, float] = (-1, 1),
domain_v: tuple[float, float] = (-1, 1),
) -> Brep
Create a single planar face Brep from a Plane with the given domain.
from_polygons
classmethod
¤
Create a Brep from a list of COMPAS Polygons.
from_step
classmethod
¤
from_surface
classmethod
¤
from_sweep
classmethod
¤
offset
¤
Return an offset copy of this Brep.
Parameters:
-
distance(float) –The offset distance (positive = outward, negative = inward).
overlap
¤
slice
¤
Intersect the Brep with a plane, returning intersection polylines.
Parameters:
-
plane(Plane) –The cutting plane.
split
¤
Split this Brep by a cutter Brep (typically a planar surface).
Parameters:
-
cutter(Brep) –The cutting Brep.
to_iges
¤
to_iges(filepath: str) -> None
Export this Brep to an IGES file.
Parameters:
-
filepath(str) –Path to the output .igs or .iges file.
to_meshes
¤
to_step
¤
to_step(filepath: str, **kwargs) -> None
Export this Brep to a STEP file.
Parameters:
-
filepath(str) –Path to the output .step or .stp file.
to_tesselation
¤
to_tesselation(
linear_deflection: float = 0.1, n: int = 16, n_curves: int = 64
) -> tuple[Mesh, list[Polyline]]
Create a tessellation of the Brep for visualization.
Returns a triangulated mesh and a list of boundary polylines. Matches the interface expected by compas_viewer's BRepObject.
Uses cached tessellation when available. Otherwise delegates to the active backend via the brep_tessellate pluggable and caches the result.
Parameters:
to_viewmesh
¤
Convert the Brep to a single mesh for visualization.
Uses cached tessellation if available, otherwise delegates to the active backend via the brep_tessellate pluggable.
Parameters:
transform
¤
transform(transformation: Transformation) -> None
Transform this Brep in-place by a transformation matrix.
Parameters:
-
transformation(Transformation) –The transformation to apply.