pyvista_cad.from_build123d

On this page

pyvista_cad.from_build123d#

from_build123d(shape, /, *, linear_deflection=0.1, angular_deflection=0.5, pass_data=True)[source]#

Convert a build123d Shape or Compound to PyVista.

Parameters:
shapebuild123d.Shape or build123d.Compound

Input geometry.

linear_deflectionfloat, default: 0.1

OCCT tessellation linear deflection (model units).

angular_deflectionfloat, default: 0.5

OCCT tessellation angular deflection (radians).

pass_databool, default: True

When True, propagate build123d color and label onto cad.color and cad.label field-data.

Returns:
pyvista.PolyData or pyvista.MultiBlock

PolyData for a single shape; MultiBlock for a Compound with multiple children.

Raises:
pyvista_cad.OptionalDependencyError

If build123d is not installed.

Parameters:
Return type:

PolyData | MultiBlock

Examples

Convert a build123d box to PyVista (requires the [step] extra):

>>> import build123d as b3d
>>> from pyvista_cad import from_build123d
>>> box = b3d.Box(10, 10, 10)
>>> mesh = from_build123d(box)
>>> type(mesh).__name__
'PolyData'
>>> [round(b) for b in mesh.bounds]
[-5, 5, -5, 5, -5, 5]