From b008226203ed49193c60aed10c2846944d77bf9c Mon Sep 17 00:00:00 2001 From: jgv Date: Fri, 20 Sep 2019 13:52:10 +0300 Subject: [PATCH] 0031023: Fillet regression in OCCT 7.4 from 7.3 Modify local static function ReorderFaces to be able to process multiple-faces-connecting vertices. --- src/ChFi3d/ChFi3d_Builder_1.cxx | 56 ++++++++++++++++++++++----------- tests/bugs/modalg_7/bug31023 | 22 +++++++++++++ 2 files changed, 59 insertions(+), 19 deletions(-) create mode 100644 tests/bugs/modalg_7/bug31023 diff --git a/src/ChFi3d/ChFi3d_Builder_1.cxx b/src/ChFi3d/ChFi3d_Builder_1.cxx index 45c19ee18f..a1b00c5132 100644 --- a/src/ChFi3d/ChFi3d_Builder_1.cxx +++ b/src/ChFi3d/ChFi3d_Builder_1.cxx @@ -89,7 +89,8 @@ static void ReorderFaces(TopoDS_Face& theF1, TopoDS_Face& theF2, const TopoDS_Face& theFirstFace, const TopoDS_Edge& thePrevEdge, - const TopoDS_Vertex& theCommonVertex) + const TopoDS_Vertex& theCommonVertex, + const ChFiDS_Map& theEFmap) { if (theF1.IsSame(theFirstFace)) return; @@ -99,25 +100,42 @@ static void ReorderFaces(TopoDS_Face& theF1, return; } - TopTools_IndexedDataMapOfShapeListOfShape VEmapFirst, VEmap; - TopExp::MapShapesAndAncestors(theFirstFace, TopAbs_VERTEX, TopAbs_EDGE, VEmapFirst); - TopExp::MapShapesAndAncestors(theF1, TopAbs_VERTEX, TopAbs_EDGE, VEmap); - - const TopTools_ListOfShape& ElistFirst = VEmapFirst.FindFromKey(theCommonVertex); - const TopTools_ListOfShape& Elist = VEmap.FindFromKey(theCommonVertex); - TopTools_ListIteratorOfListOfShape itlfirst(ElistFirst); - for (; itlfirst.More(); itlfirst.Next()) + //Loop until find or + Standard_Boolean ToExchange = Standard_False; + TopoDS_Edge PrevEdge = thePrevEdge, CurEdge; + TopoDS_Face PrevFace = theFirstFace, CurFace; + for (;;) { - const TopoDS_Shape& anEdge = itlfirst.Value(); - if (anEdge.IsSame(thePrevEdge)) - continue; - TopTools_ListIteratorOfListOfShape itl(Elist); - for(; itl.More(); itl.Next()) - if (anEdge.IsSame(itl.Value())) - return; + TopTools_IndexedDataMapOfShapeListOfShape VEmap; + TopExp::MapShapesAndAncestors(PrevFace, TopAbs_VERTEX, TopAbs_EDGE, VEmap); + const TopTools_ListOfShape& Elist = VEmap.FindFromKey(theCommonVertex); + if (PrevEdge.IsSame(Elist.First())) + CurEdge = TopoDS::Edge(Elist.Last()); + else + CurEdge = TopoDS::Edge(Elist.First()); + + const TopTools_ListOfShape& Flist = theEFmap.FindFromKey(CurEdge); + if (PrevFace.IsSame(Flist.First())) + CurFace = TopoDS::Face(Flist.Last()); + else + CurFace = TopoDS::Face(Flist.First()); + + if (CurFace.IsSame(theF1)) + break; + else if (CurFace.IsSame(theF2)) + { + ToExchange = Standard_True; + break; + } + + PrevEdge = CurEdge; + PrevFace = CurFace; } - TopoDS_Face TmpFace = theF1; theF1 = theF2; theF2 = TmpFace; + if (ToExchange) + { + TopoDS_Face TmpFace = theF1; theF1 = theF2; theF2 = TmpFace; + } } static void ConcatCurves(TColGeom_SequenceOfCurve& theCurves, @@ -944,7 +962,7 @@ Standard_Boolean ChFi3d_Builder::PerformElement(const Handle(ChFiDS_Spine)& Spin Spine->SetEdges(Ec); TopoDS_Face CurF1, CurF2; ChFi3d_conexfaces(Ec,CurF1,CurF2,myEFMap); - ReorderFaces(CurF1, CurF2, FirstFace, PrevEdge, CommonVertex); + ReorderFaces(CurF1, CurF2, FirstFace, PrevEdge, CommonVertex, myEFMap); myEdgeFirstFace.Bind(Ec, CurF1); if (Offset > 0) { @@ -1030,7 +1048,7 @@ Standard_Boolean ChFi3d_Builder::PerformElement(const Handle(ChFiDS_Spine)& Spin Spine->PutInFirst(Ec); TopoDS_Face CurF1, CurF2; ChFi3d_conexfaces(Ec,CurF1,CurF2,myEFMap); - ReorderFaces(CurF1, CurF2, FirstFace, PrevEdge, CommonVertex); + ReorderFaces(CurF1, CurF2, FirstFace, PrevEdge, CommonVertex, myEFMap); myEdgeFirstFace.Bind(Ec, CurF1); if (Offset > 0) { diff --git a/tests/bugs/modalg_7/bug31023 b/tests/bugs/modalg_7/bug31023 new file mode 100644 index 0000000000..d03a6f3db0 --- /dev/null +++ b/tests/bugs/modalg_7/bug31023 @@ -0,0 +1,22 @@ +puts "==================================================================" +puts "OCC31023: Fillet regression in OCCT 7.4 from 7.3" +puts "==================================================================" +puts "" + +brestore [locate_data_file bug31023.brep] a + +explode a e + +blend result a 0.1 a_25 0.1 a_26 + +checkshape result + +checknbshapes result -face 26 -wire 26 -edge 60 -vertex 34 + +set tolres [checkmaxtol result] + +if { ${tolres} > 0.0001} { + puts "Error: bad tolerance of result" +} + +checkprops result -v 27.1174