Skip to main content

Identify and annotate thin (narrow) regions in STL meshes.

Project description

ThinSkin

PyPI version Python versions License: MIT

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.

How it works

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:

  1. Ray-cast thickness — casts a ray inward along the inverted vertex normal and measures the distance to the nearest opposing surface.
  2. 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.

Installation

pip install thinskin

ThinSkin 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 thinskin

From source

git clone https://github.com/SemiQuant/ThinSkin.git
cd ThinSkin
pip install -e ".[dev]"

Usage

Command line

thinskin model.stl --diameter 2.0

Options:

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.5

Outputs

For 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.

Python API

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")

Requirements

  • Python ≥ 3.9
  • click, numpy, scipy, trimesh, rtree, matplotlib

License

MIT © SemiQuant (Jason Limberis)

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

thinskin-0.1.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

thinskin-0.1.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file thinskin-0.1.0.tar.gz.

File metadata

  • Download URL: thinskin-0.1.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for thinskin-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2737679b4e1b8c1840603962ae6939accb8be10f2a9b2dc1a90c4b3a4a675480
MD5 bba62674c52028a11dd5861e58d5eb62
BLAKE2b-256 17278fe79a0515719c84a6258311eb37bf82d2127bbb0133eb3bd1d6123beb29

See more details on using hashes here.

Provenance

The following attestation bundles were made for thinskin-0.1.0.tar.gz:

Publisher: publish.yml on SemiQuant/ThinSkin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thinskin-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: thinskin-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for thinskin-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04be2b88196a53c036c4cd97d60f5002f7796a2c21d625fe4637df8033526d35
MD5 502ba5bca305bbd303bb94393f1aa935
BLAKE2b-256 41e20e7fa3d5d1a6656ff1dd3516f833d5874b1431b4096496b2047d4c1accd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for thinskin-0.1.0-py3-none-any.whl:

Publisher: publish.yml on SemiQuant/ThinSkin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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