DataSetFilters.extract_points#
- DataSetFilters.extract_points(
- ind: int | VectorLike[int] | VectorLike[bool],
- adjacent_cells: bool = True,
- include_cells: bool | None = None,
- pass_cell_ids: bool = True,
- pass_point_ids: bool = True,
- progress_bar: bool = False,
- *,
- invert: bool = False,
Return a subset of the grid (with cells) that contains any of the given point indices.
The output is an
UnstructuredGrid. Useremove_points()withinvert=Trueandmode='all'to extract the same points and their cells while keeping the input type:Changed in version 0.49: Negative and out-of-range indices raise
IndexError.- Parameters:
- ind
int|VectorLike[int] |VectorLike[bool] Point indices to extract. Can be a single
intor a vector ofints. Aboolvector is also supported; the vector size should match the number of points.- adjacent_cellsbool, default:
True If
True, extract the cells that contain at least one of the extracted points. IfFalse, extract the cells that contain exclusively points from the extracted points list. Has no effect ifinclude_cellsisFalse.- include_cellsbool, default:
None Specifies if the cells shall be returned or not. By default, this value is
Trueif the input has at least one cell andFalseotherwise, soPointSetinput returns the selected points.- pass_point_idsbool, default:
True Add a point array
'vtkOriginalPointIds'that identifies the original points the extracted points correspond to.Added in version 0.47.
- pass_cell_idsbool, default:
True Add a cell array
'vtkOriginalCellIds'that identifies the original cells the extracted cells correspond to.Added in version 0.47.
- progress_barbool, default:
False Display a progress bar to indicate progress.
- invertbool, default:
False Invert the selection.
Added in version 0.49.
- ind
- Returns:
pyvista.UnstructuredGrid|pyvista.PointSetSubselected points. A
PointSetinput returns aPointSet.
Examples#
Download Python source code | Download Jupyter notebook
Extract all the points of a sphere with a Z coordinate greater than 0
>>> import pyvista as pv
>>> sphere = pv.Sphere()
>>> extracted = sphere.extract_points(
... sphere.points[:, 2] > 0, include_cells=False
... )
>>> extracted.clear_data() # clear for plotting
>>> extracted.plot()
See Also#
Used In#
Docstring Examples
Gallery Examples