pyvista_cad.flatten_to_cad_polydata

pyvista_cad.flatten_to_cad_polydata#

flatten_to_cad_polydata(mb)[source]#

Collapse a topods_to_multiblock() result to one PolyData.

Per-face blocks are merged into a single pyvista.PolyData carrying a cad.face_id cell array; the edges block is stashed as a companion attribute and is recoverable via get_cad_edges().

Parameters:
mbpyvista.MultiBlock

A {'faces', 'edges'} block from topods_to_multiblock().

Returns:
pyvista.PolyData

Merged faces with cad.face_id; edges available through get_cad_edges().

Parameters:

mb (MultiBlock)

Return type:

PolyData

Examples

Flatten a per-face block tree to one PolyData (requires the [step] extra):

>>> import build123d as b3d
>>> from pyvista_cad import topods_to_multiblock, flatten_to_cad_polydata
>>> mb = topods_to_multiblock(b3d.Box(10, 10, 10).wrapped)
>>> poly = flatten_to_cad_polydata(mb)
>>> type(poly).__name__
'PolyData'
>>> 'cad.face_id' in poly.cell_data
True