pyvista.plotting.widgets.WidgetHelper.add_mesh_slice_spline

pyvista.plotting.widgets.WidgetHelper.add_mesh_slice_spline#

WidgetHelper.add_mesh_slice_spline(
mesh,
generate_triangles=False,
n_handles=5,
resolution=25,
widget_color=None,
show_ribbon=False,
ribbon_color='pink',
ribbon_opacity=0.5,
initial_points=None,
closed=False,
interaction_event=45,
**kwargs,
)[source]#

Slice a mesh with a spline widget.

Add a mesh to the scene with a spline widget that is used to slice the mesh interactively.

The sliced mesh is saved to the .spline_sliced_meshes attribute on the plotter.

Parameters:
meshpyvista.DataSet or vtk.vtkAlgorithm

The input dataset to add to the scene and slice along the spline or algorithm that produces said mesh.

generate_trianglesbool, optional

If this is enabled (False by default), the output will be triangles otherwise, the output will be the intersection polygons.

n_handlesint, optional

The number of interactive spheres to control the spline’s parametric function.

resolutionint, optional

The number of points to generate on the spline.

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'

show_ribbonbool, optional

If True, the poly plane used for slicing will also be shown.

ribbon_colorColorLike, optional

Color of the ribbon. Either a string, RGB sequence, or hex color string.

ribbon_opacityfloat, optional

Opacity of ribbon. Defaults to 1.0 and must be between [0, 1].

initial_pointssequence, optional

The points to initialize the widget placement. Must have same number of elements as n_handles. If the first and last point are the same, this will be a closed loop spline.

closedbool, optional

Make the spline a closed loop.

interaction_eventvtk.vtkCommand.EventIds, optional

The VTK interaction event to use for triggering the callback.

**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.