pyvista_cad.as_cad_multiblock

On this page

pyvista_cad.as_cad_multiblock#

as_cad_multiblock(obj, *, linear_deflection=0.1, angular_deflection=0.5, feature_angle=30.0)[source]#

Resolve obj to a {'faces', 'edges'} pyvista.MultiBlock.

The same resolution add_cad() performs, but returned as data instead of rendered: faces is a per-face / per-block MultiBlock carrying analytic normals, edges the topological B-rep curves (or feature edges for a mesh with no B-rep origin).

Parameters:
objAny

Anything add_cad() accepts.

linear_deflection, angular_deflectionfloat

Tessellation tolerances if obj is not yet meshed.

feature_anglefloat, default: 30.0

Crease angle for the no-B-rep feature-edge fallback.

Returns:
pyvista.MultiBlock

{'faces': MultiBlock | PolyData, 'edges': PolyData}.

Parameters:
Return type:

MultiBlock

Examples

Resolve a build123d box to faces/edges blocks (requires the [step] extra):

>>> import build123d as b3d
>>> from pyvista_cad import as_cad_multiblock
>>> cad = as_cad_multiblock(b3d.Box(10, 10, 10).wrapped)
>>> type(cad).__name__
'MultiBlock'
>>> sorted(cad.keys())
['edges', 'faces']