Files
OrcaSlicer/deps/OCCT/0001-BRepMesh-seam-pcurve-selection.patch
Rodrigo Faselli cdd695117f Fix cone seam pcurve selection in OCCT (#17720)
Since the OCCT 8.0.1 update, some STEP files imported with cone faces missing. OCCT told the two seam pcurves of a cone apart with a 1e-7 threshold, which fails when the neighboring pcurves end slightly past the seam. The OCCT patch now picks the closer pcurve. The #16290 fix is kept.

Also stops admesh from merging unrelated edges of open meshes from STEP and SVG import on ARM64. A mesh built in memory reaches the nearby check with a tolerance of 0, and dividing by it was undefined. The check now returns early, which is what x86-64 already did.
2026-11-20 16:05:58 -06:00

26 lines
1.4 KiB
Diff

diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_ModelPreProcessor.cxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_ModelPreProcessor.cxx
index 6f63781..97a20d3 100644
--- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_ModelPreProcessor.cxx
+++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_ModelPreProcessor.cxx
@@ -223,10 +223,16 @@ private:
return false;
}
- // Select the correct pcurve of the seam-edge.
- const gp_Pnt2d& aFPntOfPC1 = aPC1->Value(aPC1->FirstParameter());
-
- if (std::abs(aLPntOfIPC1.X() - aFPntOfPC1.X()) > Precision::Confusion())
+ // Select the correct pcurve of the seam-edge: the one closer to the discrete pcurve.
+ // Both pcurves of a seam share the edge's range, so evaluate them at its start. A
+ // Geom2d_Line's FirstParameter() is -Precision::Infinite(), where a direction of (2e-16, -1)
+ // from rounding error gives an X far outside the U range. A Precision::Confusion() threshold
+ // fails too, because BRepMesh_ModelHealer has already moved the ends of the discrete pcurve
+ // onto those of the neighbouring edges, whose pcurves can end slightly past the seam.
+ const gp_Pnt2d aFPntOfPC1 = aPC1->Value(af);
+ const gp_Pnt2d aFPntOfPC2 = aPC2->Value(af);
+
+ if (std::abs(aLPntOfIPC1.X() - aFPntOfPC1.X()) > std::abs(aLPntOfIPC1.X() - aFPntOfPC2.X()))
{
std::swap(aPC1, aPC2);
}