Skip to content

Weld boolean-seam vertices to fix non-manifold STL exports - #1

Closed
1Richter wants to merge 1 commit into
mainfrom
fix/mesh-vertex-merge-tolerance
Closed

Weld boolean-seam vertices to fix non-manifold STL exports#1
1Richter wants to merge 1 commit into
mainfrom
fix/mesh-vertex-merge-tolerance

Conversation

@1Richter

@1Richter 1Richter commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Draft PR opened for review. Branch: fix/mesh-vertex-merge-tolerance.

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.
@1Richter
1Richter marked this pull request as ready for review August 3, 2026 17:39
Copilot AI review requested due to automatic review settings August 3, 2026 17:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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_trimesh to 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
@1Richter

1Richter commented Aug 3, 2026

Copy link
Copy Markdown
Owner Author

Superseded — opened upstream as tracefinity#164.

@1Richter 1Richter closed this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants