trimesh.exchange.load

trimesh.exchange.load.available_formats() set[str]

Get a list of all available loaders

Returns:

Extensions of all available loaders i.e. {‘stl’, ‘ply’, ‘dxf’}

Return type:

loaders

trimesh.exchange.load.load(file_obj: str | Path | IO | BytesIO | StringIO | BinaryIO | TextIO | dict | None, file_type: str | None = None, resolver: Resolver | Mapping | None = None, force: str | None = None, allow_remote: bool = False, **kwargs) Geometry

THIS FUNCTION IS DEPRECATED but there are no current plans for it to be removed.

For new code the typed load functions trimesh.load_scene or trimesh.load_mesh are recommended over trimesh.load which is a backwards-compatibility wrapper that mimics the behavior of the old function and can return any geometry type.

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

  • allow_remote – If True allow this load call to work on a remote URL.

  • kwargs (dict) – Passed to geometry __init__

Returns:

geometry – Loaded geometry as trimesh classes

Return type:

Trimesh, Path2D, Path3D, Scene

trimesh.exchange.load.load_mesh(*args, **kwargs) Trimesh

Load a 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: str, **kwargs) Scene

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

This is a thin wrapper around:

trimesh.load_scene(file_obj=url, allow_remote=True, **kwargs)

Parameters:
  • url – URL containing mesh file

  • **kwargs – Passed to load_scene

Returns:

loaded – Loaded result

Return type:

Trimesh, Path, Scene

trimesh.exchange.load.load_scene(file_obj: str | Path | IO | BytesIO | StringIO | BinaryIO | TextIO | dict | None, file_type: str | None = None, resolver: Resolver | Mapping | None = None, allow_remote: bool = False, metadata: dict | None = None, **kwargs) Scene

Load geometry into the trimesh.Scene container. This may contain any parent.Geometry object, including Trimesh, Path2D, Path3D, or a PointCloud.

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

  • allow_remote – If True allow this load call to work on a remote URL.

  • kwargs (dict) – Passed to geometry __init__

Returns:

geometry – Loaded geometry as trimesh classes

Return type:

Trimesh, Path2D, Path3D, Scene

trimesh.exchange.load.mesh_formats() set[str]

Get a list of mesh formats available to load.

Returns:

Extensions of available mesh loaders i.e. {‘stl’, ‘ply’}

Return type:

loaders