cast_to_unstructured_grid

PolyData.cast_to_unstructured_grid() pyvista.core.pointset.UnstructuredGrid

Get a new representation of this object as a pyvista.UnstructuredGrid.

Returns
pyvista.UnstructuredGrid

Dataset cast into a pyvista.UnstructuredGrid.

Examples

Cast a pyvista.PolyData to a pyvista.UnstructuredGrid.

>>> import pyvista
>>> mesh = pyvista.Sphere()
>>> type(mesh)
<class 'pyvista.core.pointset.PolyData'>
>>> grid = mesh.cast_to_unstructured_grid()
>>> type(grid)
<class 'pyvista.core.pointset.UnstructuredGrid'>