Grid.to_hexahedra#
- Grid.to_hexahedra() UnstructuredGrid[source]#
Convert voxels to hexahedra.
Convert this mesh to
UnstructuredGridwithHEXAHEDRONcells. Equivalent tocast_to_unstructured_grid()except the output has hexahedra instead ofVOXELcells.Added in version 0.48.
- Returns:
pyvista.UnstructuredGridMesh with
HEXAHEDRONcells.
- Raises:
ValueErrorIf the input is not 3-dimensional.
Examples#
Download Python source code | Download Jupyter notebook
Convert a 3D ImageData to hexahedra.
>>> import pyvista as pv
>>> image = pv.ImageData(dimensions=(2, 2, 2))
>>> hexes = image.to_hexahedra()
>>> hexes.distinct_cell_types == {pv.CellType.HEXAHEDRON}
True