pyvista_cad.from_topods

On this page

pyvista_cad.from_topods#

from_topods(shape, /, *, linear_deflection=0.1, angular_deflection=0.5)[source]#

Tessellate a raw OCCT TopoDS_Shape into a pyvista.PolyData.

Parameters:
shapeOCP.TopoDS.TopoDS_Shape

The OCCT shape to tessellate.

linear_deflectionfloat, default: 0.1

OCCT tessellation linear deflection (model units).

angular_deflectionfloat, default: 0.5

OCCT tessellation angular deflection (radians).

Returns:
pyvista.PolyData

Triangulated geometry.

Raises:
pyvista_cad.OptionalDependencyError

If OCP is not installed.

Parameters:
  • shape (Any)

  • linear_deflection (float)

  • angular_deflection (float)

Return type:

pv.PolyData

Examples

Tessellate a raw OCCT shape from a build123d box (requires the [step] extra):

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