Repository navigation
Weld boolean-seam vertices to fix non-manifold STL exports - #164
Conversation
manif 8000 old3d's booleans can leave two vertices that should be identical ~1e-4mm apart instead of exactly coincident. trimesh's default merge_vertices() tolerance is tighter than that gap, so the later nondegenerate_faces() pass drops the resulting sliver triangle without first welding its vertices into their neighbors -- opening a small boundary hole that slicers report as non-manifold geometry. Reproduced on a real customer export (a split part failed Orca's manifold check) and, deterministically without any tool data, on a plain stacking-lip bin at grid_y=6 (252mm) -- below that size the same config exports clean, so this is a precision issue, not a modeling bug. merge_vertices(digits_vertex=3) welds anything within 1um, comfortably below FDM resolution, before the degenerate-face cleanup runs.
There was a problem hiding this comment.
Pull request overview
This PR hardens the STL export pipeline by welding near-duplicate vertices produced by manifold3d boolean seams before removing degenerate faces, preventing tiny boundary holes that slicers flag as non-manifold geometry.
Changes:
- Increased trimesh vertex merge precision to handle ~1e-4 mm seam gaps before
nondegenerate_faces()cleanup. - Added a regression test that deterministically reproduces (and now prevents) the boundary-hole case on a plain stacking-lip bin at
grid_y=6.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| backend/app/services/stl_generator_manifold.py | Widens trimesh vertex welding (merge_vertices(digits_vertex=3)) prior to degenerate-face removal to avoid seam-induced boundary holes. |
| backend/tests/test_mesh_watertightness.py | Adds a watertightness regression test ensuring the exported bin mesh has no boundary edges and is watertight. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Independently re-verified this before opening the PR:
🤖 Verification run with Claude Code. |
There was a problem hiding this comment.
Reproduced the non-manifold export and confirmed the fix. The coordinate-rounding wording can be clarified separately; not blocking.
thanks @1Richter !
Summary
merge_vertices()tolerance is tighter than that gap, so the laternondegenerate_faces()pass drops the resulting sliver triangle without first welding its vertices into their neighbors, opening a small boundary hole that slicers report as non-manifold geometry.digits_vertex=3(1e-3mm) before dropping degenerate faces. That's far below FDM print resolution, so it can't affect print fidelity.grid_y=6— no tool polygons needed, the defect is in the shell/lip geometry itself.Originally reproduced on a real customer export (
grid_x=6, grid_y=9, stacking lip off, real tool cutouts).Test evidence
pytest backend/tests/test_mesh_watertightness.py— 1 passedpytest backend/tests -k "stl or mesh or manifold or split"— 7 passedruff check backend/app/services/stl_generator_manifold.py backend/tests/test_mesh_watertightness.py— cleantest_store_load_errors.pypermission tests,test_tracer_config.pyenv-based tracer selection) are pre-existing onmaintoo — Windowschmodsemantics and a localFAL_KEYenv var, unrelated to this change.