fill_holes

PolyDataFilters.fill_holes(hole_size, inplace=False, progress_bar=False)

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.

Warning

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

Parameters
hole_sizefloat

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, optional

Return new mesh or overwrite input.

progress_barbool, optional

Display a progress bar to indicate progress.

Returns
pyvista.PolyData

Mesh with holes filled if inplace=False.

Examples

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