pyvista.PolyDataFilters.clean#
- PolyDataFilters.clean(
- point_merging: bool = True,
- tolerance=None,
- lines_to_points: bool = True,
- polys_to_lines: bool = True,
- strips_to_polys: bool = True,
- inplace: bool = False,
- absolute: bool = True,
- progress_bar: bool = False,
- **kwargs,
Clean the mesh.
This merges duplicate points, removes unused points, and/or removes degenerate cells.
- Parameters:
- point_mergingbool,
optional Enables point merging.
Trueby default.- tolerance
float,optional Set merging tolerance. When enabled merging is set to absolute distance. If
absoluteisFalse, then the merging tolerance is a fraction of the bounding box length. The aliasmerge_tolis also excepted.- lines_to_pointsbool,
optional Enable or disable the conversion of degenerate lines to points. Enabled by default.
- polys_to_linesbool,
optional Enable or disable the conversion of degenerate polys to lines. Enabled by default.
- strips_to_polysbool,
optional Enable or disable the conversion of degenerate strips to polys.
- inplacebool, default:
False Updates mesh in-place.
- absolutebool,
optional Control if
toleranceis an absolute distance or a fraction.- progress_barbool, default:
False Display a progress bar to indicate progress.
- **kwargs
dict,optional Accepts for
merge_tolto replace thetolerancekeyword argument. This may be deprecated in future.
- point_mergingbool,
- Returns:
pyvista.PolyDataCleaned mesh.
See also
remove_unused_pointsStrictly remove unused points without merging points.
Examples
Create a mesh with a degenerate face and then clean it, removing the degenerate face
>>> import pyvista as pv >>> import numpy as np >>> points = np.array([[0, 0, 0], [0, 1, 0], [1, 0, 0]], dtype=np.float32) >>> faces = np.array([3, 0, 1, 2, 3, 0, 2, 2]) >>> mesh = pv.PolyData(points, faces) >>> mout = mesh.clean() >>> mout.faces array([3, 0, 1, 2])