trimesh.exchange.stl

exception trimesh.exchange.stl.HeaderError

Bases: Exception

trimesh.exchange.stl.export_stl(mesh) bytes

Convert a Trimesh object into a binary STL file.

Parameters:

mesh – Trimesh object to export.

Returns:

Represents mesh in binary STL form

Return type:

export

trimesh.exchange.stl.export_stl_ascii(mesh) str

Convert a Trimesh object into an ASCII STL file.

Parameters:

mesh (trimesh.Trimesh)

Returns:

Mesh represented as an ASCII STL file

Return type:

export

trimesh.exchange.stl.load_stl(file_obj: IO | BytesIO | StringIO | BinaryIO | TextIO | BufferedRandom, **kwargs) dict

Load a binary or an ASCII STL file from a file object.

Parameters:

file_obj – Containing STL data

Returns:

Keyword arguments for a Trimesh constructor with data loaded into properly shaped numpy arrays.

Return type:

loaded

trimesh.exchange.stl.load_stl_ascii(file_obj: IO | BytesIO | StringIO | BinaryIO | TextIO | BufferedRandom) dict

Load an ASCII STL file from a file object.

Parameters:

file_obj (open file- like object) – Containing input data

Returns:

Keyword arguments for a Trimesh constructor with data loaded into properly shaped numpy arrays.

Return type:

loaded

trimesh.exchange.stl.load_stl_binary(file_obj: IO | BytesIO | StringIO | BinaryIO | TextIO | BufferedRandom) dict

Load a binary STL file from a file object.

Parameters:

file_obj (open file- like object) – Containing STL data

Returns:

Keyword arguments for a Trimesh constructor with data loaded into properly shaped numpy arrays.

Return type:

loaded