pyvista.DataSetFilters.slice_implicit#

DataSetFilters.slice_implicit(implicit_function, generate_triangles=False, contour=False, progress_bar=False)[source]#

Slice a dataset by a VTK implicit function.

Parameters:
implicit_functionvtk.vtkImplicitFunction

Specify the implicit function to perform the cutting.

generate_trianglesbool, default: False

If this is enabled (False by default), the output will be triangles. Otherwise the output will be the intersection polygons. If the cutting function is not a plane, the output will be 3D polygons, which might be nice to look at but hard to compute with downstream.

contourbool, default: False

If True, apply a contour filter after slicing.

progress_barbool, default: False

Display a progress bar to indicate progress.

Returns:
pyvista.PolyData

Sliced dataset.

Examples

Slice the surface of a sphere.

>>> import pyvista as pv
>>> import vtk
>>> sphere = vtk.vtkSphere()
>>> sphere.SetRadius(10)
>>> mesh = pv.Wavelet()
>>> slice = mesh.slice_implicit(sphere)
>>> slice.plot(show_edges=True, line_width=5)
https://d33wubrfki0l68.cloudfront.net/c71a1bbeec70a4f0165b7b60e08302320a1af8a1/3df39/_images/pyvista-datasetfilters-slice_implicit-1_00_00.png
>>> sphere = vtk.vtkCylinder()
>>> sphere.SetRadius(10)
>>> mesh = pv.Wavelet()
>>> slice = mesh.slice_implicit(sphere)
>>> slice.plot(show_edges=True, line_width=5)
https://d33wubrfki0l68.cloudfront.net/21a7cab51be928ae21793517f2d321cb8b27b49e/9401e/_images/pyvista-datasetfilters-slice_implicit-1_01_00.png