]> OCCT Git - occt-copy.git/commitdiff
0027049: Make non-destructive mode be defined by default in Boolean operations CR27049
authoremv <emv@opencascade.com>
Thu, 15 Apr 2021 13:30:03 +0000 (16:30 +0300)
committeremv <emv@opencascade.com>
Mon, 26 Apr 2021 08:50:21 +0000 (11:50 +0300)
Set non-destructive mode enabled by default in Boolean operation algorithms. It means that shapes will not be modified during any Boolean, Split, GeneralFuse, MakerVolume, CellsBuilder operations.

Since now, in this default mode, the user should not expect any shape from the input arguments being present in the result shape of the operations mentioned above. Some of the input shapes may be passed to the result, in case they are not affected by the operation, but in general, it is better to work through the History mechanism. The shapes replaced by the copies should be obtained through Modified method.

Incomplete: documentation of the algorithms has to be updated accordingly.

27 files changed:
src/BOPAlgo/BOPAlgo_Builder.cxx
src/BOPAlgo/BOPAlgo_Builder.hxx
src/BOPAlgo/BOPAlgo_PaveFiller.cxx
src/BOPAlgo/BOPAlgo_PaveFiller.hxx
src/BOPTest/BOPTest_Objects.cxx
src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx
src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.hxx
src/BRepOffset/BRepOffset_MakeOffset.cxx
src/BRepOffset/BRepOffset_MakeOffset_1.cxx
tests/bugs/modalg_5/bug24302
tests/bugs/modalg_6/bug26619
tests/bugs/modalg_6/bug26738
tests/bugs/modalg_6/bug28775
tests/bugs/modalg_7/bug27049
tests/bugs/modalg_7/bug28211_2
tests/bugs/modalg_7/bug28274
tests/bugs/modalg_7/bug28485
tests/bugs/modalg_7/bug28485_1
tests/bugs/modalg_7/bug30396_1
tests/bugs/modalg_7/bug31835_1
tests/bugs/modalg_7/bug31835_2
tests/bugs/modalg_7/bug31836
tests/bugs/modalg_7/bug31850_1
tests/bugs/modalg_7/bug31850_2
tests/bugs/modalg_7/bug31858_1
tests/bugs/modalg_7/bug31858_2
tests/perf/modalg/bug29329

index 7ef864a1b602e9797c5a6bc15cb73963366592ab..7db2fa8726e7f4c88300914ad9450b04f6af61fd 100644 (file)
@@ -53,7 +53,7 @@ BOPAlgo_Builder::BOPAlgo_Builder()
   myShapesSD(100, myAllocator),
   myOrigins(100, myAllocator),
   myInParts(100, myAllocator),
-  myNonDestructive(Standard_False),
+  myNonDestructive(Standard_True),
   myGlue(BOPAlgo_GlueOff),
   myCheckInverted(Standard_True)
 {
@@ -75,7 +75,7 @@ BOPAlgo_Builder::BOPAlgo_Builder
   myShapesSD(100, myAllocator),
   myOrigins(100, myAllocator),
   myInParts(100, myAllocator),
-  myNonDestructive(Standard_False),
+  myNonDestructive(Standard_True),
   myGlue(BOPAlgo_GlueOff),
   myCheckInverted(Standard_True)
 {
index 2d8d1e97c9f17015eeefe6c617c989d97a452e21..8c19f8e76d7f07bb32c4e6bb3a25d3bb1da85b1d 100644 (file)
@@ -52,7 +52,7 @@ class TopoDS_Solid;
 //! Additionally to the options of the base classes, the algorithm has
 //! the following options:<br>
 //! - *Safe processing mode* - allows to avoid modification of the input
-//!                            shapes during the operation (by default it is off);<br>
+//!                            shapes during the operation (enabled by default);<br>
 //! - *Gluing options* - allows to speed up the calculation of the intersections
 //!                      on the special cases, in which some sub-shapes are coinciding.<br>
 //! - *Disabling the check for inverted solids* - Disables/Enables the check of the input solids
@@ -126,6 +126,7 @@ public: //! @name Options
   //! This flag is taken into account if internal PaveFiller is used only.
   //! In the case of calling PerformWithFiller the corresponding flag of that PaveFiller
   //! is in force.
+  //! Enabled by default.
   void SetNonDestructive(const Standard_Boolean theFlag)
   {
     myNonDestructive = theFlag;
index faf4ce3ee973870aba0c3c2af3e729caf221abcb..134fa26eae8fba23a9c81a483a761fa04cd808c9 100644 (file)
@@ -42,7 +42,7 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
 {
   myDS = NULL;
   myIterator = NULL;
-  myNonDestructive = Standard_False;
+  myNonDestructive = Standard_True;
   myIsPrimary = Standard_True;
   myAvoidBuildPCurve = Standard_False;
   myGlue = BOPAlgo_GlueOff;
@@ -62,7 +62,7 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
 {
   myDS = NULL;
   myIterator = NULL;
-  myNonDestructive = Standard_False;
+  myNonDestructive = Standard_True;
   myIsPrimary = Standard_True;
   myAvoidBuildPCurve = Standard_False;
   myGlue = BOPAlgo_GlueOff;
index 307f2e5031bfe1b10c7ba6d066d8809adeedff1c..4e63696dd0674711ffe090e1217ccf6578ccfec9 100644 (file)
@@ -83,7 +83,7 @@ class TopoDS_Face;
 //! - *Section attributes* - allows to customize the intersection of the faces
 //!                          (avoid approximation or building 2d curves);<br>
 //! - *Safe processing mode* - allows to avoid modification of the input
-//!                            shapes during the operation (by default it is off);<br>
+//!                            shapes during the operation (enabled by default);<br>
 //! - *Gluing options* - allows to speed up the calculation on the special
 //!                      cases, in which some sub-shapes are coincide.<br>
 //!
@@ -151,6 +151,7 @@ public:
   //! Sets the flag that defines the mode of treatment.
   //! In non-destructive mode the argument shapes are not modified. Instead
   //! a copy of a sub-shape is created in the result if it is needed to be updated.
+  //! Enabled by default.
   Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag);
   
   //! Returns the flag that defines the mode of treatment.
index f5eb38983c23887f28e69ee0544d5817e2e2226d..503b41c4bd33af3e2e2ca743129eac2ffe6600c3 100644 (file)
@@ -102,7 +102,7 @@ class BOPTest_Session {
   void SetDefaultOptions()
   {
     myRunParallel = Standard_False;
-    myNonDestructive = Standard_False;
+    myNonDestructive = Standard_True;
     myFuzzyValue = Precision::Confusion();
     myGlue = BOPAlgo_GlueOff;
     myDrawWarnShapes = Standard_False;
index 4e310b2f6d95c6fd0d30c33777cf31cc61718d0a..373f932cd20db774986d0f833789b2fa9a9b0305 100644 (file)
@@ -28,7 +28,7 @@
 BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
 :
   BRepAlgoAPI_Algo(),
-  myNonDestructive(Standard_False),
+  myNonDestructive(Standard_True),
   myGlue(BOPAlgo_GlueOff),
   myCheckInverted(Standard_True),
   myFillHistory(Standard_True),
@@ -43,7 +43,7 @@ BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
 BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo(const BOPAlgo_PaveFiller& aPF)
 :
   BRepAlgoAPI_Algo(),
-  myNonDestructive(Standard_False),
+  myNonDestructive(Standard_True),
   myGlue(BOPAlgo_GlueOff),
   myCheckInverted(Standard_True),
   myFillHistory(Standard_True),
index d8cc474de3560b6c520bd409a850559f128560a3..d6d341c6007909e7d9a8c053c13a7e45a037c0a5 100644 (file)
@@ -34,7 +34,7 @@
 //! Additionally to the options defined in the base class, the algorithm has
 //! the following options:<br>
 //! - *Safe processing mode* - allows to avoid modification of the input
-//!                            shapes during the operation (by default it is off);
+//!                            shapes during the operation (enabled by default);
 //! - *Gluing options* - allows to speed up the calculation of the intersections
 //!                      on the special cases, in which some sub-shapes are coinciding.
 //! - *Disabling the check for inverted solids* - Disables/Enables the check of the input solids
@@ -94,6 +94,7 @@ public: //! @name Setting options
   //! Sets the flag that defines the mode of treatment.
   //! In non-destructive mode the argument shapes are not modified. Instead
   //! a copy of a sub-shape is created in the result if it is needed to be updated.
+  //! Enabled by default.
   void SetNonDestructive(const Standard_Boolean theFlag)
   {
     myNonDestructive = theFlag;
index 2c5fe795f3f622145fa4562ce71ad4881c7b6c8e..c1ffbb649e76610e982dc906aad8d647da51037d 100644 (file)
@@ -4302,6 +4302,7 @@ Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF,
   // we need to intersect the faces to process the tangential faces
   aMV1.SetIntersect(Standard_True);
   aMV1.SetAvoidInternalShapes(Standard_True);
+  aMV1.SetNonDestructive(Standard_False);
   aMV1.Perform();
   //
   Standard_Boolean bDone = ! aMV1.HasErrors();
@@ -4382,6 +4383,7 @@ Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF,
   // no need to intersect this time
   aMV2.SetIntersect(Standard_False);
   aMV2.SetAvoidInternalShapes(Standard_True);
+  aMV2.SetNonDestructive(Standard_False);
   aMV2.Perform();
   bDone = ! aMV2.HasErrors();
   if (!bDone) {
@@ -4433,6 +4435,7 @@ Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF,
   aMV3.SetArguments(aLF);
   aMV3.SetIntersect(Standard_False);
   aMV3.SetAvoidInternalShapes(Standard_True);
+  aMV3.SetNonDestructive(Standard_False);
   aMV3.Perform();
   bDone = ! aMV3.HasErrors();
   if (!bDone) {
index ac615955e449083473acb4e6f52c22afc1609730..b75f449ad2bf678f2efec6bf5abedbcc0031b29e 100644 (file)
@@ -46,7 +46,6 @@
 
 #include <BOPDS_DS.hxx>
 
-#include <BOPAlgo_PaveFiller.hxx>
 #include <BOPAlgo_Builder.hxx>
 #include <BOPAlgo_Section.hxx>
 #include <BOPAlgo_MakerVolume.hxx>
@@ -1304,6 +1303,7 @@ void IntersectTrimmedEdges(const TopTools_ListOfShape& theLF,
   // perform intersection of the edges
   BOPAlgo_Builder aGFE;
   aGFE.SetArguments(aLS);
+  aGFE.SetNonDestructive(Standard_False);
   aGFE.Perform();
   if (aGFE.HasErrors()) {
     return;
@@ -1496,9 +1496,9 @@ void BuildSplitsOfTrimmedFace(const TopoDS_Face& theFace,
                               TopTools_ListOfShape& theLFImages)
 {
   BOPAlgo_Builder aGF;
-  //
   aGF.AddArgument(theFace);
   aGF.AddArgument(theEdges);
+  aGF.SetNonDestructive(Standard_False);
   aGF.Perform();
   if (aGF.HasErrors()) {
     return;
@@ -3502,6 +3502,7 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
   BOPAlgo_MakerVolume aMV;
   aMV.SetArguments(aLS);
   aMV.SetIntersect(Standard_True);
+  aMV.SetNonDestructive(Standard_False);
   aMV.Perform();
   if (aMV.HasErrors())
     return;
@@ -5882,6 +5883,7 @@ void IntersectAndTrimEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theF
   // Intersect Edges
   BOPAlgo_Builder aGF;
   aGF.SetArguments(aLArgs);
+  aGF.SetNonDestructive(Standard_False);
   aGF.Perform();
   if (aGF.HasErrors()) {
     return;
@@ -5950,6 +5952,7 @@ void IntersectAndTrimEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theF
   BOPAlgo_Builder aGFCE;
   aGFCE.SetArguments(aLCE);
   aGFCE.AddArgument(aCEIm);
+  aGFCE.SetNonDestructive(Standard_False);
   aGFCE.Perform();
   //
   if (aGFCE.HasErrors()) {
@@ -6398,6 +6401,7 @@ void UpdateValidEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theFImage
   BOPAlgo_Builder aGF;
   aGF.AddArgument(aBounds);
   aGF.AddArgument(aSplits);
+  aGF.SetNonDestructive(Standard_False);
   aGF.Perform();
   //
   // update splits
@@ -6545,6 +6549,7 @@ void TrimNewIntersectionEdges(const TopTools_ListOfShape& theLE,
       aMV.Add(aV1);
       aMV.Add(aV2);
       //
+      aGFE.SetNonDestructive(Standard_False);
       aGFE.Perform();
       if (!aGFE.HasErrors()) {
         // get images of bounding vertices to remove splits containing them
@@ -6634,6 +6639,7 @@ void IntersectEdges(const TopTools_ListOfShape& theLA,
 {
   BOPAlgo_Builder aGFA;
   aGFA.SetArguments(theLA);
+  aGFA.SetNonDestructive(Standard_False);
   aGFA.Perform();
   if (aGFA.HasErrors()) {
     // just copy input to the result
@@ -6874,6 +6880,7 @@ void GetInvalidEdgesByBounds(const TopoDS_Shape& theSplits,
   BOPAlgo_Section aSec;
   aSec.AddArgument(theSplits);
   aSec.AddArgument(theBounds);
+  aSec.SetNonDestructive(Standard_False);
   //
   aSec.Perform();
   //
index a1e64956bae0bf579aa968302e9829c79778048c..f6d05bbdf5ed061737d7bcc11f623268f5981927 100644 (file)
@@ -11,8 +11,6 @@ restore [locate_data_file bug24302_SolidBefore.brep] b
 
 regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance b] full MaxTol_b_1
 
-bnondestructive 1
-
 bop p b
 regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance b] full MaxTol_b_2
 
index 830623200985799b0f6630dd678574bbf1a93d6e..fe0675a73ef031b6270e097d849fb9035691b89c 100644 (file)
@@ -13,11 +13,6 @@ regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance h0] full MaxTolerance1
 
 tolerance f0
 
-#turn on non-destructive mode of BOP
-#setflags h0 locked
-#setflags f0 locked
-bnondestructive 1
-
 bop h0 f0
 bopsection result
 checkprops result -l 150.232
index c032911af027d1ca3057ba1d977206e645a50d1c..af9481b1ea7a00cfd869eef903fd56b3a696f967 100644 (file)
@@ -15,7 +15,6 @@ regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance f0] full ExpectedMaxTol_f0
 #turn on non-destructive mode of BOP and fuzzy value;
 #with this combination the test is fail before the fix 26738,
 #as tolerance of input shape is changed
-bnondestructive 1
 bfuzzyvalue 0.1
 
 bclearobjects
index a056ea2a0d94d0f50cd3d66d240ee6b25942cf87..ba7181b92b17d3d2e78eece594880a645bbdf94e 100644 (file)
@@ -10,8 +10,6 @@ vertex v1 1 0 0
 polyline p1 0 0 0 2 0 0
 polyline p2 1 0 -1 1 0 1
 
-bnondestructive 1
-
 bclearobjects
 bcleartools
 baddobjects v1 p1 p2
index ef2dc59966138b1cf84800fd054e88c1e528692c..5178794424ca9590dd00717926b6cda8833bafcf 100644 (file)
@@ -13,11 +13,6 @@ regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance h0] full MaxTolerance1
 
 tolerance f0
 
-#turn on non-destructive mode of BOP
-#setflags h0 locked
-#setflags f0 locked
-#bnondestructive 1
-
 bop h0 f0
 bopsection result
 checkprops result -l 150.23
index 4fd6012c8105b3a35014a7ad236dddb0bde054d8..a099d0e3a240ae1a77763a5f68928c658ca2a272 100644 (file)
@@ -12,8 +12,6 @@ restore [locate_data_file bug28211_MHX_VKT_WS_Pos3_tool.brep] t
 explode s f
 explode t f
 
-bnondestructive 1
-
 # Before the fix, exception in bsection algo was thrown.
 bsection r s_91 t_4
 
index 5581707de2d7d708a3a58e9d882ae37e1d84788a..10fa3df30964e3f39b960acaa8f5aa7cfa8dc76e 100755 (executable)
@@ -8,8 +8,6 @@ puts ""
 
 restore [locate_data_file bug28274_tmp.brep] a
 
-bnondestructive 1
-
 set Log [eval mkvolume result [explode a f] ]
 
 checkshape result
index 2cb8553e68966a3f6d08775f8db4310905b254d4..c843f43ea126f37724d5eb52ce90cdd29b83925d 100644 (file)
@@ -9,7 +9,6 @@ puts ""
 restore [locate_data_file bug28485_parts.brep] a
 explode a
 
-bnondestructive 1
 brunparallel 1
 bfuzzyvalue 0
 bglue 1
index ea05d792a1b2fc3747867d36cdb2cb21f9e1e0fe..7331a6cea9fc8dbfce11a1ac5409ebd8be06934c 100644 (file)
@@ -11,7 +11,6 @@ box b2 10 2 2 6 6 6
 nurbsconvert b1 b1
 nurbsconvert b2 b2
 
-bnondestructive 1
 brunparallel 1
 bfuzzyvalue 0
 bglue 1
index 6ddbd2416a6813bcf239a187913ae26ae60871b4..6ed259f91e2564fa745d35b82608d6b8b0df15b5 100644 (file)
@@ -17,7 +17,6 @@ set area {25.9962 58.8635 53.1541 empty}
 set nameop {common fuse cut cut21}
 
 bfuzzyvalue 1e-2
-bnondestructive 1
 
 for {set i 1} { $i <= 2} {incr i} {
 
index da0216b9e331360ec04d65eae96cae68a2e95783..74fa3ae804658ae9d3f9523d6ea5fed65373875b 100644 (file)
@@ -10,6 +10,8 @@ pcylinder c2 p2 100 400
 plane p3 0 200 12.6935294289015 0 -1 1.11022302462516e-16
 pcylinder c3 p3 100 400
 
+bnondestructive 0
+
 bcommon r c1 c2
 checkshape r
 if {![regexp "OK" [bopcheck r]]} {
index ba8a0e87a2e91b9d6bc0095fd9d7e7ce62b92136..be3fcefbf07db97ebb4e70bde8c43f0caeab6317 100644 (file)
@@ -11,7 +11,6 @@ plane p3 0 200 12.6935294289015 0 -1 1.11022302462516e-16
 pcylinder c3 p3 100 400
 
 bfuzzyvalue 1.e-6
-bnondestructive 1
 brunparallel 1
 setfillhistory 0
 
index bc2a75ae0e12b75f566cca949a47d427574f547a..242a9c71d139ff24e9711729b90e81941e34c6c6 100644 (file)
@@ -10,7 +10,6 @@ ttranslate t 100 0 300
 
 bfuzzyvalue 1.e-6
 brunparallel 1
-bnondestructive 1
 setfillhistory 0
 
 explode s
index 906267109f6e07d46a44977a3946931b950a0a08..014c484908a428e19950b3f4dd8efb2385e7af3e 100644 (file)
@@ -6,6 +6,8 @@ puts ""
 restore [locate_data_file bug31850.brep] s
 explode s
 
+bnondestructive 0
+
 bclearobjects
 bcleartools
 baddobjects s_1
index 07312180d635a514db961b84992277bab04209c8..e8944876dba72dd201a31ba75d81a1b49ddf4064 100644 (file)
@@ -7,7 +7,6 @@ restore [locate_data_file bug31850.brep] s
 explode s
 
 bfuzzyvalue 1.e-6
-bnondestructive 1
 brunparallel 1
 setfillhistory 0
 
index 3c491c93ba12e71abc4771c3d9751cab475f8f4c..48399b9efb1d1ca653c9a8fc62673fdafc397552 100644 (file)
@@ -7,6 +7,8 @@ pcylinder c 500 200
 plane p -2.31895142368858e-15 -4.49296838339662e-15 200 0 0 1
 ptorus t p 449.367136080235 50.6328639197654
 
+bnondestructive 0
+
 bclearobjects
 bcleartools
 baddobjects c
index a869e7ce79731903155aa930cd9aeca0f5c2a7ad..e32a514984b720ddda65a16812631fb69a8b4a11 100644 (file)
@@ -8,7 +8,6 @@ plane p -2.31895142368858e-15 -4.49296838339662e-15 200 0 0 1
 ptorus t p 449.367136080235 50.6328639197654
 
 bfuzzyvalue 1.e-6
-bnondestructive 1
 brunparallel 1
 setfillhistory 0
 
index 680a82304db52f53a825e65a6c4b9992769c3ae6..83797258d9caa70b03d2302256a9563cf16b235a 100644 (file)
@@ -8,8 +8,6 @@ puts "TODO CR29596 ALL: Warning: Intersection of pair of shapes has failed"
 restore [locate_data_file bug29329_objects.brep] a
 restore [locate_data_file bug29329_tools.brep] b
 
-bnondestructive 1
-
 dchrono timer restart
 
 bfuse result a b