mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0027049: Make non-destructive mode be defined by default in Boolean operations
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.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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.
|
||||
|
@@ -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;
|
||||
|
@@ -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),
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
@@ -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();
|
||||
//
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -9,7 +9,6 @@ puts ""
|
||||
restore [locate_data_file bug28485_parts.brep] a
|
||||
explode a
|
||||
|
||||
bnondestructive 1
|
||||
brunparallel 1
|
||||
bfuzzyvalue 0
|
||||
bglue 1
|
||||
|
@@ -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
|
||||
|
@@ -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} {
|
||||
|
||||
|
@@ -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]]} {
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -10,7 +10,6 @@ ttranslate t 100 0 300
|
||||
|
||||
bfuzzyvalue 1.e-6
|
||||
brunparallel 1
|
||||
bnondestructive 1
|
||||
setfillhistory 0
|
||||
|
||||
explode s
|
||||
|
@@ -6,6 +6,8 @@ puts ""
|
||||
restore [locate_data_file bug31850.brep] s
|
||||
explode s
|
||||
|
||||
bnondestructive 0
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects s_1
|
||||
|
@@ -7,7 +7,6 @@ restore [locate_data_file bug31850.brep] s
|
||||
explode s
|
||||
|
||||
bfuzzyvalue 1.e-6
|
||||
bnondestructive 1
|
||||
brunparallel 1
|
||||
setfillhistory 0
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user