DataSetFilters.clip_surface(surface, invert=True, value=0.0, compute_distance=False, progress_bar=False, crinkle=False)[source]#

Clip any mesh type using a pyvista.PolyData surface mesh.

This will return a pyvista.UnstructuredGrid of the clipped mesh. Geometry of the input dataset will be preserved where possible. Geometries near the clip intersection will be triangulated/tessellated.


The PolyData surface mesh to use as a clipping function. If this input mesh is not a :class`pyvista.PolyData`, the external surface will be extracted.

invertbool, optional

Flag on whether to flip/invert the clip.

valuefloat, optional

Set the clipping value of the implicit function (if clipping with implicit function) or scalar value (if clipping with scalars). The default value is 0.0.

compute_distancebool, optional

Compute the implicit distance from the mesh onto the input dataset. A new array called 'implicit_distance' will be added to the output clipped mesh.

progress_barbool, optional

Display a progress bar to indicate progress.

crinklebool, optional

Crinkle the clip by extracting the entire cells along the clip. This adds the "cell_ids" array to the cell_data attribute that tracks the original cell IDs of the original dataset.


Clipped surface.


Clip a cube with a sphere.

>>> import pyvista
>>> sphere = pyvista.Sphere(center=(-0.4, -0.4, -0.4))
>>> cube = pyvista.Cube().triangulate().subdivide(3)
>>> clipped = cube.clip_surface(sphere)
>>> clipped.plot(show_edges=True, cpos='xy', line_width=3)

See Clipping with a Surface for more examples using this filter.