pyvista.DataSetFilters.shrink#

DataSetFilters.shrink(shrink_factor=1.0, progress_bar=False)[source]#

Shrink the individual faces of a mesh.

This filter shrinks the individual faces of a mesh rather than scaling the entire mesh.

Parameters:
shrink_factorfloat, default: 1.0

Fraction of shrink for each cell. Default does not modify the faces.

progress_barbool, default: False

Display a progress bar to indicate progress.

Returns:
pyvista.DataSet

Dataset with shrunk faces. Return type matches input.

Examples

First, plot the original cube.

>>> import pyvista as pv
>>> mesh = pv.Cube()
>>> mesh.plot(show_edges=True, line_width=5)
https://d33wubrfki0l68.cloudfront.net/64b7237d984578cfbdba92c4248d3d156d25dfb2/baa4c/_images/pyvista-datasetfilters-shrink-1_00_00.png

Now, plot the mesh with shrunk faces.

>>> shrunk = mesh.shrink(0.5)
>>> shrunk.clear_data()  # cleans up plot
>>> shrunk.plot(show_edges=True, line_width=5)
https://d33wubrfki0l68.cloudfront.net/af2309a55091474c894c9633d958ce605ae9aa70/cf473/_images/pyvista-datasetfilters-shrink-1_01_00.png