From fcfc4713a68b100e6f15e94f213e2f65d6710ad9 Mon Sep 17 00:00:00 2001 From: emv Date: Mon, 24 Jun 2019 11:41:30 +0300 Subject: [PATCH] 0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts BRepFill_TrimShellCorner::MakeFacesSec() - When replacing a bound edge with a section wire make sure that edges in a wire are oriented correctly. Test cases for the issue. --- src/BRepFill/BRepFill_TrimShellCorner.cxx | 28 +++++++++++++++-------- src/BRepFill/BRepFill_TrimShellCorner.hxx | 3 ++- tests/bugs/modalg_7/bug30794_1 | 19 +++++++++++++++ tests/bugs/modalg_7/bug30794_2 | 23 +++++++++++++++++++ tests/bugs/modalg_7/bug30794_3 | 19 +++++++++++++++ tests/bugs/modalg_7/bug30794_4 | 22 ++++++++++++++++++ tests/bugs/modalg_7/bug30794_5 | 18 +++++++++++++++ 7 files changed, 121 insertions(+), 11 deletions(-) create mode 100644 tests/bugs/modalg_7/bug30794_1 create mode 100644 tests/bugs/modalg_7/bug30794_2 create mode 100644 tests/bugs/modalg_7/bug30794_3 create mode 100644 tests/bugs/modalg_7/bug30794_4 create mode 100644 tests/bugs/modalg_7/bug30794_5 diff --git a/src/BRepFill/BRepFill_TrimShellCorner.cxx b/src/BRepFill/BRepFill_TrimShellCorner.cxx index eca1216813..799c7adbb4 100644 --- a/src/BRepFill/BRepFill_TrimShellCorner.cxx +++ b/src/BRepFill/BRepFill_TrimShellCorner.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -175,6 +176,7 @@ static void RemoveEdges(const TopoDS_Compound& theSourceComp, static Standard_Boolean FilterSectionEdges(const BOPDS_VectorOfCurve& theBCurves, const TopoDS_Face& theSecPlane, const BOPDS_PDS& theDS, + const Handle (IntTools_Context)& theContext, TopoDS_Compound& theResult); static Standard_Boolean GetUEdges(const Standard_Integer theIndex, @@ -345,7 +347,7 @@ void BRepFill_TrimShellCorner::Perform() } } else { - if(!MakeFacesSec(ii, theDS, anIndex1, anIndex2, i)) { + if(!MakeFacesSec(ii, theDS, aPF.Context(), anIndex1, anIndex2, i)) { myHistMap.Clear(); return; } @@ -658,6 +660,7 @@ BRepFill_TrimShellCorner::MakeFacesNonSec(const Standard_Integer Standard_Boolean BRepFill_TrimShellCorner::MakeFacesSec(const Standard_Integer theIndex, const BOPDS_PDS& theDS, + const Handle (IntTools_Context)& theContext, const Standard_Integer theFaceIndex1, const Standard_Integer theFaceIndex2, const Standard_Integer theSSInterfIndex) @@ -669,7 +672,7 @@ BRepFill_TrimShellCorner::MakeFacesSec(const Standard_Integer TopoDS_Compound aSecEdges; TopoDS_Face aSecPlane; - if(!FilterSectionEdges(aBCurves, aSecPlane, theDS, aSecEdges)) + if(!FilterSectionEdges(aBCurves, aSecPlane, theDS, theContext, aSecEdges)) return Standard_False; //Extract vertices on the intersection of correspondent U-edges @@ -787,11 +790,18 @@ BRepFill_TrimShellCorner::MakeFacesSec(const Standard_Integer aBB.MakeWire(aW); TopTools_ListIteratorOfListOfShape aEIt(aListOfWireEdges); - for(; aEIt.More(); aEIt.Next()) { - if(!aBoundEdge.IsSame(aEIt.Value())) - aBB.Add(aW, aEIt.Value()); + TopoDS_Edge aFBE = TopoDS::Edge (aBoundEdge.Oriented (TopAbs_FORWARD)); + for (; aEIt.More(); aEIt.Next()) + { + if (!aBoundEdge.IsSame(aEIt.Value())) + { + TopoDS_Edge aSplit = TopoDS::Edge (aEIt.Value()); + if (BOPTools_AlgoTools::IsSplitToReverse (aSplit, aFBE, theContext)) + aSplit.Reverse(); + aBB.Add (aW, aSplit); + } } - aSubstitutor->Replace(aBoundEdge.Oriented(TopAbs_FORWARD), aW); + aSubstitutor->Replace (aFBE, aW); } aSubstitutor->Apply(aFace); @@ -2154,6 +2164,7 @@ void RemoveEdges(const TopoDS_Compound& theSourceComp, Standard_Boolean FilterSectionEdges(const BOPDS_VectorOfCurve& theBCurves, const TopoDS_Face& theSecPlane, const BOPDS_PDS& theDS, + const Handle (IntTools_Context)& theContext, TopoDS_Compound& theResult) { theResult.Nullify(); @@ -2181,10 +2192,7 @@ Standard_Boolean FilterSectionEdges(const BOPDS_VectorOfCurve& theBCurves, Standard_Real f = 0., l = 0.; BRep_Tool::Range(anEdge, f, l); anIntersector.SetBeanParameters(f, l); - // - Handle(IntTools_Context) aContext = new IntTools_Context; - anIntersector.SetContext(aContext); - // + anIntersector.SetContext(theContext); anIntersector.Perform(); if(anIntersector.IsDone()) { diff --git a/src/BRepFill/BRepFill_TrimShellCorner.hxx b/src/BRepFill/BRepFill_TrimShellCorner.hxx index df78dfef0b..e13438f2d8 100644 --- a/src/BRepFill/BRepFill_TrimShellCorner.hxx +++ b/src/BRepFill/BRepFill_TrimShellCorner.hxx @@ -35,7 +35,7 @@ class gp_Ax2; class TopoDS_Face; class TopoDS_Wire; class TopoDS_Shape; - +class IntTools_Context; //! Trims sets of faces in the corner to make proper parts of pipe class BRepFill_TrimShellCorner @@ -80,6 +80,7 @@ private: Standard_Boolean MakeFacesSec(const Standard_Integer theIndex, const BOPDS_PDS& theDS, + const Handle (IntTools_Context)& theContext, const Standard_Integer theFaceIndex1, const Standard_Integer theFaceIndex2, const Standard_Integer theSSInterfIndex); diff --git a/tests/bugs/modalg_7/bug30794_1 b/tests/bugs/modalg_7/bug30794_1 new file mode 100644 index 0000000000..b252470f76 --- /dev/null +++ b/tests/bugs/modalg_7/bug30794_1 @@ -0,0 +1,19 @@ +puts "========" +puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts" +puts "========" +puts "" + +restore [locate_data_file bug30794_shapes1.brep] c +explode c + +unifysamedom spine c_1 +mksweep spine +addsweep c_2 +buildsweep result -C -S + +checkshape result + +checkprops result -s 1.24302e+06 -v 5.64101e+06 +checknbshapes result -wire 14 -face 14 -shell 1 -solid 1 -t + +checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_7/bug30794_2 b/tests/bugs/modalg_7/bug30794_2 new file mode 100644 index 0000000000..149483e739 --- /dev/null +++ b/tests/bugs/modalg_7/bug30794_2 @@ -0,0 +1,23 @@ +puts "TODO OCC30794 ALL: Faulty shapes in variables" +puts "TODO OCC30794 ALL: Error : The area of result shape is" +puts "TODO OCC30794 ALL: Error : The volume of result shape is" +puts "TODO OCC30794 ALL: Error : is WRONG because number of" + +puts "========" +puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts" +puts "========" +puts "" + +restore [locate_data_file bug30794_shapes1.brep] c +explode c + +mksweep c_1 +addsweep c_2 +buildsweep result -C -S + +checkshape result + +checkprops result -s 1.24302e+06 -v 5.64101e+06 +checknbshapes result -wire 14 -face 14 -shell 1 -solid 1 -t + +checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_7/bug30794_3 b/tests/bugs/modalg_7/bug30794_3 new file mode 100644 index 0000000000..b5993dec75 --- /dev/null +++ b/tests/bugs/modalg_7/bug30794_3 @@ -0,0 +1,19 @@ +puts "========" +puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts" +puts "========" +puts "" + +restore [locate_data_file bug30794_shapes2.brep] c +explode c + +unifysamedom spine c_1 +mksweep spine +addsweep c_2 +buildsweep result -C -S + +checkshape result + +checkprops result -s 883273 -v 1.09918e+07 +checknbshapes result -wire 6 -face 6 -shell 1 -solid 1 -t + +checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_7/bug30794_4 b/tests/bugs/modalg_7/bug30794_4 new file mode 100644 index 0000000000..ffadcfb16a --- /dev/null +++ b/tests/bugs/modalg_7/bug30794_4 @@ -0,0 +1,22 @@ +puts "TODO OCC30794 ALL: Faulty shapes in variables" +puts "TODO OCC30794 ALL: Error : The volume of result shape is" +puts "TODO OCC30794 ALL: Error : is WRONG because number of" + +puts "========" +puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts" +puts "========" +puts "" + +restore [locate_data_file bug30794_shapes2.brep] c +explode c + +mksweep c_1 +addsweep c_2 +buildsweep result -C -S + +checkshape result + +checkprops result -s 883273 -v 1.09918e+07 +checknbshapes result -wire 6 -face 6 -shell 1 -solid 1 -t + +checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_7/bug30794_5 b/tests/bugs/modalg_7/bug30794_5 new file mode 100644 index 0000000000..8af9139d7a --- /dev/null +++ b/tests/bugs/modalg_7/bug30794_5 @@ -0,0 +1,18 @@ +puts "========" +puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts" +puts "========" +puts "" + +binrestore [locate_data_file bug30794_shapes.bin] c +explode c + +mksweep c_1 +addsweep c_2 +buildsweep result -C -S + +checkshape result + +checkprops result -s 1.44508e+06 -v 1.78664e+07 +checknbshapes result -wire 7 -face 7 -shell 1 -solid 1 -t + +checkview -display result -2d -path ${imagedir}/${test_image}.png -- 2.39.5