API Reference

The primary entry point is stl.Mesh, which inherits from BaseStl and BaseMesh.

Enumerations

class stl.Mode(*values)[source]

STL file format mode for loading and saving.

Use AUTOMATIC for auto-detection (default), ASCII to force ASCII format, or BINARY to force binary format.

AUTOMATIC = 0

Automatically detect whether the output is a TTY, if so, write ASCII otherwise write BINARY

ASCII = 1

Force writing ASCII

BINARY = 2

Force writing BINARY

class stl.Dimension(*values)[source]

Named indices for X/Y/Z axes.

X = 0

X index (for example, mesh.v0[0][X])

Y = 1

Y index (for example, mesh.v0[0][Y])

Z = 2

Z index (for example, mesh.v0[0][Z])

class stl.RemoveDuplicates(*values)[source]

Strategy for handling duplicate triangles.

Use with BaseMesh.remove_duplicate_polygons().

NONE = 0
SINGLE = 1
ALL = 2
classmethod map(value)[source]

Convert an int or RemoveDuplicates to RemoveDuplicates.

Parameters:

value (_Dedupe) – Integer or RemoveDuplicates enum value.

Returns:

The corresponding RemoveDuplicates member.

Return type:

RemoveDuplicates

Constants

stl.HEADER_SIZE

Size of the binary STL header in bytes (80).

stl.COUNT_SIZE

Size of the triangle count field in bytes (4).

stl.MAX_COUNT

Maximum number of triangles in a binary STL file (100,000,000).