Skip to content

BRep Sections and Clips¤

compas_model.geometry.brep_section ¤

Functions:¤

clip_brep ¤

clip_brep(
    brep: Brep,
    frame: Frame,
    source_guid: str,
    tolerance: float = 1e-06,
    minimum_area: float = 0.0,
    cap: bool = True,
    curve_samples: int = 64,
) -> ClipElementResult

Clip a native OCC BRep and retain everything behind the plane.

Native OCC splitting always caps intersected BReps. Therefore cap=False is unsupported when the BRep spans both half-spaces.

intersection_brep_plane ¤

intersection_brep_plane(
    brep: Brep,
    frame: Frame,
    tolerance: float = 1e-06,
    minimum_area: float = 0.0,
    curve_samples: int = 64,
) -> tuple[list[PlanarRegion], list[Polyline]]

Intersect a native OCC BRep with a plane.

Parameters:

  • brep (Brep) –

    The native OCC BRep.

  • frame (Frame) –

    The oriented cutting-plane frame.

  • tolerance (float, default: 1e-06 ) –

    Absolute coplanarity and curve endpoint-welding tolerance.

  • minimum_area (float, default: 0.0 ) –

    Minimum net area of returned polygonal regions.

  • curve_samples (int, default: 64 ) –

    Samples per native section edge.

Returns:

section_brep ¤

section_brep(
    brep: Brep,
    frame: Frame,
    source_guid: str,
    tolerance: float = 1e-06,
    minimum_area: float = 0.0,
    curve_samples: int = 64,
) -> SectionElementResult

Section a native COMPAS OCC BRep with an oriented plane.

Parameters:

  • brep (Brep) –

    The native OCC BRep to section. The input is not modified.

  • frame (Frame) –

    The cutting-plane frame. Its Z axis points toward the front side.

  • source_guid (str) –

    String representation of the source element GUID.

  • tolerance (float, default: 1e-06 ) –

    Absolute distance used for classification and curve endpoint welding.

  • minimum_area (float, default: 0.0 ) –

    Minimum net area of returned polygonal section regions.

  • curve_samples (int, default: 64 ) –

    Number of samples used to convert every native section edge to a polyline for planar-region reconstruction.

Returns:

Raises:

  • ImportError –

    If the optional COMPAS OCC backend is unavailable.

  • TypeError –

    If brep is not a native COMPAS OCC BRep.

  • ValueError –

    If an option or native shape is invalid.

Notes

Plane intersection and solid trimming are native Open CASCADE operations. The returned PlanarRegion boundaries are polygonal approximations of the exact section curves controlled by curve_samples.