BRep
- class compas_occ.brep.BRep[source]
Bases:
object
Class for Boundary Representation of geometric entities.
- Attributes
vertices (list[
BRepVertex
], read-only) – The vertices of the BRep.edges (list[
BRepEdge
], read-only) – The edges of the BRep.loops (list[
BRepLoop
], read-only) – The loops of the BRep.faces (list[
BRepFace
], read-only) – The faces of the BRep.frame (
Frame
, read-only) – The local coordinate system of the BRep.area (float, read-only) – The surface area of the BRep.
volume (float, read-only) – The volume of the regions contained by the BRep.
- Other Attributes
shape (
TopoDS_Shape
) – The underlying OCC shape of the BRep.type (
TopAbs_ShapeEnum
, read-only) – The type of BRep shape.orientation (
TopAbs_Orientation
, read-only) – Orientation of the shape.
Examples
Constructors
>>> brep = BRep.from_corners([0, 0, 0], [1, 0, 0], [1, 1, 1], [1, 1, 0])
>>> from compas.geometry import Box >>> box = Box.from_width_height_depth(1, 1, 1) >>> vertices, faces = box.to_vertices_and_faces() >>> polygons = [[vertices[index] for index in face] for face in faces] >>> brep = BRep.from_polygons(polygons)
>>> from compas.geometry import Box >>> box = Box.from_width_height_depth(1, 1, 1) >>> brep = BRep.from_box(box)
>>> from compas.geometry import Box, Sphere >>> box = Box.from_width_height_depth(1, 1, 1) >>> sphere = Sphere([1, 1, 1], 0.5) >>> A = BRep.from_box(box) >>> B = BRep.from_sphere(sphere) >>> brep = BRep.from_boolean_union(A, B)
Booleans
>>> from compas.geometry import Box, Sphere >>> box = Box.from_width_height_depth(1, 1, 1) >>> sphere = Sphere([1, 1, 1], 0.5) >>> A = BRep.from_box(box) >>> B = BRep.from_sphere(sphere) >>> C = A + B >>> D = A - B >>> E = A & B
Methods
Generate contour lines by slicing the BRep shape with a series of planes.
Remove all unused edges.
Remove all unused faces.
Remove all unused loops.
Remove all unused vertices.
Construct a BRep from the boolean difference of two other BReps.
Construct a BRep from the boolean intersection of two other BReps.
Construct a BRep from the boolean union of two other BReps.
Construct a BRep from a COMPAS box.
Construct a BRep from a COMPAS cone.
Construct a BRep from 3 or 4 corner points.
Construct a BRep from a set of curves.
Construct a BRep from a COMPAS cylinder.
Construct a BRep from a COMPAS mesh.
Construct a BRep from a set of polygons.
Construct a BRep from a COMPAS sphere.
Construct a BRep from a COMPAS torus.
Check if the shape is closed.
Check if the shape is convex.
Check if the shape is infinite.
Check if the shape is manifold.
Check if the shape is orientable.
Check if the shape is a solid.
Check if the shape is a surface.
Convert the current shape to a solid.
Export the BRep to a JSON file.
Convert the faces of the BRep shape to meshes.
Write the BRep shape to a STEP file.
Create a tesselation of the shape for visualisation.