Grid.to_hexahedra

Grid.to_hexahedra#

Grid.to_hexahedra() UnstructuredGrid[source]#

Convert voxels to hexahedra.

Convert this mesh to UnstructuredGrid with HEXAHEDRON cells. Equivalent to cast_to_unstructured_grid() except the output has hexahedra instead of VOXEL cells.

Added in version 0.48.

Returns:
pyvista.UnstructuredGrid

Mesh with HEXAHEDRON cells.

Raises:
ValueError

If 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

See Also#

to_quads
pyvista.ImageData.to_tetrahedra
pyvista.RectilinearGrid.to_tetrahedra
pyvista.DataSet.cast_to_unstructured_grid