Skip to main content

STL preparation toolkit for resin 3D printing: uniform scaling, bed packing, fill, autopack.

Project description

stlbench

PyPI version Python versions License: MIT

STL preparation toolkit for resin 3D printing.

stlbench takes STL files and prepares them for SLA/DLP printers: uniform scaling to fit the build volume, packing parts onto rectangular print plates, filling the bed with copies, and combined scale-and-pack in one step. Supports are not generated -- use your slicer (Lychee, Chitubox, PrusaSlicer, etc.) after export.

Installation

pip install stlbench

For hollow shell support (optional, requires scipy):

pip install "stlbench[hollow]"

Development install

git clone https://github.com/NikitaDmitryuk/stlbench.git
cd stlbench
poetry install --with dev

Quick Start

# Inspect model parts
stlbench info -i ./parts -c configs/mars5_ultra.toml

# Scale all parts to fit the printer
stlbench scale -i ./parts -o ./scaled -c configs/mars5_ultra.toml

# Pack scaled parts onto plates
stlbench layout -i ./scaled -o ./plates -c configs/mars5_ultra.toml

# Scale + pack all on one plate in one step
stlbench autopack -i ./parts -o ./packed -c configs/mars5_ultra.toml

# Fill the bed with copies of a single part
stlbench fill -i ./part.stl -o ./filled -c configs/mars5_ultra.toml

Or specify the printer inline without a config file:

stlbench scale -i ./parts -o ./scaled -p "153.36,77.76,165"

Commands

info -- Analyze models (read-only)

stlbench info -i ./parts -c configs/mars5_ultra.toml

Displays a table with AABB dimensions, volume, vertex/face counts, whether each part fits the bed, maximum scale factor, and how many copies would fit (fill). No files are written.

scale -- Uniform scaling

stlbench scale -i ./parts -o ./out -c configs/mars5_ultra.toml

Computes a single scale factor so that every part fits inside the printer build volume. The largest part determines the factor; all parts share the same scale. Supports two methods: sorted (default) and conservative.

Key options: --dry-run, --no-upscale, --method, --orientation free, --hollow, --supports-scale.

layout -- Pack parts onto plates

stlbench layout -i ./scaled -o ./plates -c configs/mars5_ultra.toml

Arranges already-scaled STL files onto rectangular print plates using rectpack. Exports plate_01.stl + plate_01.json with positions. Multiple plates are created if parts do not fit on one.

Key options: --dry-run, --gap-mm, --algorithm shelf|rectpack.

autopack -- Scale + layout on one plate

stlbench autopack -i ./parts -o ./packed -c configs/mars5_ultra.toml

Binary-searches for the maximum scale factor at which all parts fit onto a single plate simultaneously. Combines scale and layout into one step with a different goal: all parts on one plate, not each part fitting individually.

Key options: --dry-run, --gap-mm, --margin, --supports-scale.

fill -- Maximum copies of one part

stlbench fill -i ./part.stl -o ./filled -c configs/mars5_ultra.toml

Packs as many copies of a single STL file as possible onto one plate. Useful for batch printing identical parts.

Key options: --scale (scale the part to fit before filling), --dry-run, --gap-mm.

hollow / supports

  • stlbench hollow -- reminder to configure [hollow] in the TOML config and use --hollow with scale.
  • stlbench supports -- reminder that supports are added in the slicer.

Configuration

Printer profiles are TOML files. See configs/mars5_ultra.toml for a complete example (ELEGOO Mars 5 Ultra).

Key sections:

Section Purpose
[printer] Build volume: width_mm, depth_mm, height_mm
[scaling] bed_margin, supports_scale
[orientation] mode (axis/free), samples, seed
[packing] algorithm (rectpack/shelf), gap_mm, report
[hollow] enabled, wall_thickness_mm, voxel_mm

Examples

See examples/README.md for a full walkthrough using the included Gendalf model (3 parts tracked via Git LFS).

Package Structure

Module Purpose
stlbench.cli Typer CLI application
stlbench.core Scale factor computation and orientation
stlbench.config Pydantic schema + TOML loader
stlbench.packing Shelf and rectpack algorithms
stlbench.export Plate STL assembly and JSON manifest
stlbench.hollow Voxel shell hollowing (optional, scipy)
stlbench.pipeline Command runners (scale, layout, fill, etc.)

Limitations

  • Boolean and voxel operations are sensitive to non-manifold STL. For complex models use a mesh repair tool first.
  • Hollow shells in this package are a simplified voxel approach; for production use your slicer's built-in hollowing.
  • Supports are not generated -- always add them in your slicer.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stlbench-0.2.0.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stlbench-0.2.0-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file stlbench-0.2.0.tar.gz.

File metadata

  • Download URL: stlbench-0.2.0.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for stlbench-0.2.0.tar.gz
Algorithm Hash digest
SHA256 52f4a3b32410c5775bbe09e4cca44d256de06f7ff3021e22ee0316fa2537eb69
MD5 98e28086644dcebe7fad100504c561a6
BLAKE2b-256 ffc4d225bf6a8313bf65a402ccc4a089bd65aa3fd6d35367746e841ba8925c1e

See more details on using hashes here.

File details

Details for the file stlbench-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: stlbench-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 34.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for stlbench-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c40c9202b358ac17b4117c945ee8f9a898863c42433204805e9320a3075ffe69
MD5 d97e255c9af270949667755e766d86d1
BLAKE2b-256 27cf86804915c9a31dee9ff549463b73e2d515bae55c97cf365f6568cdfa0636

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page