trimesh.exchange.export module

trimesh.exchange.export.export_dict(mesh, encoding=None)

Export a mesh to a dict

Parameters:
  • mesh (trimesh.Trimesh) – Mesh to be exported

  • encoding (str or None) – Such as ‘base64’

Returns:

export – Data stored in dict

Return type:

dict

trimesh.exchange.export.export_dict64(mesh)

Export a mesh as a dictionary, with data encoded to base64.

trimesh.exchange.export.export_mesh(mesh, file_obj, file_type=None, resolver=None, **kwargs)

Export a Trimesh object to a file- like object, or to a filename

Parameters:
  • file_obj (str, file-like) – Where should mesh be exported to

  • file_type (str or None) – Represents file type (eg: ‘stl’)

  • resolver (None or trimesh.resolvers.Resolver) – Resolver to write referenced assets to

Returns:

exported – Result of exporter

Return type:

bytes or str

trimesh.exchange.export.export_scene(scene, file_obj, file_type=None, resolver=None, **kwargs)

Export a snapshot of the current scene.

Parameters:
  • file_obj (str, file-like, or None) – File object to export to

  • file_type (str or None) – What encoding to use for meshes IE: dict, dict64, stl

Returns:

export – Only returned if file_obj is None

Return type:

bytes

trimesh.exchange.export.scene_to_dict(scene, use_base64=False, include_metadata=True)

Export a Scene object as a dict.

Parameters:

scene (trimesh.Scene) – Scene object to be exported

Returns:

as_dict – Scene as a dict

Return type:

dict