Prepare STL meshes for 3D printing — manifold repair, flat base, scale normalization, slicer-ready output. By the Ritn3D team.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ritn3d_stl_tools-0.1.0.tar.gz.
File metadata
- Download URL: ritn3d_stl_tools-0.1.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aeff8a8f241382f5360a24959e1e29733f7b40c77568c474872f78f972cd500a
|
|
| MD5 |
1269a0de59f6e2fbd7b32256174ccdf1
|
|
| BLAKE2b-256 |
1ad04959b22587b6893c62b2d72ca61f87d55db0aad8be195d4b177618977227
|
File details
Details for the file ritn3d_stl_tools-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ritn3d_stl_tools-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc3c0195a255ed5c07826066138bc204b4f7e13f011a9e170bde3b5c703b413f
|
|
| MD5 |
a55d33791daebbe177ccd861b5fe5a74
|
|
| BLAKE2b-256 |
993e1f80f81b6005eb29f910322a50fefd467fd9c4f0c546e377560a8828b9d8
|