pyvista_cad.plot_cad

On this page

pyvista_cad.plot_cad#

plot_cad(obj, **kwargs)[source]#

One-shot CAD-friendly plot of obj (mirrors mesh.plot()).

Builds a pyvista.Plotter, calls add_cad(), and shows it. show-level keywords (screenshot, cpos, off_screen, window_size, jupyter_backend, return_cpos) are split out and forwarded to pyvista.Plotter.show(); everything else goes to add_cad().

Parameters:
objAny

Anything add_cad() accepts.

**kwargs

Split between add_cad() and pyvista.Plotter.show().

Returns:
Any

Whatever pyvista.Plotter.show() returns.

Parameters:
Return type:

Any

Examples

One-shot CAD plot of a build123d box (requires the [step] extra):

>>> import pyvista as pv
>>> pv.OFF_SCREEN = True
>>> import build123d as b3d
>>> from pyvista_cad import plot_cad
>>> cpos = plot_cad(b3d.Box(10, 10, 10).wrapped, return_cpos=True)
>>> type(cpos).__name__
'CameraPosition'