From: akaftasev Date: Tue, 24 Aug 2021 19:47:18 +0000 (+0300) Subject: 0028684: BRepOffsetAPI_MakeOffset produces wire with another orientation in compare... X-Git-Tag: V7_6_0_beta~54 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=55b5d19bd8d1a1803be5d53055d03db50e5af64d;p=occt.git 0028684: BRepOffsetAPI_MakeOffset produces wire with another orientation in compare with source wire Added flag to reverse resulting shape, if it was reverse in BuildDomains() to bringing to the same direction as the original shape --- diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx index df157f5b05..9c25655175 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx @@ -138,7 +138,8 @@ static void BuildDomains(TopoDS_Face& myFace, BRepFill_ListOfOffsetWire& myAlgos, GeomAbs_JoinType myJoin, Standard_Boolean myIsOpenResult, - Standard_Boolean isPositive) + Standard_Boolean isPositive, + Standard_Boolean& isWasReversed) { BRepAlgo_FaceRestrictor FR; TopoDS_Vertex VF,VL; @@ -164,6 +165,7 @@ static void BuildDomains(TopoDS_Face& myFace, const TopoDS_Shape& W = itl.Value(); LWires.Append(W.Reversed()); } + isWasReversed = Standard_True; WorkWires = LWires; } } @@ -296,13 +298,13 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset, BRep_Builder B; B.MakeCompound (Res); myLastIsLeft = (Offset <= 0); - + Standard_Boolean isWasReversed = Standard_False; if( Offset <= 0. ) { if( myLeft.IsEmpty() ) { // Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 Begin - BuildDomains(myFace,myWires,myLeft,myJoin,myIsOpenResult, Standard_False); + BuildDomains(myFace,myWires,myLeft,myJoin,myIsOpenResult, Standard_False, isWasReversed); // Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 End } @@ -312,9 +314,9 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset, Algo.Perform(Abs(Offset),Alt); if (Algo.IsDone() && !Algo.Shape().IsNull()) { - B.Add(Res,Algo.Shape()); + B.Add(Res,isWasReversed ? Algo.Shape().Reversed() : Algo.Shape()); if (i == 1) - myShape = Algo.Shape(); + myShape = isWasReversed ? Algo.Shape().Reversed() : Algo.Shape(); i++; } @@ -325,7 +327,7 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset, if (myRight.IsEmpty()) { // Modified by Sergey KHROMOV - Fri Apr 27 14:35:28 2001 Begin - BuildDomains(myFace,myWires,myRight,myJoin,myIsOpenResult, Standard_True); + BuildDomains(myFace,myWires,myRight,myJoin,myIsOpenResult, Standard_True, isWasReversed); // Modified by Sergey KHROMOV - Fri Apr 27 14:35:35 2001 End } @@ -336,10 +338,10 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset, if (Algo.IsDone() && !Algo.Shape().IsNull()) { - B.Add(Res,Algo.Shape()); + B.Add(Res, isWasReversed ? Algo.Shape().Reversed() : Algo.Shape()); if (i == 1) - myShape = Algo.Shape(); + myShape = isWasReversed ? Algo.Shape().Reversed() : Algo.Shape(); i++; } diff --git a/tests/bugs/modalg_5/bug25298_02 b/tests/bugs/modalg_5/bug25298_02 index 21e1d1ea3c..940fb1d529 100755 --- a/tests/bugs/modalg_5/bug25298_02 +++ b/tests/bugs/modalg_5/bug25298_02 @@ -12,11 +12,15 @@ smallview display a fit +vori a + if [catch { openoffset resoffset a 1 10 i } ] { puts "Error : mkoffset is wrong" } else { renamevar resoffset_1 result +vori result + checkprops result -l 159.96 checkshape result checksection result diff --git a/tests/bugs/modalg_5/bug25334_1 b/tests/bugs/modalg_5/bug25334_1 index ff86ea6e8c..550317e322 100644 --- a/tests/bugs/modalg_5/bug25334_1 +++ b/tests/bugs/modalg_5/bug25334_1 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 613.39 diff --git a/tests/bugs/modalg_5/bug25334_10 b/tests/bugs/modalg_5/bug25334_10 index 671cf6aa07..8e7a28d18c 100644 --- a/tests/bugs/modalg_5/bug25334_10 +++ b/tests/bugs/modalg_5/bug25334_10 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 548.106 diff --git a/tests/bugs/modalg_5/bug25334_11 b/tests/bugs/modalg_5/bug25334_11 index cc96e58864..dc4e389521 100644 --- a/tests/bugs/modalg_5/bug25334_11 +++ b/tests/bugs/modalg_5/bug25334_11 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 846.702 diff --git a/tests/bugs/modalg_5/bug25334_12 b/tests/bugs/modalg_5/bug25334_12 index f937639a02..7600b09ad3 100644 --- a/tests/bugs/modalg_5/bug25334_12 +++ b/tests/bugs/modalg_5/bug25334_12 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 -10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 768.339 diff --git a/tests/bugs/modalg_5/bug25334_13 b/tests/bugs/modalg_5/bug25334_13 index e5ad24cb9b..c360ed8cf3 100644 --- a/tests/bugs/modalg_5/bug25334_13 +++ b/tests/bugs/modalg_5/bug25334_13 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 1216.59 diff --git a/tests/bugs/modalg_5/bug25334_14 b/tests/bugs/modalg_5/bug25334_14 index 11f3f4bc4d..fbeadb0c32 100644 --- a/tests/bugs/modalg_5/bug25334_14 +++ b/tests/bugs/modalg_5/bug25334_14 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 -10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 1132.6 diff --git a/tests/bugs/modalg_5/bug25334_15 b/tests/bugs/modalg_5/bug25334_15 index 9ba0113c8a..4f0b30b835 100644 --- a/tests/bugs/modalg_5/bug25334_15 +++ b/tests/bugs/modalg_5/bug25334_15 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 1042.35 diff --git a/tests/bugs/modalg_5/bug25334_16 b/tests/bugs/modalg_5/bug25334_16 index f628bd32e4..723324a7d1 100644 --- a/tests/bugs/modalg_5/bug25334_16 +++ b/tests/bugs/modalg_5/bug25334_16 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 -10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 937.174 diff --git a/tests/bugs/modalg_5/bug25334_17 b/tests/bugs/modalg_5/bug25334_17 index 758ed1dd44..7baad788dd 100644 --- a/tests/bugs/modalg_5/bug25334_17 +++ b/tests/bugs/modalg_5/bug25334_17 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 1211.6 diff --git a/tests/bugs/modalg_5/bug25334_18 b/tests/bugs/modalg_5/bug25334_18 index d6f6a92b83..89b12722ff 100644 --- a/tests/bugs/modalg_5/bug25334_18 +++ b/tests/bugs/modalg_5/bug25334_18 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 -10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 1143.61 diff --git a/tests/bugs/modalg_5/bug25334_19 b/tests/bugs/modalg_5/bug25334_19 index eb427c1928..93daf0877b 100644 --- a/tests/bugs/modalg_5/bug25334_19 +++ b/tests/bugs/modalg_5/bug25334_19 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 752.799 diff --git a/tests/bugs/modalg_5/bug25334_2 b/tests/bugs/modalg_5/bug25334_2 index a210f56469..3f16c789c7 100644 --- a/tests/bugs/modalg_5/bug25334_2 +++ b/tests/bugs/modalg_5/bug25334_2 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 -10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 644.509 diff --git a/tests/bugs/modalg_5/bug25334_20 b/tests/bugs/modalg_5/bug25334_20 index 4159c399da..0cdeb5d8e9 100644 --- a/tests/bugs/modalg_5/bug25334_20 +++ b/tests/bugs/modalg_5/bug25334_20 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 -10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 705.994 diff --git a/tests/bugs/modalg_5/bug25334_3 b/tests/bugs/modalg_5/bug25334_3 index 5291afb78a..8659654ede 100644 --- a/tests/bugs/modalg_5/bug25334_3 +++ b/tests/bugs/modalg_5/bug25334_3 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 -10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 354.958 diff --git a/tests/bugs/modalg_5/bug25334_4 b/tests/bugs/modalg_5/bug25334_4 index 4e16e92a05..d22bb01edc 100644 --- a/tests/bugs/modalg_5/bug25334_4 +++ b/tests/bugs/modalg_5/bug25334_4 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 386.077 diff --git a/tests/bugs/modalg_5/bug25334_5 b/tests/bugs/modalg_5/bug25334_5 index e4f8abca54..836760ba88 100644 --- a/tests/bugs/modalg_5/bug25334_5 +++ b/tests/bugs/modalg_5/bug25334_5 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 840.157 diff --git a/tests/bugs/modalg_5/bug25334_6 b/tests/bugs/modalg_5/bug25334_6 index a7fd08bd6e..a51e4e57a3 100644 --- a/tests/bugs/modalg_5/bug25334_6 +++ b/tests/bugs/modalg_5/bug25334_6 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 -10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 782.224 diff --git a/tests/bugs/modalg_5/bug25334_7 b/tests/bugs/modalg_5/bug25334_7 index bfb115366a..2b9af4c80f 100644 --- a/tests/bugs/modalg_5/bug25334_7 +++ b/tests/bugs/modalg_5/bug25334_7 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 559.65 diff --git a/tests/bugs/modalg_5/bug25334_8 b/tests/bugs/modalg_5/bug25334_8 index fed53f80d9..48d9a00a5d 100644 --- a/tests/bugs/modalg_5/bug25334_8 +++ b/tests/bugs/modalg_5/bug25334_8 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 -10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 533.593 diff --git a/tests/bugs/modalg_5/bug25334_9 b/tests/bugs/modalg_5/bug25334_9 index c301fc61e6..4bd3febef0 100644 --- a/tests/bugs/modalg_5/bug25334_9 +++ b/tests/bugs/modalg_5/bug25334_9 @@ -18,6 +18,9 @@ donly ww openoffset res ww 1 -10 renamevar res_1 result +vori ww +vori result + fit checkprops result -l 558.479 diff --git a/tests/bugs/modalg_7/bug28684_1 b/tests/bugs/modalg_7/bug28684_1 new file mode 100644 index 0000000000..1ad83da731 --- /dev/null +++ b/tests/bugs/modalg_7/bug28684_1 @@ -0,0 +1,31 @@ +puts "============" +puts "OCC25298: Modeling Algorithms - BRepOffsetAPI_MakeOffset produces wire with another orientation in compare with source wire" +puts "============" +puts "" + +circle c 0 0 0 100 +mkedge e c +wire a e + +smallview +display a +fit + +vori a + +if [catch { mkoffset resoffset a 1 10 } ] { + puts "Error : mkoffset is wrong" +} else { + renamevar resoffset_1 result + + vori result + + checkprops result -l 691.15 + checkshape result + checksection result + + display result + fit +} + +checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_7/bug28684_2 b/tests/bugs/modalg_7/bug28684_2 new file mode 100644 index 0000000000..c7871c0239 --- /dev/null +++ b/tests/bugs/modalg_7/bug28684_2 @@ -0,0 +1,31 @@ +puts "============" +puts "OCC25298: Modeling Algorithms - BRepOffsetAPI_MakeOffset produces wire with another orientation in compare with source wire" +puts "============" +puts "" + +circle c 0 0 0 100 +mkedge e c +wire a e + +smallview +display a +fit + +vori a + +if [catch { mkoffset resoffset a 1 -10 } ] { + puts "Error : mkoffset is wrong" +} else { + renamevar resoffset_1 result + + vori result + + checkprops result -l 565.487 + checkshape result + checksection result + + display result + fit +} + +checkview -screenshot -2d -path ${imagedir}/${test_image}.png