rhino3dm.Brep

class rhino3dm.Brep

Bases: GeometryBase

/// Boundary Representation. A surface or polysurface along with trim curve information.

AddEdgeCurve(curve: Curve) → int

Add a 3d curve used by the brep edges

Returns:

Index used to reference this geometry in the edge curve list

AddSurface(surface: Surface) → int

Adds a 3D surface used by BrepFace.

Parameters:

surface – A copy of the surface is added to this brep.

Returns:

Index that should be used to reference the geometry. -1 is returned if the input is not acceptable.

AddTrimCurve(curve: Curve) → int

Add a 2d curve used by the brep trims

Returns:

Index used to reference this geometry in the trimming curve list

Append(other: Brep) → None

Appends a copy of another brep to this and updates indices of appended brep parts. Duplicates are not removed

Compact() → None

Deletes any unreferenced objects from arrays, re-indexes as needed, and shrinks arrays to minimum required size. Uses CUllUnused* members to delete any unreferenced objects from arrays.

static CreateFromBox(box: BoundingBox) → Brep
static CreateFromBox(corners: collections.abc.Sequence[Point3d]) → Brep
static CreateFromBox(box: Box) → Brep

Constructs new brep that matches a bounding box.

Parameters:

box – A box to use for creation.

Returns:

A new brep; or null on failure.

static CreateFromCone(cone: Cone, capBottom: bool) → Brep

Constructs a Brep representation of the cone with a single face for the cone, an edge along the cone seam, and vertices at the base and apex ends of this seam edge. The optional cap is a single face with one circular edge starting and ending at the base vertex.

Parameters:
  • cone – A cone value.

  • capBottom – if true the base of the cone should be capped.

Returns:

A Brep if successful, null on error.

static CreateFromCylinder(cylinder: Cylinder, capBottom: bool, capTop: bool) → Brep

Constructs a Brep definition of a cylinder.

Parameters:
  • cylinder – cylinder.IsFinite() must be true.

  • capBottom – if true end at cylinder.m_height[0] should be capped.

  • capTop – if true end at cylinder.m_height[1] should be capped.

Returns:

A Brep representation of the cylinder with a single face for the cylinder, an edge along the cylinder seam, and vertices at the bottom and top ends of this seam edge. The optional bottom/top caps are single faces with one circular edge starting and ending at the bottom/top vertex.

static CreateFromMesh(mesh: Mesh, trimmedTriangles: bool) → Brep

Create a brep representation of a mesh

Parameters:

trimmedTriangles – if true, triangles in the mesh will be represented by trimmed planes in the brep. If false, triangles in the mesh will be represented by untrimmed singular bilinear NURBS surfaces in the brep.

static CreateFromRevSurface(surface: RevSurface, capStart: bool, capEnd: bool) → Brep

Constructs a brep form of a surface of revolution.

Parameters:
  • surface – The surface of revolution.

  • capStart – if true, the start of the revolute is not on the axis of revolution, and the surface of revolution is closed, then a circular cap will be added to close of the hole at the start of the revolute.

  • capEnd – if true, the end of the revolute is not on the axis of revolution, and the surface of revolution is closed, then a circular cap will be added to close of the hole at the end of the revolute.

Returns:

A Brep if successful, null on error.

static CreateFromSphere(sphere: Sphere) → Brep

Constructs a Brep definition of a sphere.

Parameters:

sphere – The input sphere provides the orienting plane and radius.

Returns:

A Brep if successful, null on error.

static CreateFromSurface(surface: Surface | None) → Brep

Constructs a Brep from a surface. The resulting Brep has an outer boundary made from four trims. The trims are ordered so that they run along the south, east, north, and then west side of the surface’s parameter space.

Parameters:

surface – A surface to convert.

Returns:

Resulting brep or null on failure.

static CreateFromTorus(torus: Torus) → Brep

Constructs a Brep definition of a torus.

Parameters:

torus – The torus.

Returns:

A Brep representation of the torus if successful, null otherwise.

static CreateQuadSphere(sphere: Sphere) → Brep

Constructs a Brep definition of a quad sphere.

Parameters:

sphere – The input sphere provides the orienting plane and radius.

Returns:

A Brep if successful, null on error.

static CreateTrimmedPlane(plane: Plane, curves: collections.abc.Sequence[Curve] | None) → Brep
static CreateTrimmedPlane(plane: Plane, curve: Curve) → Brep

Create a Brep trimmed plane.

Parameters:
  • plane – Plane that will be trimmed.

  • curve – A simple (no self intersections) closed curve that defines the outer boundary of the trimmed plane.

Returns:

Resulting brep or null on failure.

CullUnused2dCurves() → bool

Culls 3d curves not referenced by an edge.

Returns:

true if operation succeeded; false otherwise.

CullUnused3dCurves() → bool

Culls 2d curves not referenced by a trim.

Returns:

true if operation succeeded; false otherwise.

CullUnusedEdges() → bool

Culls edges with m_edge_index == -1.

Returns:

true if operation succeeded; false otherwise.

CullUnusedFaces() → bool

Culls faces with m_face_index == -1.

Returns:

true if operation succeeded; false otherwise.

CullUnusedLoops() → bool

Culls loops with m_loop_index == -1.

Returns:

true if operation succeeded; false otherwise.

CullUnusedSurfaces() → bool

Culls surfaces not referenced by a face.

Returns:

true if operation succeeded; false otherwise.

CullUnusedTrims() → bool

Culls trims with m_trim_index == -1.

Returns:

true if operation succeeded; false otherwise.

CullUnusedVertices() → bool

Culls vertices with m_vertex_index == -1.

Returns:

true if operation succeeded; false otherwise.

Duplicate() → Brep

Copies this brep.

Returns:

A brep.

DuplicateBrep() → Brep

Same as Duplicate, but already performs a cast to a brep.

This cast always succeeds.

Returns:

A brep.

DuplicateSubBrep(faceIndices: collections.abc.Sequence[int]) → Brep

Copy a subset of this Brep into another Brep.

Parameters:

faceIndices – array of face indices in this brep to copy. (If any values in faceIndices are out of range or if faceIndices contains duplicates, this function will return null.)

Returns:

A brep, or null on error.

DuplicateVertices() → list[Any]

Duplicate all the corner vertices of this Brep.

Returns:

An array or corner vertices.

Flip() → None

Reverses entire brep orientation of all faces.

IsDuplicate(other: Brep, tolerance: float) → bool

See if this and other are same brep geometry.

Parameters:
  • other – other brep.

  • tolerance – tolerance to use when comparing control points.

Returns:

true if breps are the same.

IsOrientedManifold() → tuple[bool, bool, bool]

Test a Brep to see if it is an oriented manifold. Non manifold Breps have at least one edge that is shared among three or more faces.

Returns:

If the Brep is a manifold, true is returned. Otherwise false is returned.

IsValidGeometry() → tuple[bool, str]

Expert user function that tests the brep to see if its geometry information is valid. The value of brep.IsValidTopology() must be true before brep.IsValidGeometry() can be safely called.

Returns:

A value that indicates whether the geometry is valid.

IsValidTolerancesAndFlags() → tuple[bool, str]

Expert user function that tests the brep to see if its tolerances and flags are valid. The values of brep.IsValidTopology() and brep.IsValidGeometry() must be true before brep.IsValidTolerancesAndFlags() can be safely called.

Returns:

A value that indicates

IsValidTopology() → tuple[bool, str]

Tests the brep to see if its topology information is valid.

Returns:

true if the topology is valid; false otherwise.

SetTolerancesBoxesAndFlags(bLazy: bool, bSetVertexTolerances: bool, bSetEdgeTolerances: bool, bSetTrimTolerances: bool, bSetTrimIsoFlags: bool, bSetTrimTypeFlags: bool, bSetLoopTypeFlags: bool, bSetTrimBoxes: bool) → None
SetTolerancesBoxesAndFlags() → None

Set tolerances and flags in a Brep.

SetTrimIsoFlags() → None

This function can be used to set the BrepTrim::m_iso flag. It is intended to be used when creating a Brep from a definition that does not include compatible parameter space type information.

SetVertices() → None

This function can be used to compute vertex information for a b-rep when everything but the Vertices array is properly filled in. It is intended to be used when creating a Brep from a definition that does not include explicit vertex information.

Standardize() → None

Standardizes all trims, edges, and faces in the brep. After standardizing, there may be unused curves and surfaces in the brep. Call Brep.Compact to remove these unused curves and surfaces.

static TryConvertBrep(geometry: GeometryBase) → Brep

Attempts to convert a generic Geometry object into a Brep.

Parameters:

geometry – Geometry to convert, not all types of GeometryBase can be represented by BReps.

Returns:

Brep if a brep form could be created or null if this is not possible. If geometry was of type Brep to begin with, the same object is returned, i.e. it is not duplicated.

property Edges: BrepEdgeList

Gets the brep edges list accessor.

property Faces: BrepFaceList

Gets the brep faces list accessor.

property IsManifold: bool

Gets a value indicating whether or not the Brep is manifold. Non manifold breps have at least one edge that is shared among three or more faces.

property IsSolid: bool

Determines whether this brep is a solid, or a closed oriented manifold.

property IsSurface: bool

Returns true if the Brep has a single face and that face is geometrically the same as the underlying surface. I.e., the face has trivial trimming.

In this case, the surface is the first face surface. The flag Brep.Faces[0].OrientationIsReversed records the correspondence between the surface’s natural parametric orientation and the orientation of the Brep.

trivial trimming here means that there is only one loop curve in the brep and that loop curve is the same as the underlying surface boundary.

property Loops: BrepLoopList

Gets the brep loop list accessor.

property SolidOrientation: BrepSolidOrientation

Gets the solid orientation state of this Brep.

property Surfaces: BrepSurfaceList

Parametric surfaces used by faces

property Trims: BrepTrimList

Gets the brep trims list accessor.

property Vertices: BrepVertexList

Gets the brep vertices list accessor.