pyvista.Plotter.add_mesh_clip_box#

Plotter.add_mesh_clip_box(mesh, invert=False, rotation_enabled=True, widget_color=None, outline_translation=True, merge_points=True, crinkle=False, interaction_event='end', **kwargs)[source]#

Clip a mesh using a box widget.

Add a mesh to the scene with a box widget that is used to clip the mesh interactively.

The clipped mesh is saved to the .box_clipped_meshes attribute on the plotter.

Parameters:
meshpyvista.DataSet or vtk.vtkAlgorithm

The input dataset to add to the scene and clip or algorithm that produces said mesh.

invertbool, optional

Flag on whether to flip/invert the clip.

rotation_enabledbool, optional

If False, the box widget cannot be rotated and is strictly orthogonal to the cartesian axes.

widget_colorColorLike, optional

Color of the widget. Either a string, RGB sequence, or hex color string. For example:

  • color='white'

  • color='w'

  • color=[1.0, 1.0, 1.0]

  • color='#FFFFFF'

outline_translationbool, optional

If False, the plane widget cannot be translated and is strictly placed at the given bounds.

merge_pointsbool, optional

If True (default), coinciding points of independently defined mesh elements will be merged.

crinklebool, optional

Crinkle the clip by extracting the entire cells along the clip.

interaction_eventvtk.vtkCommand.EventIds, str, optional

The VTK interaction event to use for triggering the callback. Accepts either the strings 'start', 'end', 'always' or a vtk.vtkCommand.EventIds.

Changed in version 0.38.0: Changed from event_type to interaction_event and now accepts either strings and vtk.vtkCommand.EventIds.

**kwargsdict, optional

All additional keyword arguments are passed to Plotter.add_mesh() to control how the mesh is displayed.

Returns:
vtk.vtkActor

VTK actor of the mesh.

Examples

Shows an interactive clip box.

>>> import pyvista as pv
>>> mesh = pv.ParametricConicSpiral()
>>> pl = pv.Plotter()
>>> _ = pl.add_mesh_clip_box(mesh, color='white')
>>> pl.show()
https://d33wubrfki0l68.cloudfront.net/c2a14dc328a96ef085161aeb046593a47d778d7c/e017c/_images/pyvista-plotter-add_mesh_clip_box-1_00_00.png

For a full example see Box Widget.