compas_tf.brep
¤
Classes¤
BrepMixin
¤
Gives a class get_brep(): its meshes as a solid, coplanar-merged Brep.
Mixed into every compas_tf element, feature and model. A subclass only has
to say WHICH meshes it owns, by overriding :meth:brep_meshes; the default
picks up a meshes attribute, which is what the cut features carry.
Methods:¤
brep_meshes
¤
The meshes :meth:get_brep converts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variant
|
str
|
Which geometry to convert, for classes that own more than one (see
:meth: |
None
|
Returns:
| Type | Description |
|---|---|
list[:class:`compas.datastructures.Mesh`]
|
Empty when the class carries no geometry (a marker feature, say),
in which case :meth: |
get_brep
¤
get_brep(variant: str | None = None, merge_coplanar: bool = True, solid: bool = True, lineardeflection: float = LINEAR_DEFLECTION, angulardeflection: float = ANGULAR_DEFLECTION)
This object's geometry as a solid Brep, with coplanar faces merged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variant
|
str
|
Which baked geometry variant to convert, for elements carrying more
than one - e.g. |
None
|
merge_coplanar
|
bool
|
Merge coplanar faces into single (hole-carrying) faces. |
True
|
solid
|
bool
|
Sew the faces into a closed solid. |
True
|
lineardeflection
|
float
|
Tolerances for the coplanar-face merge. |
LINEAR_DEFLECTION
|
angulardeflection
|
float
|
Tolerances for the coplanar-face merge. |
LINEAR_DEFLECTION
|
Returns:
| Type | Description |
|---|---|
class:`compas_occt.brep.OCCBrep` or None
|
A single solid, or a compound when the object owns several meshes.
|
Functions:¤
mesh_to_brep
¤
mesh_to_brep(mesh, solid: bool = True, merge_coplanar: bool = True, lineardeflection: float = LINEAR_DEFLECTION, angulardeflection: float = ANGULAR_DEFLECTION, name: str | None = None)
Convert one COMPAS mesh into a solid OCC Brep with its coplanar faces merged.
The merge is why the conversion is worth doing: a boolean leaves triangle soup, and merging collapses it back into the flat faces the part was actually modelled with. A Mesh face cannot carry a hole either, so a drilled face has to be fanned into many faces around the hole - a Brep face carries its hole loops properly and comes back as ONE face.
The merge is guarded: OCC's face unification also fuses nearly coplanar faces, which flattens lofted (twisted-quad) geometry. So the angular deflection is tight by default, and if unification changes the solid's volume the exact, unsimplified Brep is kept instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
:class:`compas.datastructures.Mesh`
|
The mesh to convert. Should be closed for |
required |
solid
|
bool
|
Sew the faces into a closed solid. |
True
|
merge_coplanar
|
bool
|
Merge coplanar faces (and the edges between them) into single faces. |
True
|
lineardeflection
|
float
|
Tolerances handed to |
LINEAR_DEFLECTION
|
angulardeflection
|
float
|
Tolerances handed to |
LINEAR_DEFLECTION
|
name
|
str
|
Name given to the resulting Brep. |
None
|
Returns:
| Type | Description |
|---|---|
class:`compas_occt.brep.OCCBrep`
|
|
meshes_to_brep
¤
Convert a list of meshes into ONE Brep - a compound when there are several.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meshes
|
list[:class:`compas.datastructures.Mesh`]
|
The meshes to convert. Empty gives |
required |
name
|
str
|
Name given to the resulting Brep. |
None
|
**kwargs
|
Forwarded to :func: |
{}
|
Returns:
| Type | Description |
|---|---|
class:`compas_occt.brep.OCCBrep` or None
|
|