pyvista.Plotter.add_mesh_clip_box#
- Plotter.add_mesh_clip_box(
- mesh,
- invert: bool = False,
- rotation_enabled: bool = True,
- widget_color=None,
- outline_translation: bool = True,
- merge_points: bool = True,
- crinkle: bool = False,
- interaction_event: pyvista.InteractionEventType = 'end',
- **kwargs,
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_meshesattribute on the plotter.- Parameters:
- mesh
DataSet| 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_color
ColorLike,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_event
InteractionEventType,optional The VTK interaction event to use for triggering the callback. Accepts either the strings
'start','end','always'or a vtkCommand.EventIds.Changed in version 0.38.0: Changed from
event_typetointeraction_eventand now accepts either strings and vtkCommand.EventIds.- **kwargs
dict,optional All additional keyword arguments are passed to
pyvista.Plotter.add_mesh()to control how the mesh is displayed.
- mesh
- Returns:
- 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()
For a full example see Box Widget.