pyvista_cad.from_cadquery

On this page

pyvista_cad.from_cadquery#

from_cadquery(workplane, /, *, linear_deflection=0.1, angular_deflection=0.5)[source]#

Convert a cadquery.Workplane or Compound to PyVista.

The geometry is unwrapped to an OCCT TopoDS shape and tessellated at the requested deflections.

Parameters:
workplanecadquery.Workplane or cadquery.Compound

Input geometry.

linear_deflectionfloat, default: 0.1

OCCT linear deflection (model units).

angular_deflectionfloat, default: 0.5

OCCT angular deflection (radians).

Returns:
pyvista.PolyData

Triangulated geometry. The cad.source_format field array is set to 'cadquery'.

Raises:
pyvista_cad.OptionalDependencyError

If cadquery is not installed.

Parameters:
  • workplane (Any)

  • linear_deflection (float)

  • angular_deflection (float)

Return type:

pv.PolyData

See also

to_cadquery

Inverse conversion.

Examples

>>> import cadquery as cq
>>> from pyvista_cad import from_cadquery
>>> box = cq.Workplane('XY').box(1, 1, 1)
>>> poly = from_cadquery(box)
>>> poly.n_cells > 0
True