PolyDataFilters.fill_holes(hole_size, inplace=False, progress_bar=False)[source]#

Fill holes in a pyvista.PolyData or vtk.vtkPolyData object.

Holes are identified by locating boundary edges, linking them together into loops, and then triangulating the resulting loops. Note that you can specify an approximate limit to the size of the hole that can be filled.


This method is known to segfault. Use at your own risk.


Specifies the maximum hole size to fill. This is represented as a radius to the bounding circumsphere containing the hole. Note that this is an approximate area; the actual area cannot be computed without first triangulating the hole.

inplacebool, default: False

Return new mesh or overwrite input.

progress_barbool, default: False

Display a progress bar to indicate progress.


Mesh with holes filled if inplace=False.


Create a partial sphere with a hole and then fill it.

>>> import pyvista as pv
>>> sphere_with_hole = pv.Sphere(end_theta=330)
>>> sphere = sphere_with_hole.fill_holes(1000)  
>>> edges = sphere.extract_feature_edges(
...     feature_edges=False, manifold_edges=False
... )  
>>> assert edges.n_cells == 0