Weld boolean-seam vertices to fix non-manifold STL exports - #164
Open
1Richter wants to merge 1 commit into
Open
Conversation
manifold3d'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.
Contributor
Author
|
Independently re-verified this before opening the PR:
🤖 Verification run with Claude Code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.