Plotter.add_mesh_slice_spline#
- Plotter.add_mesh_slice_spline(
- mesh: DataSet | _vtk.vtkAlgorithm,
- *,
- generate_triangles: bool = False,
- factor: float = 1.25,
- n_handles: int = 5,
- resolution: int = 25,
- widget_color: ColorLike | None = None,
- show_ribbon: bool = False,
- ribbon_color: ColorLike | None = 'pink',
- ribbon_opacity: float = 0.5,
- initial_points: MatrixLikeFloat | None = None,
- closed: bool = False,
- interaction_event: InteractionEventType = 'end',
- **kwargs: Any,
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_meshesattribute on the plotter.- Parameters:
- mesh
DataSetor 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 (
Falseby default), the output will be triangles otherwise, the output will be the intersection polygons.- factor
float, optional An inflation factor to expand on the bounds when placing.
- n_handles
int, optional The number of interactive spheres to control the spline’s parametric function.
- resolution
int, optional The number of points to generate on the spline.
- 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'
- show_ribbonbool, optional
If
True, the poly plane used for slicing will also be shown.- ribbon_color
ColorLike, optional Color of the ribbon. Either a string, RGB sequence, or hex color string.
- ribbon_opacity
float, optional Opacity of ribbon. Defaults to 1.0 and must be between
[0, 1].- initial_points
MatrixLikeFloat, 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_event
InteractionEventType, optional The VTK interaction event to use for triggering the callback. Accepts either the strings
'start','end','always'or a 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.
Used In#
Gallery Examples