trimesh.exchange.misc module

trimesh.exchange.misc.load_dict(data, **kwargs)

Load multiple input types into kwargs for a Trimesh constructor. Tries to extract keys: ‘faces’ ‘vertices’ ‘face_normals’ ‘vertex_normals’

Parameters:
  • data (dict)

  • forms (accepts multiple) –

    -dict: has keys for vertices and faces as (n,3) numpy arrays -dict: has keys for vertices/faces (n,3) arrays encoded as dicts/base64

    with trimesh.util.array_to_encoded/trimesh.util.encoded_to_array

    -str: json blob as dict with either straight array or base64 values -file object: json blob of dict

  • file_type (not used)

Returns:

loaded – -vertices: (n,3) float -faces: (n,3) int -face_normals: (n,3) float (optional)

Return type:

dict with keys

trimesh.exchange.misc.load_meshio(file_obj, file_type=None, **kwargs)

Load a meshio-supported file into the kwargs for a Trimesh constructor.

Parameters:
  • file_obj (file object) – Contains a meshio file

  • file_type (str) – File extension, aka ‘vtk’

Returns:

loaded – kwargs for Trimesh constructor

Return type:

dict