_PointSetBase.remove_cells

_PointSetBase.remove_cells#

_PointSetBase.remove_cells(
ind: VectorLike[bool] | VectorLike[int],
inplace: bool = False,
) _PointSetBase[source]#

Remove cells.

Parameters:
indVectorLike[int] | VectorLike[bool]

Cell indices to be removed. The array can also be a boolean array of the same size as the number of cells.

inplacebool, default: False

Whether to update the mesh in-place.

Returns:
pyvista.DataSet

Same type as the input, but with the specified cells removed.

Examples#

Download Python source code | Download Jupyter notebook

Remove 20 cells from an unstructured grid.

>>> from pyvista import examples
>>> import pyvista as pv
>>> hex_mesh = pv.read(examples.hexbeamfile)
>>> removed = hex_mesh.remove_cells(range(10, 20))
>>> removed.plot(color='lightblue', show_edges=True, line_width=3)
../../../_images/pyvista-core-pointset-_PointSetBase-remove_cells-56d496ef123aa14d_00_00.png