pyvista.DataSet.cast_to_unstructured_grid#

DataSet.cast_to_unstructured_grid() UnstructuredGrid[source]#

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 as pv
>>> mesh = pv.Sphere()
>>> type(mesh)
<class 'pyvista.core.pointset.PolyData'>
>>> grid = mesh.cast_to_unstructured_grid()
>>> type(grid)
<class 'pyvista.core.pointset.UnstructuredGrid'>