Skip to main content

meshck

Check and repair triangle meshes (STL) before additive manufacturing.

meshck finds holes, flipped triangles and overlapping bodies in STL files and repairs them. Like fsck for file systems, it checks by default and repairs on request. It runs on Linux, macOS and Windows.

Status: early development.

Installation

pip install meshck

or, in a uv project:

uv add meshck

Requires Python 3.11 or newer.

Usage

Check one or more files:

meshck part.stl
part.stl: FAIL
  triangles=327580  shells=1  boundary_edges=54  holes=1  misoriented=4900  ...
  error  closed: mesh is open: 1 hole(s), 54 boundary edges
  error  oriented: 4900 misoriented triangles

Repair and write a fixed copy (part_repaired.stl, or the path given with -o). The input file is never overwritten:

meshck --repair part.stl
part.stl -> part_repaired.stl: PASS
  before: triangles=327580  shells=1  boundary_edges=54  holes=1  misoriented=4900  ...
  after:  triangles=327674  shells=1  boundary_edges=0  holes=0  misoriented=0  ...
  repair: flipped 4900 misoriented triangles
  repair: rebuilt 1 open shell(s) with pymeshfix
  deviation_mm=0.0000

Options:

Option Effect
-r, --repair repair and write a fixed copy
-o OUT, --output OUT where to write the repaired copy (one input file only)
--fill-cavities when repairing, also fill cavities (see below)
--strict treat warnings as errors
--json print results as JSON

Exit codes: 0 all files pass, 1 errors remain, 2 a file could not be read or written.

What is checked

Check Severity
Empty mesh (no triangles) error
Open mesh (holes, boundary edges) error
Edges shared by more than two triangles error
Misoriented triangles (including inverted parts and cavities) error
Triangles crossing other triangles of the same shell error
Overlapping shells, including a solid inside a solid error
Shells touching over an area (they fuse when printed) warning
Closed shells of zero thickness (they do not print) warning
Degenerate (zero-area) triangles warning
Several separate parts warning

Separate parts are only a warning because moving parts printed in one piece are separate by design. Size and volume are reported without a limit.

A closed shell inside another one is a cavity if it points inwards and a solid inside a solid if it points outwards. Crossings less than 1 µm deep are ignored as rounding noise. Shells touching only along an edge or at a point do not count as touching.

What repair does

Each step runs only if the check finds the problem it addresses:

  1. Remove collapsed and duplicate triangles.
  2. Flip misoriented triangles.
  3. Split edges shared by more than two triangles, so touching bodies become separate closed shells.
  4. Rebuild shells that are still open with pymeshfix, one shell at a time, and remove leftovers of zero thickness: stray triangles, flat sheets and fins. If pymeshfix cannot close a shell that has thickness, the shell is kept as it is.
  5. Merge overlapping shells, and shells touching over an area, with a boolean union (manifold3d).
  6. With --fill-cavities only: remove every shell enclosed by another one, so that cavities become solid.

deviation_mm is the largest distance the original surface moved. Filled holes, filled cavities and inner walls removed by a merge are not counted, deleted shells are.

Separate parts are kept, and so are cavities unless --fill-cavities is given. meshck does not rebuild the whole outer surface and does not repair self-intersecting shells. If the steps above are not enough, the mesh has to be fixed by hand.

Python API

from pathlib import Path

from meshck.check import check_mesh, load_mesh
from meshck.repair import repair

mesh = load_mesh(Path("part.stl"))
result = repair(mesh.vertices, mesh.faces)
print(result.steps, result.deviation)
print(check_mesh(result.vertices, result.faces, Path("part.stl")).to_text())

Scope

meshck checks whether a mesh is a valid solid. It does not check design rules such as wall thickness, build volume or clearances.

License

MIT, see LICENSE.

Metadata

Release files for meshck 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meshck 0.1.0
File Size Uploaded Provenance Actions
meshck-0.1.0.tar.gz 58.1 kB With provenance Details for meshck-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for meshck 0.1.0
File Interpreter ABI Platform Actions
meshck-0.1.0-py3-none-any.whl Python 3 none any Details for meshck-0.1.0-py3-none-any.whl

Total release size: 80.8 kB

Release files / meshck-0.1.0.tar.gz

Download URL meshck-0.1.0.tar.gz
Size 58.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b1f838b30e9896cb212964ded73ba85a892cf06198fc8111bf44638d682a49ac
BLAKE2b-256 checksum
How to use checksums
70d94e5975cfb1a8a6a0b2cdd51301ed8f3b10f031b62ac4e0c240dc7c1b750d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / meshck-0.1.0-py3-none-any.whl

Download URL meshck-0.1.0-py3-none-any.whl
Size 22.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cde31d6e4e286339c4213dfc3ff3abed07865b986978f893e81c9be5088d762a
BLAKE2b-256 checksum
How to use checksums
bc7bebccc4f9cc7343b91a302781b356069f0e124c3f5b320c513ff61c7ac191
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for meshck 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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for meshck-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page