Weld boolean-seam vertices to fix non-manifold STL exports - #1
Closed
1Richter wants to merge 1 commit into
Closed
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.
🟡 Not ready to approve
The new test file has an import ordering issue that is likely to fail Ruff/isort linting.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR addresses occasional non-manifold STL exports caused by tiny vertex gaps left along manifold3d boolean seams by increasing the vertex-merge tolerance during trimesh conversion, and adds a regression test to ensure the resulting meshes remain watertight.
Changes:
- Increase trimesh vertex weld/merge precision (
digits_vertex=3) in_manifold_to_trimeshto close boolean seam micro-gaps before dropping degenerate faces. - Add a regression test that generates a specific stacking-lip bin configuration and asserts the resulting mesh has zero boundary edges and is watertight.
File summaries
| File | Description |
|---|---|
| backend/app/services/stl_generator_manifold.py | Adjusts trimesh vertex merging during manifold→trimesh conversion to prevent boundary holes caused by seam sliver triangles being removed. |
| backend/tests/test_mesh_watertightness.py | Adds a regression test to catch boundary holes/non-watertight meshes for a previously failing bin configuration. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
| import numpy as np | ||
|
|
||
| from app.models.schemas import GenerateRequest | ||
| from app.services.stl_generator_manifold import ManifoldSTLGenerator, _manifold_to_trimesh |
Owner
Author
|
Superseded — opened upstream as tracefinity#164. |
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.
Draft PR opened for review. Branch:
fix/mesh-vertex-merge-tolerance.