slice

StructuredGrid.slice(normal='x', origin=None, generate_triangles=False, contour=False, progress_bar=False)

Slice a dataset by a plane at the specified origin and normal vector orientation.

If no origin is specified, the center of the input dataset will be used.

Parameters
normaltuple(float) or str

Length 3 tuple for the normal vector direction. Can also be specified as a string conventional direction such as 'x' for (1, 0, 0) or '-x' for (-1, 0, 0), etc.

origintuple(float)

The center (x, y, z) coordinate of the plane on which the slice occurs.

generate_trianglesbool, optional

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

contourbool, optional

If True, apply a contour filter after slicing.

progress_barbool, optional

Display a progress bar to indicate progress.

Returns
pyvista.PolyData

Sliced dataset.

Examples

Slice the surface of a sphere.

>>> import pyvista
>>> sphere = pyvista.Sphere()
>>> slice_x = sphere.slice(normal='x')
>>> slice_y = sphere.slice(normal='y')
>>> slice_z = sphere.slice(normal='z')
>>> slices = slice_x + slice_y + slice_z
>>> slices.plot(line_width=5)
../../../_images/pyvista-StructuredGrid-slice-1_00_00.png

See Slicing for more examples using this filter.