OCCBrep
¤
Class for Boundary Representation of geometric entities.
Attributes:
-
vertices(list[OCCBrepVertex]) –The vertices of the Brep.
-
edges(list[OCCBrepEdge]) –The edges of the Brep.
-
loops(list[OCCBrepLoop]) –The loops of the Brep.
-
faces(list[OCCBrepFace]) –The faces of the Brep.
-
frame(Frame) –The local coordinate system of the Brep.
-
area(float) –The surface area of the Brep.
-
volume(float) –The volume of the regions contained by the Brep.
Functions¤
__from_data__
classmethod
¤
boolean_difference
¤
Return the boolean difference of this shape and a collection of other shapes.
Parameters:
-
others(OCCBrep, default:()) –A collection of other BRep shapes to subtract from the current shape.
Results
OCCBrep The difference between the current shape and the other shapes.
Raises:
-
BrepBooleanError–
boolean_intersection
¤
Return the boolean intersection of the current shape and a collection of other shapes.
Parameters:
-
others(OCCBrep, default:()) –A collection of other BRep shapes to intersect with the current shape.
Returns:
-
OCCBrep–The intersection between the current shape and the others.
Raises:
-
BrepBooleanError–
boolean_union
¤
contours
¤
edge_faces
¤
edge_faces(edge: OCCBrepEdge) -> list[OCCBrepFace]
Identify the faces connected to an edge.
Parameters:
-
edge(OCCBrepEdge) –An edge of the Brep.
Returns:
-
list[OCCBrepFace]–The faces connected to the given edge.
edge_loops
¤
edge_loops(edge: OCCBrepEdge) -> list[OCCBrepLoop]
Identify the parent loops of an edge.
Parameters:
-
edge(OCCBrepEdge) –An edge of the Brep.
Returns:
-
list[OCCBrepLoop]–The loops containing the given edge.
fillet
¤
fillet(radius: float, exclude: list[OCCBrepEdge] | None = None) -> None
Fillet the edges of a BRep.
Parameters:
-
radius(float) –The radius of the fillet.
-
exclude(list[OCCBrepEdge] | None, default:None) –A list of edges to exclude from the fillet operation.
Raises:
-
BrepFilletError–If the fillet operation could not be completed.
Returns:
-
None–the Brep is modified in-place.
filleted
¤
filleted(radius: float, exclude: list[OCCBrepEdge] | None = None) -> OCCBrep
Construct a copy of a Brep with filleted edges.
Parameters:
-
radius(float) –The radius of the fillet.
-
exclude(list[OCCBrepEdge] | None, default:None) –A list of edges to exclude from the fillet operation.
Returns:
-
OCCBrep–
from_boolean_difference
classmethod
¤
from_boolean_intersection
classmethod
¤
from_boolean_union
classmethod
¤
from_box
classmethod
¤
from_brepfaces
classmethod
¤
from_brepfaces(faces: list[OCCBrepFace], solid: bool = True) -> OCCBrep
Make a BRep from a list of BRep faces forming an open or closed shell.
Parameters:
-
faces(list[OCCBrepFace]) –The input faces.
-
solid(bool, default:True) –Flag indicating that if the resulting shape should be converted to a solid, if possible.
Returns:
-
OCCBrep–
from_breps
classmethod
¤
Construct one compound BRep out of multiple individual BReps.
from_cone
classmethod
¤
from_curves
classmethod
¤
from_curves(curves: list[NurbsCurve]) -> OCCBrep
Construct a BRep from a set of curves.
Parameters:
-
curves(list[NurbsCurve]) –The input curves.
Returns:
-
OCCBrep–The resulting BRep.
from_cylinder
classmethod
¤
from_extrusion
classmethod
¤
from_extrusion(
profile: OCCBrepEdge | OCCBrepFace, vector: Vector, cap_ends: bool = False
) -> OCCBrep
Construct a BRep by extruding a closed curve along a direction vector.
Parameters:
-
profile(OCCBrepEdge | OCCBrepFace) –The base profile of the extrusion.
-
vector(Vector) –The extrusion vector. The extrusion has the same height as the length vector.
-
cap_ends(bool, default:False) –Flag indicating that the ends of the brep should be capped. Currently this flag is not supported.
Returns:
-
OCCBrep–
from_iges
classmethod
¤
from_loft
classmethod
¤
from_mesh
classmethod
¤
from_native
classmethod
¤
from_native(shape: TopoDS_Shape) -> OCCBrep
Construct a BRep from an OCC shape.
Parameters:
-
shape(TopoDS_Shape) –The OCC shape.
Returns:
-
OCCBrep–
from_plane
classmethod
¤
from_planes
classmethod
¤
from_polygons
classmethod
¤
from_shape
classmethod
¤
from_shape(shape: TopoDS_Shape) -> OCCBrep
Construct a BRep from an OCC shape.
Parameters:
-
shape(TopoDS_Shape) –The OCC shape.
Returns:
-
OCCBrep–
from_sphere
classmethod
¤
from_step
classmethod
¤
from_surface
classmethod
¤
from_surface(
surface: Surface | OCCNurbsSurface,
domain_u: tuple[float, float] | None = None,
domain_v: tuple[float, float] | None = None,
precision: float = 1e-06,
loop: OCCBrepLoop | None = None,
inside: bool = True,
) -> OCCBrep
Construct a BRep from a COMPAS surface.
Parameters:
-
surface(Surface | OCCNurbsSurface) –The input surface.
-
domain_u(tuple[float, float] | None, default:None) –The domain of the surface in the U direction.
-
domain_v(tuple[float, float] | None, default:None) –The domain of the surface in the V direction.
-
precision(float, default:1e-06) –The precision of the discretisation of the surface.
-
loop(OCCBrepLoop | None, default:None) –The loop to trim the surface with.
-
inside(bool, default:True) –Whether to keep the inside or outside of the loop.
Returns:
-
OCCBrep–
from_sweep
classmethod
¤
from_sweep(profile: OCCBrepEdge | OCCBrepFace, path: OCCBrepLoop) -> OCCBrep
Construct a BRep by sweeping a profile along a path.
References
https://dev.opencascade.org/doc/occt-7.4.0/refman/html/class_b_rep_prim_a_p_imakesweep.html https://dev.opencascade.org/doc/occt-7.4.0/refman/html/class_b_rep_offset_a_p_i_make_pipe.html https://dev.opencascade.org/doc/occt-7.4.0/refman/html/class_b_rep_offset_a_p_i___make_pipe_shell.html
from_torus
classmethod
¤
intersect
¤
make_positive
¤
Make the volume of a closed brep positive if it is not.
Returns:
-
None–
offset
¤
overlap
¤
overlap(
other: OCCBrep,
linear_deflection: float | None = None,
angular_deflection: float | None = None,
tolerance: float = 0.0,
relative: bool = False,
) -> tuple[list[OCCBrepFace], list[OCCBrepFace]]
Compute the overlap between this BRep and another.
Parameters:
-
other(OCCBrep) –The other brep.
-
linear_deflection(float | None, default:None) –Maximum linear deflection for shape approximation.
-
angular_deflection(float | None, default:None) –Maximum angular deflection for shape approximation.
-
tolerance(float, default:0.0) –Allowable deviation between shapes.
Other Parameters:
-
relative(bool) –If True, linear deflection used for faces is the maximum linear deflection of their edges.
Returns:
-
tuple[list[OCCBrepFace], list[OCCBrepFace]]–
simplify
¤
simplify(
merge_edges: bool = True,
merge_faces: bool = True,
lineardeflection: float | None = None,
angulardeflection: float | None = None,
)
Simplify the shape by merging colinear edges and coplanar faces.
Parameters:
-
merge_edges(bool, default:True) –Merge edges with the same underlying geometry.
-
merge_faces(bool, default:True) –Merge faces with the same underlying geometry.
-
lineardeflection(float | None, default:None) –Default is
compas.tolerance.Tolerance.lineardeflection. -
angulardeflection(float | None, default:None) –Default is
compas.tolerance.Tolerance.angulardeflection.
Returns:
-
None–
slice
¤
split
¤
to_brep
¤
to_iges
¤
to_meshes
¤
Convert the faces of the BRep shape to meshes.
Parameters:
-
u(int, default:16) –The number of mesh faces in the U direction of the underlying surface geometry of every face of the Brep.
-
v(int, default:16) –The number of mesh faces in the V direction of the underlying surface geometry of every face of the Brep.
Returns:
to_polygons
¤
to_step
¤
to_stl
¤
to_stl(
filepath: str | Path,
linear_deflection: float = 0.001,
angular_deflection: float = 0.5,
) -> bool
Write the BRep shape to a STL file.
Parameters:
-
filepath(str | Path) –Location of the file.
-
linear_deflection(float, default:0.001) –Allowable deviation between curved geometry and mesh discretisation.
-
angular_deflection(float, default:0.5) –Maximum angle between two adjacent facets.
Returns:
-
None–
to_tesselation
¤
to_tesselation(
linear_deflection: float | None = None, angular_deflection: float | None = None
) -> tuple[Mesh, list[Polyline]]
Create a tesselation of the shape for visualisation.
Parameters:
-
linear_deflection(float | None, default:None) –Allowable "distance" deviation between curved geometry and mesh discretisation.
-
angular_deflection(float | None, default:None) –Allowable "curvature" deviation between curved geometry and mesh discretisation.
Returns:
to_viewmesh
¤
to_viewmesh(
linear_deflection: float | None = None, angular_deflection: float | None = None
) -> tuple[Mesh, list[Polyline]]
Convert the BRep to a view mesh.
Parameters:
-
linear_deflection(float | None, default:None) –Allowable "distance" deviation between curved geometry and mesh discretisation.
-
angular_deflection(float | None, default:None) –Allowable "curvature" deviation between curved geometry and mesh discretisation.
Returns:
transform
¤
transform(matrix: Transformation) -> None
transformed
¤
transformed(matrix: Transformation) -> OCCBrep
Return a transformed copy of the Brep.
Parameters:
-
matrix(Transformation) –A transformation matrix.
Returns:
-
OCCBrep–
trimmed
¤
vertex_edges
¤
vertex_edges(vertex: OCCBrepVertex) -> list[OCCBrepEdge]
Identify the edges connected to a given vertex.
Parameters:
-
vertex(OCCBrepVertex) –A vertex of the Brep
Returns:
-
list[OCCBrepEdge]–The edges connected to the given vertex.
vertex_faces
¤
vertex_faces(vertex: OCCBrepVertex) -> list[OCCBrepFace]
Identify the faces connected to a vertex.
Parameters:
-
vertex(OCCBrepVertex) –A vertex of the Brep.
Returns:
-
list[OCCBrepFace]–The faces connected to the given vertex.
vertex_neighbors
¤
vertex_neighbors(vertex: OCCBrepVertex) -> list[OCCBrepVertex]
Identify the neighbouring vertices of a given vertex.
Parameters:
-
vertex(OCCBrepVertex) –A vertex of the Brep.
Returns:
-
list[OCCBrepVertex]–The neighbouring vertices of the given vertex.