trimesh.exchange.load

trimesh.exchange.load.available_formats() set

Get a list of all available loaders

Returns:

loaders – Extensions of available loaders i.e. ‘stl’, ‘ply’, ‘dxf’, etc.

Return type:

list

trimesh.exchange.load.load(file_obj: str | Path | IO | BytesIO | StringIO | BinaryIO | TextIO | dict | None, file_type: str | None = None, resolver: Resolver | dict | None = None, force: str | None = None, **kwargs) Geometry | list[Geometry]

Load a mesh or vectorized path into objects like Trimesh, Path2D, Path3D, Scene

Parameters:
  • file_obj (str, or file- like object) – The source of the data to be loadeded

  • file_type (str) – What kind of file type do we have (eg: ‘stl’)

  • resolver (trimesh.visual.Resolver) – Object to load referenced assets like materials and textures

  • force (None or str) – For ‘mesh’: try to coerce scenes into a single mesh For ‘scene’: try to coerce everything into a scene

  • kwargs (dict) – Passed to geometry __init__

Returns:

geometry – Loaded geometry as trimesh classes

Return type:

Trimesh, Path2D, Path3D, Scene

trimesh.exchange.load.load_compressed(file_obj, file_type=None, resolver=None, mixed=False, **kwargs)

Given a compressed archive load all the geometry that we can from it.

Parameters:
  • file_obj (open file-like object) – Containing compressed data

  • file_type (str) – Type of the archive file

  • mixed (bool) – If False, for archives containing both 2D and 3D data will only load the 3D data into the Scene.

Returns:

scene – Geometry loaded in to a Scene object

Return type:

trimesh.Scene

trimesh.exchange.load.load_kwargs(*args, **kwargs) Geometry

Load geometry from a properly formatted dict or kwargs

trimesh.exchange.load.load_mesh(file_obj: str | Path | IO | BytesIO | StringIO | BinaryIO | TextIO | dict | None, file_type: str | None = None, resolver: Resolver | dict | None = None, **kwargs) Geometry | list[Geometry]

Load a mesh file into a Trimesh object.

Parameters:
  • file_obj (str or file object) – File name or file with mesh data

  • file_type (str or None) – Which file type, e.g. ‘stl’

  • kwargs (dict) – Passed to Trimesh constructor

Returns:

Loaded geometry data.

Return type:

mesh

trimesh.exchange.load.load_remote(url, **kwargs)

Load a mesh at a remote URL into a local trimesh object.

This must be called explicitly rather than automatically from trimesh.load to ensure users don’t accidentally make network requests.

Parameters:
  • url (string) – URL containing mesh file

  • **kwargs (passed to load)

Returns:

loaded – Loaded result

Return type:

Trimesh, Path, Scene

trimesh.exchange.load.mesh_formats() set

Get a list of mesh formats available to load.

Returns:

loaders – Extensions of available mesh loaders, i.e. ‘stl’, ‘ply’, etc.

Return type:

list