pyvista.to_trimesh

Contents

pyvista.to_trimesh#

to_trimesh(
mesh: DataSet,
*,
triangulate: bool = False,
pass_data: _PassDataOptions = True,
) trimesh.Trimesh[source]#

Convert a PyVista mesh to a Trimesh mesh.

  • Point data is stored as vertex_attributes.

  • Cell data is stored as face_attributes.

  • Field data is stored as metadata. Any user_dict keys are stored directly as metadata.

Note

No copies of point, cell, or data arrays are made. Use copy() before converting to avoid any side effects.

Added in version 0.47.

Parameters:
meshDataSet

Dataset to convert.

triangulatebool, default: False

Triangulate the mesh before conversion. If the mesh has 3D cells, the mesh’s surface is extracted. All 2D polygonal cells are triangulated as required, and all 0D and 1D cells or any unused points are ignored.

pass_databool | str | sequence[str], default: True

Pass point, cell, and/or field data to the Trimesh object. All data is passed by default. Set this to 'point', 'cell', 'field' or any combination thereof to only pass specific fields.

Examples

See Wrapping Other Objects for examples.