ThinSkin analyses an STL mesh and identifies regions where the local geometry is thinner than a specified diameter threshold — handy for checking 3D-print wall thickness, minimum feature sizes, and structurally fragile areas before manufacturing.
For every vertex in the mesh, ThinSkin estimates the local inscribed diameter using two complementary approaches and takes the minimum of the two as the effective local diameter:
- Ray-cast thickness — casts a ray inward along the inverted vertex normal and measures the distance to the nearest opposing surface.
- Local curvature radius — derived from the mean curvature at each vertex via the cotangent-weighted Laplacian.
Vertices whose effective diameter falls below the threshold are flagged as narrow.
pip install thinskinThinSkin uses trimesh for ray casting, which relies
on rtree (bundled libspatialindex). If
you hit native-library issues, install via conda/mamba:
micromamba install -c conda-forge rtree
pip install thinskingit clone https://github.com/SemiQuant/ThinSkin.git
cd ThinSkin
pip install -e ".[dev]"thinskin model.stl --diameter 2.0Options:
| Option | Alias | Default | Description |
|---|---|---|---|
--diameter |
-d |
2.0 |
Minimum diameter threshold (mm). |
--output |
-o |
<input>_narrow.stl |
Output STL path. |
--version |
-V |
Print version and exit. | |
--help |
-h |
Show help and exit. |
You can also run it as a module:
python -m thinskin model.stl -d 1.5For an input model.stl, ThinSkin writes (when narrow regions are found):
| File | Description |
|---|---|
model_narrow.stl |
Mesh containing only the flagged (narrow) faces — overlay in MeshLab. |
model_narrow_coloured.obj |
Full mesh with per-vertex colours (red = narrow, green = OK). |
model_narrow_annotated_views.png |
CAD-style 2×2 multi-view annotated report. |
The console also prints mesh stats, a results summary, and a diameter distribution histogram as tables.
import thinskin
mesh = thinskin.load_mesh("model.stl")
eff_diam, thickness, curv_radius = thinskin.compute_effective_diameter(mesh)
threshold = 2.0
narrow = eff_diam < threshold
print(f"{int(narrow.sum())} narrow vertices below {threshold} mm")
# Render the annotated report
thinskin.generate_annotated_report(mesh, eff_diam, threshold, "model_narrow.stl")- Python ≥ 3.9
click,numpy,scipy,trimesh,rtree,matplotlib
MIT © SemiQuant (Jason Limberis)