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, **kwargs)

Load an STL file from a file object.

Parameters:

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

Returns:

loaded – kwargs for a Trimesh constructor with keys: vertices: (n,3) float, vertices faces: (m,3) int, indexes of vertices face_normals: (m,3) float, normal vector of each face

Return type:

dict

trimesh.exchange.stl.load_stl_ascii(file_obj)

Load an ASCII STL file from a file object.

Parameters:

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

Returns:

loaded – kwargs for a Trimesh constructor with keys: vertices: (n, 3) float, vertices faces: (m, 3) int, indexes of vertices face_normals: (m, 3) float, normal vector of each face

Return type:

dict

trimesh.exchange.stl.load_stl_binary(file_obj)

Load a binary STL file from a file object.

Parameters:

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

Returns:

loaded – vertices: (n,3) float, vertices faces: (m,3) int, indexes of vertices face_normals: (m,3) float, normal vector of each face

Return type:

kwargs for a Trimesh constructor with keys: