Skip to content

Mesh - Fix cone faces left untriangulated when the seam pcurve is tilted - #1605

Open
raistlin7447 wants to merge 2 commits into
Open-Cascade-SAS:IRfrom
raistlin7447:fix/brepmesh-seam-pcurve-tilted
Open

raistlin7447 wants to merge 2 commits into
Open-Cascade-SAS:IRfrom
raistlin7447:fix/brepmesh-seam-pcurve-tilted

Conversation

@raistlin7447

@raistlin7447 raistlin7447 commented Oct 8, 2026 •

Copy link
Copy Markdown

Pre-Submission Checks

  • I checked existing issues, pull requests, discussions, and forum topics for related work.
  • I followed the contribution guidance in .github/CONTRIBUTING.md.
  • I used a PR title in the Group - Summary format.

Problem / Motivation

Fixes #572.

Since 7.7.0, BRepMesh can leave a conical face with no triangles. The status is IMeshData_Failure. STEP files that hit this lose the face when they are meshed, so applications show a hole in the model. The face in #572 (Sfacciata.step) is one example. Another is Spray Can 218x153 5.step from prusa3d/PrusaSlicer#12122, where one chamfer is missing. Both files mesh correctly with 7.6.

In these files, the seam pcurves are infinite Geom2d_Lines with a direction of about (2e-16, -1) instead of exactly (0, -1). Before the face is triangulated, SeamEdgeAmplifier::splitEdge in BRepMesh_ModelPreProcessor.cxx adds points to the seam edge. To match each seam pcurve to its side of the face, it evaluates the first one at FirstParameter(). For an infinite line that parameter is -2e100, so the evaluated X is about -3e84 instead of a value inside the U range. The check then always swaps the pcurves. The new seam points end up on the wrong side, so the discretized wire crosses itself and the face is not meshed.

Proposed Solution

Evaluate the pcurve at the edge's first parameter, which BRep_Tool::CurveOnSurface already returns. For a seam line that is exactly vertical, or for a bounded pcurve, both evaluations give the same X. So the result only changes where the old evaluation was wrong.

The swap check was added in 0032767 (7.7.0).

Validation

Checks performed:

  • Relevant tests were added or updated when applicable.

  • Relevant local tests were run.

  • New GTest BRepMesh_IncrementalMeshTest.ConeWithTiltedSeamPCurves_IsTriangulated builds a conical band with seam pcurve directions of (0, -1), (2e-16, -1) and (-2e-16, -1). It checks that each one is meshed without errors and gets the same number of triangles. Without the fix, the tilted ones fail with IMeshData_Failure and no triangles.

  • Ran the BRepMesh_* GTests locally.

  • With 8.0.1 plus this change, both files above mesh the same as with 7.6. The Spray Can gets 79698 triangles and a closed mesh, and Sfacciata.step gets 15856 triangles. On the cone faces, the mesh is within 0.003 mm of the surface, the same as with 7.6.

CLA Confirmation

  • I confirm that I have read the contribution requirements, and that I have signed and submitted the CLA or I am covered by an approved company CLA.

CLA ID / submission reference: Submitted 2026-10-08, pending

Review Notes

OrcaSlicer is adding this change as a patch on top of 8.0.1 (OrcaSlicer/OrcaSlicer#16290) until an OCCT release includes it.

SeamEdgeAmplifier::splitEdge matched the two seam pcurves by evaluating
one of them at FirstParameter(). For an infinite Geom2d_Line that is
-2e100, so a direction of (2e-16, -1) from rounding error gave an X far
outside the U range and the pcurves were always swapped. Evaluate at the
edge's first parameter instead.
@raistlin7447
raistlin7447 force-pushed the fix/brepmesh-seam-pcurve-tilted branch from f095c19 to 660d4ed Compare October 8, 2026 16:34
@raistlin7447
raistlin7447 marked this pull request as ready for review October 8, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant