pyvista_cad.from_build123d#
- from_build123d(shape, /, *, linear_deflection=0.1, angular_deflection=0.5, pass_data=True)[source]#
Convert a
build123dShapeorCompoundto 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 ontocad.colorandcad.labelfield-data.
- Returns:
- pyvista.PolyData or pyvista.MultiBlock
PolyDatafor a single shape;MultiBlockfor aCompoundwith multiple children.
- Raises:
- pyvista_cad.OptionalDependencyError
If
build123dis not installed.
- Parameters:
- Return type:
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]