connectivity

UnstructuredGrid.connectivity(largest=False, progress_bar=False)

Find and label connected bodies/volumes.

This adds an ID array to the point and cell data to distinguish separate connected bodies. This applies a vtkConnectivityFilter filter which extracts cells that share common points and/or meet other connectivity criterion.

Cells that share vertices and meet other connectivity criterion such as scalar range are known as a region.

Parameters
largestbool

Extract the largest connected part of the mesh.

progress_barbool, optional

Display a progress bar to indicate progress.

Returns
pyvista.DataSet

Dataset with labeled connected bodies. Return type matches input.

Examples

Join two meshes together and plot their connectivity.

>>> import pyvista
>>> mesh = pyvista.Sphere() + pyvista.Sphere(center=(2, 0, 0))
>>> conn = mesh.connectivity(largest=False)
>>> conn.plot(cmap=['red', 'blue'])
../../../_images/pyvista-UnstructuredGrid-connectivity-1_00_00.png

See Volumetric Analysis for more examples using this filter.