split_bodies

UniformGridFilters.split_bodies(label=False, progress_bar=False)

Find, label, and split connected bodies/volumes.

This splits different connected bodies into blocks in a pyvista.MultiBlock dataset.

Parameters
labelbool, optional

A flag on whether to keep the ID arrays given by the connectivity filter.

progress_barbool, optional

Display a progress bar to indicate progress.

Returns
pyvista.MultiBlock

MultiBlock with a split bodies.

Examples

Split a uniform grid thresholded to be non-connected.

>>> from pyvista import examples
>>> dataset = examples.load_uniform()
>>> dataset.set_active_scalars('Spatial Cell Data')
>>> threshed = dataset.threshold_percent([0.15, 0.50], invert=True)
>>> bodies = threshed.split_bodies()
>>> len(bodies)
2

See Splitting Volumes for more examples using this filter.