ExplicitStructuredGrid.cast_to_unstructured_grid() UnstructuredGrid[source]#

Cast to an unstructured grid.


An unstructured grid. VTK adds the 'BLOCK_I', 'BLOCK_J' and 'BLOCK_K' cell arrays. These arrays are required to restore the explicit structured grid.

See also


Extract a subset of a dataset.


Cast an unstructured grid to an explicit structured grid.


The ghost cell array is disabled before casting the unstructured grid in order to allow the original structure and attributes data of the explicit structured grid to be restored. If you don’t need to restore the explicit structured grid later or want to extract an unstructured grid from the visible subgrid, use the extract_cells filter and the cell indices where the ghost cell array is 0.


>>> from pyvista import examples
>>> grid = examples.load_explicit_structured()
>>> grid.plot(color='w', show_edges=True, show_bounds=True)
>>> grid = grid.hide_cells(range(80, 120))
>>> grid.plot(color='w', show_edges=True, show_bounds=True)
>>> grid = grid.cast_to_unstructured_grid()
>>> grid.plot(color='w', show_edges=True, show_bounds=True)
>>> grid = grid.cast_to_explicit_structured_grid()
>>> grid.plot(color='w', show_edges=True, show_bounds=True)