UnstructuredGrid.extract_surface(pass_pointid=True, pass_cellid=True, nonlinear_subdivision=1, progress_bar=False)

Extract surface mesh of the grid.

pass_pointidbool, optional

Adds a point array “vtkOriginalPointIds” that idenfities which original points these surface points correspond to.

pass_cellidbool, optional

Adds a cell array “vtkOriginalPointIds” that idenfities which original cells these surface cells correspond to.

nonlinear_subdivisionint, optional

If the input is an unstructured grid with nonlinear faces, this parameter determines how many times the face is subdivided into linear faces.

If 0, the output is the equivalent of its linear counterpart (and the midpoints determining the nonlinear interpolation are discarded). If 1 (the default), the nonlinear face is triangulated based on the midpoints. If greater than 1, the triangulated pieces are recursively subdivided to reach the desired subdivision. Setting the value to greater than 1 may cause some point data to not be passed even if no nonlinear faces exist. This option has no effect if the input is not an unstructured grid.

progress_barbool, optional

Display a progress bar to indicate progress.


Surface mesh of the grid.


Extract the surface of an UnstructuredGrid.

>>> import pyvista
>>> from pyvista import examples
>>> grid = examples.load_hexbeam()
>>> surf = grid.extract_surface()
>>> type(surf)
<class 'pyvista.core.pointset.PolyData'>

See the Extract Surface for more examples using this filter.