From 5d0249c1459c98061de1a530c9f0eef37da71e51 Mon Sep 17 00:00:00 2001 From: mgerus Date: Fri, 30 Sep 2022 10:57:43 +0300 Subject: [PATCH] 26920 fix exception call in fillet(wrong choice of face) --- src/ChFi3d/ChFi3d_Builder_C1.cxx | 11 +++++++++-- tests/bugs/modalg_7/bug26920 | 13 +++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/modalg_7/bug26920 diff --git a/src/ChFi3d/ChFi3d_Builder_C1.cxx b/src/ChFi3d/ChFi3d_Builder_C1.cxx index da727d1a35..c03de12f42 100644 --- a/src/ChFi3d/ChFi3d_Builder_C1.cxx +++ b/src/ChFi3d/ChFi3d_Builder_C1.cxx @@ -2708,7 +2708,14 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index) TopoDS_Edge aLocalEdge = edgesau; if (edgesau.Orientation() != orient) aLocalEdge.Reverse(); - C2dint1 = BRep_Tool::CurveOnSurface(aLocalEdge,Face[0],ubid,vbid); + C2dint1 = BRep_Tool::CurveOnSurface(aLocalEdge, Face[0], ubid, vbid); + + if (C2dint1.IsNull()) + { + //std::swap(Face[0], facesau); + C2dint1 = BRep_Tool::CurveOnSurface(aLocalEdge, facesau, ubid, vbid); + + } } } else { @@ -2718,7 +2725,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index) //// for periodic 3d curves //// if (cad.IsPeriodic()) { - gp_Pnt2d P2d = BRep_Tool::Parameters( Vtx, Face[0] ); + gp_Pnt2d P2d = BRep_Tool::Parameters(Vtx, facesau); Geom2dAPI_ProjectPointOnCurve Projector( P2d, C2dint1 ); par = Projector.LowerDistanceParameter(); Standard_Real shift = par-ParVtx; diff --git a/tests/bugs/modalg_7/bug26920 b/tests/bugs/modalg_7/bug26920 new file mode 100644 index 0000000000..cda142a6a4 --- /dev/null +++ b/tests/bugs/modalg_7/bug26920 @@ -0,0 +1,13 @@ +puts "========" +puts "0026920: BRepBuidlerAPI_MakeFillet crash 2" +puts "========" + +restore C:/WORK/opencascade/bugs/CR26920/bug26920.brep b1 +explode b1 e +fillet result b1 0.25 b1_15 + +checkprops result -s 1653.78 +checkshape result + +checknbshapes result -vertex 20 -edge 31 -wire 13 -face 13 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 80 +checkview -display result -2d -path ${imagedir}/${test_image}.png \ No newline at end of file -- 2.39.5