extract_cells

UnstructuredGrid.extract_cells(ind, progress_bar=False)

Return a subset of the grid.

Parameters
indnp.ndarray

Numpy array of cell indices to be extracted.

progress_barbool, optional

Display a progress bar to indicate progress.

Returns
pyvista.UnstructuredGrid

Subselected grid.

Examples

>>> import pyvista
>>> from pyvista import examples
>>> grid = pyvista.read(examples.hexbeamfile)
>>> subset = grid.extract_cells(range(20))
>>> subset.n_cells
20
>>> pl = pyvista.Plotter()
>>> actor = pl.add_mesh(grid, style='wireframe', line_width=5, color='black')
>>> actor = pl.add_mesh(subset, color='grey')
>>> pl.show()
../../../_images/pyvista-UnstructuredGrid-extract_cells-1_00_00.png