PolyDataFilters.remove_points#
- PolyDataFilters.remove_points(
- remove: VectorLikeBool | VectorLikeInt | None = None,
- mode: Literal['any', 'all'] = 'any',
- *,
- keep_scalars: bool | None = None,
- inplace: bool = False,
- ind: int | VectorLikeInt | VectorLikeBool | None = None,
- invert: bool | None = None,
- pass_point_ids: bool | None = None,
- pass_cell_ids: bool | None = None,
- progress_bar: bool | None = None,
Rebuild a mesh by removing points.
Deprecated since version 0.49: Returning a
(mesh, ids)tuple is deprecated and only the mesh will be returned in a future version. Until then this filter returns one or the other depending on how it is called:The points passed positionally or as
removereturn the tuple, and warn. Only all-triangle meshes are supported.The points named
ind, or any ofinvert,pass_point_ids,pass_cell_idsandprogress_bar, return only the mesh frompyvista.DataSetFilters.remove_points(), for any mesh. The ids that were the second return value are the'vtkOriginalPointIds'array, andclear_data()replaceskeep_scalars.
- Parameters:
- remove
VectorLikeBool|VectorLikeInt, optional If remove is a
boolarray, points that areTruewill be removed. Otherwise, it is treated as a list of indices. Only valid for all-triangle meshes.- mode
str, default: “any” When
'all', only faces containing all points flagged for removal will be removed.- keep_scalarsbool, optional
When
True, point and cell scalars will be passed on to the new mesh. Defaults toTrueand cannot be used when only the mesh is returned.- inplacebool, default:
False Updates mesh in-place.
- ind
int|VectorLikeInt|VectorLikeBool, optional Point indices to remove, the same as
remove. Passing this returns only the mesh. Seepyvista.DataSetFilters.remove_points().- invertbool, default:
False Invert the selection. Passing this returns only the mesh.
- pass_point_idsbool, default:
True Add the
'vtkOriginalPointIds'point array. Passing this returns only the mesh.- pass_cell_idsbool, default:
True Add the
'vtkOriginalCellIds'cell array. Passing this returns only the mesh.- progress_barbool, default:
False Display a progress bar to indicate progress. Passing this returns only the mesh.
- remove
- Returns:
pyvista.PolyData|tuple[pyvista.PolyData,numpy.ndarray]Mesh without the points flagged for removal, and the indices of its points relative to the original mesh. The indices are returned with the mesh as a deprecated
(mesh, ids)tuple unless one ofind,invert,pass_point_ids,pass_cell_idsorprogress_baris passed, in which case only the mesh is returned.
Examples#
Download Python source code | Download Jupyter notebook
Remove 150 points from a sphere.
>>> import pyvista as pv
>>> sphere = pv.Sphere()
>>> reduced_sphere = sphere.remove_points(ind=range(100, 250))
>>> reduced_sphere.plot(show_edges=True, line_width=3)
Used In#
API Examples
DataSetFilters.remove_points(2 uses)