pyvista.from_trimesh

Contents

pyvista.from_trimesh#

from_trimesh(mesh: trimesh.Trimesh, *, pass_data: _PassDataOptions = True) PolyData[source]#

Convert a Trimesh mesh to a PyVista mesh.

  • vertex_attributes are stored as point data.

  • face_attributes are stored as cell data.

  • metadata is stored as field data: NumPy arrays are stored directly as field data arrays, and any other metadata (e.g. strings or lists) is stored in the user_dict.

Note

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

Added in version 0.47.

Parameters:
meshtrimesh.Trimesh

Trimesh object to convert.

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

Pass point, cell, and/or field data from 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.