stl-tools
A small Python library + CLI for the common pre-slice tasks every 3D-print hobbyist hits: checking whether a mesh is manifold (watertight), repairing it if it isn't, adding a flat base so the model sits on the build plate, and normalizing units so the slicer interprets dimensions correctly.
Works on any STL (or any other format trimesh can read). Designed initially to post-process exports from the Ritn3D floor-plan- to-3D-model pipeline before sending them to Cura, PrusaSlicer, Bambu Studio, or Lychee — but the library has no dependency on Ritn3D and is useful for any mesh-prep workflow.
Install
pip install stl-tools
CLI
# Inspect a mesh
stl-tools info mymodel.stl
# Repair a non-manifold mesh in place
stl-tools repair broken.stl -o fixed.stl
# Add a 2mm flat base
stl-tools add-base mymodel.stl -o with_base.stl --thickness 2.0
# Scale from meters to millimeters (Blender default → slicer default)
stl-tools scale meters.stl -o mm.stl --factor 1000.0
Library
from stl_tools import (
load_mesh, save_mesh,
is_manifold, repair_mesh,
add_flat_base, set_scale, bbox_info,
)
mesh = load_mesh("input.stl")
if not is_manifold(mesh):
mesh = repair_mesh(mesh)
# Architectural model: meters → mm, then flat base for the build plate
set_scale(mesh, 1000.0)
mesh = add_flat_base(mesh, thickness_mm=2.0)
print(bbox_info(mesh))
# {'min': (...), 'max': (...), 'size': (...), 'center': (...), 'volume_mm3': ...}
save_mesh(mesh, "ready_to_slice.stl")
What's in scope
| Feature | Status |
|---|---|
| Manifold check | ✓ |
| Standard mesh repair (winding, normals, small holes) | ✓ |
| Flat base addition | ✓ |
| Uniform scale | ✓ |
| Bounding-box reporting | ✓ |
What's out of scope
This library is intentionally small. For heavier operations — mesh decimation, remeshing, support generation, slicing itself — use the right tool for the job:
- trimesh itself (this lib wraps it) for richer mesh ops
- PyMeshLab for advanced repair, remeshing, decimation
- Cura / PrusaSlicer / Bambu Studio for actual slicing and supports
- Blender's 3D-Print toolbox for interactive repair on severely broken meshes
Why this exists
Every hobbyist who exports a 3D model from Blender, SketchUp, an AI tool, or a custom pipeline ends up writing the same five-line trimesh snippet to make the file slicer-ready. We did too — and after the tenth copy-paste, we wrote it down as a library.
If you're using Ritn3D's STL export (Pro+ tier) and want to apply additional post-processing before slicing — different base thickness, different units, extra repair — pip-install this, run two CLI commands, and you're done.
Compatibility
- Python 3.9+
- Tested on Linux, macOS, Windows
- STL is the primary target; OBJ, PLY, GLB also work where trimesh supports them
License
MIT — see LICENSE.
Acknowledgements
Built on top of trimesh, the standard Python mesh library. If you find this useful, star trimesh too — the heavy lifting happens there.
Maintained by
Ritn3D — an AI floor-plan-to-3D-model tool. We needed slicer-ready STL output for the Pro+ tier, wrote this to do it, and open-sourced it for everyone else doing the same thing.
Metadata
Release files for ritn3d-stl-tools 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ritn3d_stl_tools-0.1.0.tar.gz | 8.4 kB | Without provenance | Details for ritn3d_stl_tools-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ritn3d_stl_tools-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ritn3d_stl_tools-0.1.0-py3-none-any.whl |
Total release size: 17.0 kB
Release files / ritn3d_stl_tools-0.1.0.tar.gz
| Download URL | ritn3d_stl_tools-0.1.0.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aeff8a8f241382f5360a24959e1e29733f7b40c77568c474872f78f972cd500a
|
|
BLAKE2b-256 checksum How to use checksums |
1ad04959b22587b6893c62b2d72ca61f87d55db0aad8be195d4b177618977227
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / ritn3d_stl_tools-0.1.0-py3-none-any.whl
| Download URL | ritn3d_stl_tools-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc3c0195a255ed5c07826066138bc204b4f7e13f011a9e170bde3b5c703b413f
|
|
BLAKE2b-256 checksum How to use checksums |
993e1f80f81b6005eb29f910322a50fefd467fd9c4f0c546e377560a8828b9d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for ritn3d-stl-tools 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.