0024825: Fit Boolean Operation Algorithm to treat multiple arguments.
authorpkv <pkv@opencascade.com>
Thu, 17 Apr 2014 12:04:29 +0000 (16:04 +0400)
committerapn <apn@opencascade.com>
Thu, 17 Apr 2014 12:05:14 +0000 (16:05 +0400)
class BOPTest
class BOPAlgo_BOP
class BOPAlgo_Builder
class BOPTest
class BRepFeat_Builder
class BRepFeat_MakeCylindricalHole

The format of the command has been changed:
bbop r op [-s -t]
The following options has been added:
-s - run in serial mode
-t  - print the CPU time

Test cases for issue CR24825

16 files changed:
src/BOPAlgo/BOPAlgo_BOP.cdl
src/BOPAlgo/BOPAlgo_BOP.cxx
src/BOPAlgo/BOPAlgo_BOP_1.cxx
src/BOPAlgo/BOPAlgo_Builder_3.cxx
src/BOPAlgo/BOPAlgo_Builder_4.cxx
src/BOPTest/BOPTest_ObjCommands.cxx
src/BOPTest/BOPTest_PartitionCommands.cxx
src/BRepFeat/BRepFeat_Builder.cxx
src/BRepFeat/BRepFeat_MakeCylindricalHole.cxx
tests/boolean/bcommon_2d/A7 [changed mode: 0644->0755]
tests/boolean/bcommon_2d/B1 [changed mode: 0644->0755]
tests/boolean/bopcommon_2d/A7 [changed mode: 0644->0755]
tests/boolean/bopcommon_2d/B1 [changed mode: 0644->0755]
tests/bugs/modalg_5/bug24825_common [new file with mode: 0644]
tests/bugs/modalg_5/bug24825_cut [new file with mode: 0644]
tests/bugs/modalg_5/bug24825_fuse [new file with mode: 0644]

index 5c49614..4a8daa7 100644 (file)
 -- distribution for complete text of the license and disclaimer of any warranty.
 --
 -- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
+-- commercial license or contractual agreement. 
 
+--BOPAlgo_BOP.cdl
 class BOP from BOPAlgo  
     inherits Builder from BOPAlgo
 ---Purpose: 
 
-uses
-    Shape from TopoDS,  
+uses 
+    ShapeEnum from TopAbs,
+    Shape from TopoDS,   
+    ListOfShape from TopTools, 
+    --
     BaseAllocator from BOPCol,  
     ListOfShape from BOPCol, 
-    ListOfShape from TopTools
-    MapOfShape  from BOPCol,  
-    IndexedDataMapOfShapeListOfShape from BOPCol,
-    Operation from BOPAlgo, 
+    MapOfShape  from BOPCol
+    IndexedDataMapOfShapeListOfShape from BOPCol, 
+    --
+    Operation  from BOPAlgo, 
     PaveFiller from BOPAlgo 
 
 --raises
@@ -31,85 +37,79 @@ uses
 is
     Create 
     ---Purpose:  Empty constructor     
-    returns BOP from BOPAlgo;  
+        returns BOP from BOPAlgo;  
     ---C++: alias "Standard_EXPORT virtual ~BOPAlgo_BOP();"  
       
     Create (theAllocator: BaseAllocator from BOPCol)
-    returns BOP from BOPAlgo; 
+        returns BOP from BOPAlgo; 
         
     Clear(me:out) 
     is redefined; 
     ---Purpose:  Clears internal fields and arguments   
      
-    AddArgument (me:out;  
-        theShape: Shape from TopoDS) 
-    ---Purpose:  Adds Object argument of the operation     
-     is redefined;
-        
     AddTool (me:out;  
-        theShape: Shape from TopoDS) 
+            theShape: Shape from TopoDS) 
     ---Purpose:  Adds Tool argument of the operation                
-    is virtual; 
-        
-    Object(me) 
-    returns Shape from TopoDS; 
-    ---C++: return const &   
-
-    Tool(me) 
-    returns Shape from TopoDS; 
-    ---C++: return const &   
+        is virtual; 
 
     SetOperation(me:out;  
-        theOperation: Operation from BOPAlgo); 
+            theOperation: Operation from BOPAlgo); 
         
     Operation(me) 
-    returns Operation from BOPAlgo;  
+        returns Operation from BOPAlgo; 
+    -- 
+    Perform(me:out) 
+        is redefined;  
     --
     --  protected methods 
     -- 
     CheckData(me:out) 
-    is redefined protected; 
+        is redefined protected; 
 
     Prepare(me:out)  
-    is redefined protected; 
+        is redefined protected; 
     ---Purpose:  Provides preparing actions 
 
     PerformInternal(me:out; 
         thePF:PaveFiller from BOPAlgo) 
-    is redefined protected;   
+        is redefined protected;   
     ---Purpose:  Performs calculations using prepared Filler 
     --           object theDSF                  
-      
+     
+    BuildResult(me:out; 
+        theType: ShapeEnum from TopAbs) 
+        is redefined protected;     
+     
     BuildShape(me:out) 
-    is protected; 
+        is protected; 
  
     BuildRC(me:out) 
-    is protected; 
+        is protected; 
  
     BuildSolid(me:out) 
-    is protected; 
+        is protected; 
         
     BuildSection(me:out) 
-    is protected;  
+        is protected;  
  
     IsBoundSplits(me:out; 
-        theS:Shape from TopoDS; 
-        theMEF:out IndexedDataMapOfShapeListOfShape from BOPCol)  
-    returns Boolean from Standard
-    is protected;
+            theS:Shape from TopoDS; 
+            theMEF:out IndexedDataMapOfShapeListOfShape from BOPCol)  
+        returns Boolean from Standard
+        is protected;
 
     Generated (me:out;  
-        theS : Shape from TopoDS)
+            theS : Shape from TopoDS) 
+        returns ListOfShape from TopTools
+        is redefined; 
+    ---C++: return const & 
     ---Purpose: Returns the  list of shapes generated from the
     --          shape theS. 
-    returns ListOfShape from TopTools
-    is redefined;
-    ---C++: return const & 
+   
+      
 
 fields 
-    myNbArgs    : Integer from Standard    is protected;
     myOperation : Operation from BOPAlgo   is protected; 
-    myArgs      : Shape from TopoDS[2]     is protected;  
     myDims      : Integer from Standard[2] is protected;  
     -- 
     myRC        : Shape from TopoDS        is protected; 
index 53f0617..47a392c 100644 (file)
 
 #include <TopoDS_Compound.hxx>
 #include <TopoDS_Iterator.hxx>
+#include <TopoDS_Edge.hxx>
 #include <BRep_Builder.hxx>
 #include <TopExp_Explorer.hxx>
 
+#include <BOPCol_ListOfShape.hxx>
+#include <BOPCol_MapOfShape.hxx>
+#include <BOPCol_IndexedMapOfShape.hxx>
+#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
+#include <BOPCol_DataMapOfShapeShape.hxx>
+
+#include <BOPDS_DS.hxx>
+
 #include <BOPTools.hxx>
 #include <BOPTools_AlgoTools.hxx>
 #include <BOPTools_AlgoTools3D.hxx>
+#include <BOPTools_AlgoTools.hxx>
 
-#include <BOPCol_ListOfShape.hxx>
 #include <BOPAlgo_BuilderSolid.hxx>
-#include <TopoDS_Edge.hxx>
+
+#include <BRep_Tool.hxx>
+
 
 static
   TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim);
 
+
 //=======================================================================
 //function : 
 //purpose  : 
 //=======================================================================
-  BOPAlgo_BOP::BOPAlgo_BOP()
+BOPAlgo_BOP::BOPAlgo_BOP()
 :
   BOPAlgo_Builder(),
   myTools(myAllocator),
   myMapTools(100, myAllocator)
 {
-  myNbArgs=2;
   Clear();
 }
 //=======================================================================
 //function : 
 //purpose  : 
 //=======================================================================
-  BOPAlgo_BOP::BOPAlgo_BOP(const Handle(NCollection_BaseAllocator)& theAllocator)
+BOPAlgo_BOP::BOPAlgo_BOP
+  (const Handle(NCollection_BaseAllocator)& theAllocator)
 :
   BOPAlgo_Builder(theAllocator),
   myTools(myAllocator),
   myMapTools(100, myAllocator)
 {
-  myNbArgs=2;
   Clear();
 }
 //=======================================================================
 //function : ~
 //purpose  : 
 //=======================================================================
-  BOPAlgo_BOP::~BOPAlgo_BOP()
+BOPAlgo_BOP::~BOPAlgo_BOP()
 {
 }
 //=======================================================================
 //function : Clear
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_BOP::Clear()
+void BOPAlgo_BOP::Clear()
 {
   myOperation=BOPAlgo_UNKNOWN;
   myTools.Clear();
@@ -80,80 +91,53 @@ static
   BOPAlgo_Builder::Clear();
 }
 //=======================================================================
-//function : AddArgument
-//purpose  : 
-//=======================================================================
-  void BOPAlgo_BOP::AddArgument(const TopoDS_Shape& theShape)
-{
-  if (myMapFence.Add(theShape)) {
-    myArguments.Append(theShape);
-    myArgs[0]=theShape;
-  }
-}
-//=======================================================================
-//function : AddTool
-//purpose  : 
-//=======================================================================
-  void BOPAlgo_BOP::AddTool(const TopoDS_Shape& theShape)
-{
-  if (myMapTools.Add(theShape)) {
-    myTools.Append(theShape);
-    myArgs[1]=theShape;
-    //
-    if (myMapFence.Add(theShape)) {
-      myArguments.Append(theShape);
-    }
-  }
-}
-//=======================================================================
-//function : Object
-//purpose  : 
-//=======================================================================
-  const TopoDS_Shape& BOPAlgo_BOP::Object()const
-{
-  return myArgs[0];
-}
-//=======================================================================
-//function : Tool
+//function : SetOperation
 //purpose  : 
 //=======================================================================
-  const TopoDS_Shape& BOPAlgo_BOP::Tool()const
+void BOPAlgo_BOP::SetOperation(const BOPAlgo_Operation theOperation)
 {
-  return myArgs[1];
+  myOperation=theOperation;
 }
 //=======================================================================
-//function : SetOperation
+//function : Operation
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_BOP::SetOperation(const BOPAlgo_Operation theOperation)
+BOPAlgo_Operation BOPAlgo_BOP::Operation()const
 {
-  myOperation=theOperation;
+  return myOperation;
 }
 //=======================================================================
-//function : Operation
+//function : AddTool
 //purpose  : 
 //=======================================================================
-  BOPAlgo_Operation BOPAlgo_BOP::Operation()const
+void BOPAlgo_BOP::AddTool(const TopoDS_Shape& theShape)
 {
-  return myOperation;
+  if (myMapTools.Add(theShape)) {
+    myTools.Append(theShape);
+  }
 }
 //=======================================================================
 //function : CheckData
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_BOP::CheckData()
+void BOPAlgo_BOP::CheckData()
 {
-  Standard_Integer i, aNb;
+  Standard_Integer i, j, iDim, aNbArgs, aNbTools;
   Standard_Boolean bFlag;
+  BOPCol_ListIteratorOfListOfShape aItLS;
   //
   myErrorStatus=0;
   //
-  aNb=myArguments.Extent();
-  if (aNb!=myNbArgs) {
-    if (aNb!=1 || !(myArgs[0].IsSame(myArgs[1]))) {
-      myErrorStatus=10; // invalid number of arguments
-      return;
-    }
+  aNbArgs=myArguments.Extent();
+  if (!aNbArgs) {
+    myErrorStatus=100; // invalid number of Arguments
+    return;
+  }
+  //
+  aNbTools=myTools.Extent();
+  if (!aNbTools) {
+    myErrorStatus=100; // invalid number of Tools
+    return;
   }
   //
   if (!myPaveFiller) {
@@ -166,25 +150,31 @@ static
     return;
   }
   //
-  for (i=0; i<myNbArgs; ++i) {
-    if (myArgs[i].IsNull()) {
-      myErrorStatus=11; // argument is null shape
-      return;
-    }
-  }
-  //
-  for (i=0; i<myNbArgs; ++i) {
-    bFlag = BOPTools_AlgoTools3D::IsEmptyShape(myArgs[i]);
-    if(bFlag) {
-      myWarningStatus = 2;
-    }
-  }
-  //
-  for (i=0; i<myNbArgs; ++i) {
-    myDims[i]=BOPTools_AlgoTools::Dimension(myArgs[i]);
-    if (myDims[i]<0) {
-      myErrorStatus=13; // non-homogenious argument
-      return;
+  for (i=0; i<2; ++i) {
+    const BOPCol_ListOfShape& aLS=(!i)? myArguments : myTools;
+    aItLS.Initialize(aLS);
+    for (j=0; aItLS.More(); aItLS.Next(), ++j) {
+      const TopoDS_Shape& aS=aItLS.Value();
+      bFlag=BOPTools_AlgoTools3D::IsEmptyShape(aS);
+      if(bFlag) {
+        myWarningStatus=2;
+      }
+      //
+      iDim=BOPTools_AlgoTools::Dimension(aS);
+      if (iDim<0) {
+        myErrorStatus=13; // non-homogenious argument
+        return;
+      }
+      //
+      if (!j) {
+        myDims[i]=iDim;
+        continue;
+      }
+      //
+      if (iDim!=myDims[i]) {
+        myErrorStatus=13; // non-homogenious argument
+        return;
+      }
     }
   }
   //
@@ -211,47 +201,142 @@ static
 //function : Prepare
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_BOP::Prepare()
+void BOPAlgo_BOP::Prepare()
 {
-  Standard_Integer i;
-  BRep_Builder aBB;
   //
   BOPAlgo_Builder::Prepare();
   //
   if(myWarningStatus == 2) {
+    Standard_Integer i;
+    BRep_Builder aBB;
+    BOPCol_ListIteratorOfListOfShape aItLS;
+    //
     switch(myOperation) {
-      case BOPAlgo_FUSE:
-        for ( i = 0; i < myNbArgs; i++ ) {
-          aBB.Add(myShape, myArgs[i]);
+      case BOPAlgo_FUSE: {
+        for (i=0; i<2; ++i) {
+          const BOPCol_ListOfShape& aLS=(!i)? myArguments : myTools;
+          aItLS.Initialize(aLS);
+          for (; aItLS.More(); aItLS.Next()) {
+            const TopoDS_Shape& aS=aItLS.Value();
+            aBB.Add(myShape, aS);
+          }
         }
+      }
         break;
-      case BOPAlgo_COMMON:
-      case BOPAlgo_SECTION:
-        break;
-      case BOPAlgo_CUT:
-        if(BOPTools_AlgoTools3D::IsEmptyShape(myArgs[0])) {
-          break;
-        } else {
-          aBB.Add(myShape, myArgs[0]);
+      //  
+      case BOPAlgo_CUT: {
+        aItLS.Initialize(myArguments);
+        for (; aItLS.More(); aItLS.Next()) {
+          const TopoDS_Shape& aS=aItLS.Value();
+          if(!BOPTools_AlgoTools3D::IsEmptyShape(aS)) {
+            aBB.Add(myShape, aS);
+          } 
         }
+      }
         break;
-      case BOPAlgo_CUT21:
-        if(BOPTools_AlgoTools3D::IsEmptyShape(myArgs[1])) {
-          break;
-        } else {
-          aBB.Add(myShape, myArgs[1]);
+      
+      case BOPAlgo_CUT21: {
+        aItLS.Initialize(myTools);
+        for (; aItLS.More(); aItLS.Next()) {
+          const TopoDS_Shape& aS=aItLS.Value();
+          if(!BOPTools_AlgoTools3D::IsEmptyShape(aS)) {
+            aBB.Add(myShape, aS);
+          } 
         }
+      }
         break;
+        //
+      case BOPAlgo_COMMON:
+      case BOPAlgo_SECTION:
       default:
         break;
+      }
+  }
+}
+//=======================================================================
+//function : BuildResult
+//purpose  : 
+//=======================================================================
+void BOPAlgo_BOP::BuildResult(const TopAbs_ShapeEnum theType)
+{
+  TopAbs_ShapeEnum aType;
+  BRep_Builder aBB;
+  BOPCol_MapOfShape aM;
+  BOPCol_ListIteratorOfListOfShape aIt, aItIm;
+  //
+  myErrorStatus=0;
+  //
+  const BOPCol_ListOfShape& aLA=myDS->Arguments();
+  aIt.Initialize(aLA);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aS=aIt.Value();
+    aType=aS.ShapeType();
+    if (aType==theType) {
+      if (myImages.IsBound(aS)){
+        const BOPCol_ListOfShape& aLSIm=myImages.Find(aS);
+        aItIm.Initialize(aLSIm);
+        for (; aItIm.More(); aItIm.Next()) {
+          const TopoDS_Shape& aSIm=aItIm.Value();
+          if (aM.Add(aSIm)) {
+            aBB.Add(myShape, aSIm);
+          }
+        }
+      }
+      else {
+        if (aM.Add(aS)) {
+          aBB.Add(myShape, aS);
+        }
+      }
     }
   }
 }
 //=======================================================================
+//function : Perform
+//purpose  : 
+//=======================================================================
+void BOPAlgo_BOP::Perform()
+{
+  Handle(NCollection_BaseAllocator) aAllocator;
+  BOPAlgo_PaveFiller* pPF;
+  BOPCol_ListIteratorOfListOfShape aItLS;
+  //
+  myErrorStatus=0;
+  //
+  if (myEntryPoint==1) {
+    if (myPaveFiller) {
+      delete myPaveFiller;
+      myPaveFiller=NULL;
+    }
+  }
+  //
+  aAllocator=new NCollection_IncAllocator;
+  BOPCol_ListOfShape aLS(aAllocator);
+  //
+  aItLS.Initialize(myArguments);
+  for (; aItLS.More(); aItLS.Next()) {
+    const TopoDS_Shape& aS=aItLS.Value();
+    aLS.Append(aS);
+  }
+  //
+  aItLS.Initialize(myTools);
+  for (; aItLS.More(); aItLS.Next()) {
+    const TopoDS_Shape& aS=aItLS.Value();
+    aLS.Append(aS);
+  }
+  //
+  pPF=new BOPAlgo_PaveFiller(aAllocator);
+  pPF->SetArguments(aLS);
+  //
+  pPF->Perform();
+  //
+  myEntryPoint=1;
+  PerformInternal(*pPF);
+}
+//=======================================================================
 //function : PerformInternal
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_BOP::PerformInternal(const BOPAlgo_PaveFiller& theFiller)
+void BOPAlgo_BOP::PerformInternal(const BOPAlgo_PaveFiller& theFiller)
 {
   myErrorStatus=0;
   myWarningStatus=0;
@@ -271,10 +356,10 @@ static
   if (myErrorStatus) {
     return;
   }
+  //
   if(myWarningStatus == 2) {
     return;
   }
-  //
   // 3. Fill Images
   // 3.1 Vertices
   FillImagesVertices();
@@ -296,14 +381,14 @@ static
   if (myErrorStatus) {
     return;
   }
-  //-------------------------------- SECTION f
+  //-------------------------------- SECTION 
   if (myOperation==BOPAlgo_SECTION) {
     BuildSection();
     PrepareHistory();
     PostTreat();
     return;
   }
-  //-------------------------------- SECTION t
+  //-------------------------------- 
   //
   // 3.3 Wires
   FillImagesContainers(TopAbs_WIRE);
@@ -368,21 +453,204 @@ static
     return;
   }
   //
-  // 6.BuildShape;
+  // 4.BuildShape;
   BuildShape();
+  if (myErrorStatus) {
+    return;
+  }
   // 
-  // 4.History
+  // 5.History
   PrepareHistory();
-
   //
-  // 5 Post-treatment 
+  // 6 Post-treatment 
   PostTreat();
 }
 //=======================================================================
+//function : BuildRC
+//purpose  : 
+//=======================================================================
+void BOPAlgo_BOP::BuildRC()
+{
+  Standard_Boolean bFlag1, bFlag2, bIsBound;
+  Standard_Integer aDmin;
+  TopAbs_ShapeEnum aTmin;
+  TopoDS_Compound aC;
+  TopoDS_Shape aSAIm, aSTIm;
+  BRep_Builder aBB;
+  TopExp_Explorer aExp;
+  BOPCol_DataMapOfShapeShape aDMSSA;
+  BOPCol_ListIteratorOfListOfShape aItLS, aItIm;
+  //
+  myErrorStatus=0;
+  //
+  aBB.MakeCompound(aC);
+  //
+  // A. Fuse
+  if (myOperation==BOPAlgo_FUSE) {
+    aTmin=TypeToExplore(myDims[0]);
+    aExp.Init(myShape, aTmin);
+    for (; aExp.More(); aExp.Next()) {
+      const TopoDS_Shape& aS=aExp.Current();
+      aBB.Add(aC, aS);
+    }
+    myRC=aC;
+    return;
+  } 
+  //
+  aDmin=myDims[1];
+  if (myDims[0] < myDims[1]) {
+    aDmin=myDims[0];
+  }
+  aTmin=TypeToExplore(aDmin);
+  //
+  // B. Common, Cut, Cut21
+  //
+  bFlag1=(myOperation==BOPAlgo_COMMON || myOperation==BOPAlgo_CUT21);
+  bFlag2=(myOperation==BOPAlgo_CUT || myOperation==BOPAlgo_CUT21);
+  //
+  const BOPCol_ListOfShape& aLA=( bFlag1) ? myArguments : myTools;
+  aItLS.Initialize(aLA);
+  for (; aItLS.More(); aItLS.Next()) {
+    const TopoDS_Shape& aSA=aItLS.Value();
+    //
+    if (myImages.IsBound(aSA)){
+      const BOPCol_ListOfShape& aLSAIm=myImages.Find(aSA);
+      aItIm.Initialize(aLSAIm);
+      for (; aItIm.More(); aItIm.Next()) {
+        const TopoDS_Shape& aSAIm=aItIm.Value();
+        aExp.Init(aSAIm, aTmin);
+        for (; aExp.More(); aExp.Next()) {
+          const TopoDS_Shape aSIm=aExp.Current();
+          aDMSSA.Bind(aSIm, aSIm);
+        }
+      }
+    }
+    //
+    else {
+      aExp.Init(aSA, aTmin);
+      for (; aExp.More(); aExp.Next()) {
+        const TopoDS_Shape aSIm=aExp.Current();
+        aDMSSA.Bind(aSIm, aSIm);
+      }
+    }
+  } //for (; aItLS.More(); aItLS.Next())
+  //
+  const BOPCol_ListOfShape& aLT=(!bFlag1) ? myArguments : myTools;
+  aItLS.Initialize(aLT);
+  for (; aItLS.More(); aItLS.Next()) {
+    const TopoDS_Shape& aST=aItLS.Value();
+    if (myImages.IsBound(aST)){
+      const BOPCol_ListOfShape& aLSTIm=myImages.Find(aST);
+      aItIm.Initialize(aLSTIm);
+      for (; aItIm.More(); aItIm.Next()) {
+        const TopoDS_Shape& aSTIm=aItIm.Value();
+        aExp.Init(aSTIm, aTmin);
+        for (; aExp.More(); aExp.Next()) {
+          const TopoDS_Shape aSIm=aExp.Current();
+          // skip degenerated edges
+          if (aTmin==TopAbs_EDGE) {
+            const TopoDS_Edge& aEIm=*((TopoDS_Edge*)&aSIm);
+            if (BRep_Tool::Degenerated(aEIm)) {
+              continue;
+            }
+          }
+          //
+          bIsBound=aDMSSA.IsBound(aSIm);
+          if (!bFlag2) { // ie common
+            if (bIsBound) {
+              const TopoDS_Shape& aSImA=aDMSSA.Find(aSIm);
+              aBB.Add(aC, aSImA);
+            }
+          }
+          else {// ie cut or cut21
+            if (!bIsBound) {
+              aBB.Add(aC, aSIm);
+            }
+          }
+        }
+      }
+    }
+    else {
+      aExp.Init(aST, aTmin);
+      for (; aExp.More(); aExp.Next()) {
+        const TopoDS_Shape aSIm=aExp.Current();
+        // skip degenerated edges
+        if (aTmin==TopAbs_EDGE) {
+          const TopoDS_Edge& aEIm=*((TopoDS_Edge*)&aSIm);
+          if (BRep_Tool::Degenerated(aEIm)) {
+            continue;
+          }
+        }
+        bIsBound=aDMSSA.IsBound(aSIm);
+        if (!bFlag2) { // ie common
+          if (bIsBound) {
+            const TopoDS_Shape& aSImA=aDMSSA.Find(aSIm);
+            aBB.Add(aC, aSImA);
+          }
+        }
+        else {// ie cut or cut21
+          if (!bIsBound) {
+            aBB.Add(aC, aSIm);
+          }
+        }
+      }
+    }
+  } //for (; aItLS.More(); aItLS.Next())
+  //
+  // the squats around degeneracy
+  if (aTmin!=TopAbs_EDGE) {
+    myRC=aC;
+    return;
+  }
+  //---------------------------------------------------------
+  //
+  // The squats around degenerated edges
+  Standard_Integer i, aNbS, nVD;
+  TopAbs_ShapeEnum aType;
+  BOPCol_IndexedMapOfShape aMVC;
+  //
+  // 1. Vertices of aC
+  BOPTools::MapShapes(aC, TopAbs_VERTEX, aMVC);
+  //
+  // 2. DE candidates
+  aNbS=myDS->NbSourceShapes();
+  for (i=0; i<aNbS; ++i) {
+    const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
+    aType=aSI.ShapeType();
+    if (aType!=aTmin) {
+      continue;
+    }
+    //
+    const TopoDS_Edge& aE=*((TopoDS_Edge*)&aSI.Shape());
+    if (!BRep_Tool::Degenerated(aE)) {
+      continue;
+    }
+    //
+    nVD=aSI.SubShapes().First();
+    const TopoDS_Shape& aVD=myDS->Shape(nVD);
+    //
+    if (!aMVC.Contains(aVD)) {
+      continue;
+    }
+    //
+    if (myDS->IsNewShape(nVD)) {
+      continue;
+    }
+    //
+    if (myDS->HasInterf(nVD)) {
+      continue;
+    }
+    //
+    aBB.Add(aC, aE);
+  }
+  //
+  myRC=aC;
+}
+//=======================================================================
 //function : BuildShape
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_BOP::BuildShape()
+void BOPAlgo_BOP::BuildShape()
 {
   Standard_Integer aDmin, aNbLCB;
   TopAbs_ShapeEnum aT1, aT2, aTR;
@@ -395,7 +663,6 @@ static
   myErrorStatus=0;
   //
   BuildRC();
-  //myShape=myRC;
   //
   aDmin=myDims[1];
   if (myDims[0]<myDims[1]) {
@@ -417,7 +684,8 @@ static
       aTR=TopAbs_SHELL;
     }
     //
-    BOPTools_AlgoTools::MakeConnexityBlocks(myRC, aT1, aT2, aLCB);
+    BOPTools_AlgoTools::MakeConnexityBlocks
+      (myRC, aT1, aT2, aLCB);
     aNbLCB=aLCB.Extent();
     if (!aNbLCB) {
       myShape=myRC;
@@ -446,186 +714,30 @@ static
     myShape=aRC;
   }// elase if (aDmin==1 || aDmin==2) {
   
-  else { //aDmin=3
-    if (myOperation==BOPAlgo_FUSE) {
-      BuildSolid();
-    }
-    else {
-      myShape=myRC;
-    }
-  }
-}
-//=======================================================================
-//function : BuildRC
-//purpose  : 
-//=======================================================================
-  void BOPAlgo_BOP::BuildRC()
-{
-  Standard_Boolean bFlag;
-  Standard_Integer i, aDmin, aNb[2], iX = 0, iY = 0;
-  TopAbs_ShapeEnum aTmin;
-  TopoDS_Compound aC, aCS[2];
-  BRep_Builder aBB;
-  TopExp_Explorer aExp;
-  BOPCol_ListIteratorOfListOfShape aItIm;
-  BOPCol_IndexedMapOfShape aMS[2];
-  BOPCol_IndexedMapOfShape aMSV[2];
-  //
-  myErrorStatus=0;
-  //
-  // A. Fuse
-  if (myOperation==BOPAlgo_FUSE) {
-    aBB.MakeCompound(aC);
-    aTmin=TypeToExplore(myDims[0]);
-    aExp.Init(myShape, aTmin);
-    for (; aExp.More(); aExp.Next()) {
-      const TopoDS_Shape& aS=aExp.Current();
-      aBB.Add(aC, aS);
-    }
-    myRC=aC;
-    return;
-  }
-  //
-  // B. Non-Fuse
-  //
-  // 1. Compounds CS that consist of an Arg or Images of the Arg
-  for (i=0; i<myNbArgs; ++i) {
-    aBB.MakeCompound(aCS[i]);
-    const TopoDS_Shape& aS=myArgs[i];
-    if (myImages.IsBound(aS)){
-      const BOPCol_ListOfShape& aLSIm=myImages.Find(aS);
-      aItIm.Initialize(aLSIm);
-      for (; aItIm.More(); aItIm.Next()) {
-        const TopoDS_Shape& aSIm=aItIm.Value();
-        aBB.Add(aCS[i], aSIm);
-      }
-    }
-    else {
-      aBB.Add(aCS[i], aS);
-    }
-  }
-  //
-  aDmin=myDims[1];
-  if (myDims[0]<myDims[1]) {
-    aDmin=myDims[0];
-  }
-  aTmin=TypeToExplore(aDmin);
-  for (i=0; i<myNbArgs; ++i) {
-    aExp.Init(aCS[i], aTmin);
-    for (; aExp.More(); aExp.Next()) {
-      const TopoDS_Shape aS=aExp.Current();
-      if (aTmin == TopAbs_EDGE) {
-        const TopoDS_Edge& aE = (*(TopoDS_Edge*)(&aS));
-        if (BRep_Tool::Degenerated(aE)) {
-          TopExp_Explorer aExpE(aE, TopAbs_VERTEX);
-          TopoDS_Shape aS1 = aExpE.Current();
-          if (myImages.IsBound(aS1)){
-            const BOPCol_ListOfShape& aLSIm=myImages.Find(aS1);
-            const TopoDS_Shape& aSIm=aLSIm.First();
-            aMSV[i].Add(aSIm);
-          } else {
-            aMSV[i].Add(aS1);
-          }
-        }
-      }
-      //
-      if (myImages.IsBound(aS)){
-        const BOPCol_ListOfShape& aLSIm=myImages.Find(aS);
-        aItIm.Initialize(aLSIm);
-        for (; aItIm.More(); aItIm.Next()) {
-          const TopoDS_Shape& aSIm=aItIm.Value();
-          aMS[i].Add(aSIm);
-        }
+  else {//aDmin=3
+    Standard_Integer aNbObjs, aNbTools;
+    //
+    aNbObjs=myArguments.Extent();
+    aNbTools=myTools.Extent();
+    //
+    if (aNbObjs==1 && aNbTools==1) {
+      if (myOperation==BOPAlgo_FUSE) {
+        BuildSolid();
       }
       else {
-        aMS[i].Add(aS);
+        myShape=myRC;
       }
     }
-    aNb[i]=aMS[i].Extent();
-  }
-  //
-  aBB.MakeCompound(aC);
-  //
-  // 3. Find common parts
-  if (myOperation==BOPAlgo_COMMON) {
-    if (myDims[0]==myDims[1]) {
-      iX=(aNb[0]>aNb[1])? 1 : 0;
-    } else {
-      iX=(myDims[0]<myDims[1]) ? 0 : 1;
-    }
-    iY=(iX+1)%2;
-  }
-  else if (myOperation==BOPAlgo_CUT) {
-    iX=0;
-    iY=1;
-  }
-  else if (myOperation==BOPAlgo_CUT21) {
-    iX=1;
-    iY=0;
-  }
-  for (i=1; i<=aNb[iX]; ++i) {
-    const TopoDS_Shape& aSx=aMS[iX].FindKey(i);
-    bFlag=aMS[iY].Contains(aSx);
-    if (aTmin == TopAbs_EDGE) {
-      const TopoDS_Edge& aE = (*(TopoDS_Edge*)(&aSx));
-      if (BRep_Tool::Degenerated(aE)) {
-        TopExp_Explorer aExpE(aE, TopAbs_VERTEX);
-        TopoDS_Shape aSx1 = aExpE.Current();
-        TopoDS_Shape aSIm;
-        if (myImages.IsBound(aSx1)) {
-          const BOPCol_ListOfShape& aLSIm=myImages.Find(aSx1);
-          aSIm=aLSIm.First();
-        } else {
-          aSIm = aSx1;
-        }
-        bFlag=aMSV[iY].Contains(aSIm);
-      }
-    }
-    //
-    if (myOperation!=BOPAlgo_COMMON) {
-      bFlag=!bFlag;
-    }
-    //
-    if (bFlag) {
-      aBB.Add(aC, aSx);
+    else {
+      BuildSolid();
     }
   }
-  //
-  myRC=aC;
-}
-//
-//=======================================================================
-//function : TypeToExplore
-//purpose  : 
-//=======================================================================
-TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim)
-{
-  TopAbs_ShapeEnum aRet;
-  //
-  switch(theDim) {
-  case 0:
-    aRet=TopAbs_VERTEX;
-    break;
-  case 1:
-    aRet=TopAbs_EDGE;
-    break;
-  case 2:
-    aRet=TopAbs_FACE;
-    break;
-  case 3:
-    aRet=TopAbs_SOLID;
-    break;
-  default:
-    aRet=TopAbs_SHAPE;
-    break;
-  }
-  return aRet;
 }
 //=======================================================================
 //function : BuildSolid
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_BOP::BuildSolid()
+void BOPAlgo_BOP::BuildSolid()
 {
   Standard_Integer i, aNbF, aNbSx, iX, iErr;
   TopAbs_Orientation aOr, aOr1;
@@ -672,8 +784,8 @@ TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim)
       }
     }
   }
-  //
-  BOPCol_ListOfShape aLF, aLFx; //faces that will be added in the end;
+  //faces that will be added in the end;
+  BOPCol_ListOfShape aLF, aLFx; 
   // SFS
   aNbF=aMFS.Extent();
   for (i=1; i<=aNbF; ++i) {
@@ -681,7 +793,8 @@ TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim)
     const BOPCol_ListOfShape& aLSx=aMFS(i);
     aNbSx=aLSx.Extent();
     if (aNbSx==1) {
-      BOPTools::MapShapesAndAncestors(aFx, TopAbs_EDGE, TopAbs_FACE, aMEF);
+      BOPTools::MapShapesAndAncestors
+        (aFx,TopAbs_EDGE, TopAbs_FACE, aMEF);
       if (IsBoundSplits(aFx, aMEF)){
         aLFx.Append(aFx);
         continue;
@@ -734,13 +847,13 @@ TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim)
   }
   myShape=aRC;
 }
-
 //=======================================================================
 //function : IsBoundImages
 //purpose  : 
 //=======================================================================
-  Standard_Boolean BOPAlgo_BOP::IsBoundSplits(const TopoDS_Shape& aS,
-                                              BOPCol_IndexedDataMapOfShapeListOfShape& aMEF)
+Standard_Boolean BOPAlgo_BOP::IsBoundSplits
+  (const TopoDS_Shape& aS,
+   BOPCol_IndexedDataMapOfShapeListOfShape& aMEF)
 {
   Standard_Boolean bRet = Standard_False;
   if (mySplits.IsBound(aS) || myOrigins.IsBound(aS)) {
@@ -774,11 +887,38 @@ TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim)
     aIt.Initialize(aLS);
     for (; aIt.More(); aIt.Next()) {
       const TopoDS_Shape& aSx = aIt.Value();
-      if (mySplits.IsBound(aSx)  || myOrigins.IsBound(aS)) {
+      if (mySplits.IsBound(aSx) || myOrigins.IsBound(aS)) {
         return !bRet;
       }
     }
   }
-
+  //
   return bRet;
 }
+//=======================================================================
+//function : TypeToExplore
+//purpose  : 
+//=======================================================================
+TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim)
+{
+  TopAbs_ShapeEnum aRet;
+  //
+  switch(theDim) {
+  case 0:
+    aRet=TopAbs_VERTEX;
+    break;
+  case 1:
+    aRet=TopAbs_EDGE;
+    break;
+  case 2:
+    aRet=TopAbs_FACE;
+    break;
+  case 3:
+    aRet=TopAbs_SOLID;
+    break;
+  default:
+    aRet=TopAbs_SHAPE;
+    break;
+  }
+  return aRet;
+}
index 83ec67c..0134e44 100644 (file)
@@ -36,7 +36,7 @@
 //function : BuildSection
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_BOP::BuildSection()
+void BOPAlgo_BOP::BuildSection()
 {
 
   Standard_Integer i, j, k, nE, nF1, nF2, aNbPB, aNbFF;
     }
   }
   //
-  //case when arguments are the same
-  if (!aNbFF) {
-    if (myArgs[0].IsSame(myArgs[1])) {
-      TopExp_Explorer anExpF, anExpE;
-      //
-      anExpF.Init(myArgs[0], TopAbs_FACE);
-      for(; anExpF.More(); anExpF.Next()) {
-        const TopoDS_Shape& aF = anExpF.Current();
-        //
-        anExpE.Init(aF, TopAbs_EDGE);
-        for (; anExpE.More(); anExpE.Next()) {
-          const TopoDS_Shape& aE = anExpE.Current();
-          //
-          if (aME.Add(aE)) {
-            aBB.Add(aRC, aE);
-          }
-        }
-      }
-    }
-  }
-  //
   myShape=aRC;
 }
-
 //=======================================================================
 //function : Generated
 //purpose  : 
 //=======================================================================
-const TopTools_ListOfShape& BOPAlgo_BOP::Generated(const TopoDS_Shape& theS)
+const TopTools_ListOfShape& BOPAlgo_BOP::Generated
+  (const TopoDS_Shape& theS)
 {
   myHistShapes.Clear();
   if (theS.IsNull() || (myOperation != BOPAlgo_SECTION)) {
index 1cd38ed..5d5d272 100644 (file)
@@ -640,7 +640,8 @@ void BOPAlgo_Builder::FillInternalShapes()
   // 1.1 Shapes from pure arguments aMSI 
   // 1.1.1 vertex, edge, wire
   //
-  aIt.Initialize(myArguments);
+  const BOPCol_ListOfShape& aArguments=myDS->Arguments();
+  aIt.Initialize(aArguments);
   for (; aIt.More(); aIt.Next()) {
     const TopoDS_Shape& aS=aIt.Value();
     TreatCompound(aS, aMFence, aLSC);
index 48c77da..04ac50c 100644 (file)
 #include <BOPCol_ListOfShape.hxx>
 #include <BOPCol_MapOfShape.hxx>
 
+#include <BOPDS_DS.hxx>
+
 #include <BOPTools_AlgoTools.hxx>
 #include <BOPTools.hxx>
 
+
 //=======================================================================
 //function : Generated
 //purpose  : 
 //=======================================================================
-  const TopTools_ListOfShape& BOPAlgo_Builder::Generated(const TopoDS_Shape&)
+const TopTools_ListOfShape& BOPAlgo_Builder::Generated
+  (const TopoDS_Shape&)
 {
   myHistShapes.Clear();
   return myHistShapes;
@@ -38,7 +42,8 @@
 //function : Modified
 //purpose  : 
 //=======================================================================
-  const TopTools_ListOfShape& BOPAlgo_Builder::Modified(const TopoDS_Shape& theS)
+const TopTools_ListOfShape& BOPAlgo_Builder::Modified
+  (const TopoDS_Shape& theS)
 {
   Standard_Boolean bHasImage, bToReverse;
   TopAbs_ShapeEnum aType;
@@ -78,7 +83,8 @@
         aSp.Orientation(theS.Orientation());
       }
       else {
-        bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSp, theS, myContext);
+        bToReverse=
+          BOPTools_AlgoTools::IsSplitToReverse(aSp, theS, myContext);
         if (bToReverse) {
           aSp.Reverse();
         }
 //function : IsDeleted
 //purpose  : 
 //=======================================================================
-  Standard_Boolean BOPAlgo_Builder::IsDeleted(const TopoDS_Shape& theS)
+Standard_Boolean BOPAlgo_Builder::IsDeleted
+  (const TopoDS_Shape& theS)
 {
   Standard_Boolean bRet, bHasImage, bContains;
   TopAbs_ShapeEnum aType;
 //function : PrepareHistory
 //purpose  : 
 //=======================================================================
-  void BOPAlgo_Builder::PrepareHistory()
+void BOPAlgo_Builder::PrepareHistory()
 {
   if (!myFlagHistory) {
     return;
   BOPTools::MapShapes(myShape, myMapShape);
   //
   // 3. MS - all argument shapes with theirs sub-shapes
-  aIt.Initialize(myArguments);
+  const BOPCol_ListOfShape& aArguments=myDS->Arguments();
+  aIt.Initialize(aArguments);
   for (; aIt.More(); aIt.Next()) {
     const TopoDS_Shape& aSx=aIt.Value();
     BOPTools::MapShapes(aSx, aMS);
index c3345c1..d7bc828 100644 (file)
@@ -30,6 +30,7 @@ static Standard_Integer bclearobjects (Draw_Interpretor& , Standard_Integer , co
 static Standard_Integer baddtools   (Draw_Interpretor& , Standard_Integer , const char** );
 static Standard_Integer bcleartools (Draw_Interpretor& , Standard_Integer , const char** );
 static Standard_Integer baddcompound(Draw_Interpretor& , Standard_Integer , const char** );
+static Standard_Integer baddctools  (Draw_Interpretor& , Standard_Integer , const char** );
 //
 //=======================================================================
 //function :ObjCommands
@@ -43,11 +44,12 @@ static Standard_Integer baddcompound(Draw_Interpretor& , Standard_Integer , cons
   // Chapter's name
   const char* g = "BOP commands";
   // Commands
-  theCommands.Add("baddobjects"    , "baddobjects s1 s2 ..."    , __FILE__, baddobjects, g);
-  theCommands.Add("bclearobjects"  , "bclearobjects"            , __FILE__, bclearobjects, g);
-  theCommands.Add("baddtools"      , "baddtools s1 s2 ..."      , __FILE__, baddtools, g);
-  theCommands.Add("bcleartools"    , "bcleartools"              , __FILE__, bcleartools, g);
-  theCommands.Add("baddcompound"   , "baddcompound c"           , __FILE__, baddcompound, g);
+  theCommands.Add("baddobjects"    , "baddobjects s1 s2 ..." , __FILE__, baddobjects, g);
+  theCommands.Add("bclearobjects"  , "bclearobjects"         , __FILE__, bclearobjects, g);
+  theCommands.Add("baddtools"      , "baddtools s1 s2 ..."   , __FILE__, baddtools, g);
+  theCommands.Add("bcleartools"    , "bcleartools"           , __FILE__, bcleartools, g);
+  theCommands.Add("baddcompound"   , "baddcompound c"        , __FILE__, baddcompound, g);
+  theCommands.Add("baddctools"     , "baddctools c"          , __FILE__, baddctools, g);
 }
 //=======================================================================
 //function : baddcompound
@@ -74,6 +76,31 @@ Standard_Integer baddcompound (Draw_Interpretor& , Standard_Integer n, const cha
   //
   return 0;
 }
+//=======================================================================
+//function : baddctools
+//purpose  : 
+//=======================================================================
+Standard_Integer baddctools (Draw_Interpretor& , Standard_Integer n, const char** a)
+{
+  if (n<2) {
+    printf(" Use baddctools c\n");
+    return 0;
+  }
+  //
+  TopoDS_Iterator aIt;
+  TopoDS_Shape aS;
+  //
+  aS=DBRep::Get(a[1]);
+  //
+  BOPCol_ListOfShape& aLT=BOPTest_Objects::Tools();
+  aIt.Initialize(aS);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aSx=aIt.Value();
+    aLT.Append(aSx);
+  }
+  //
+  return 0;
+}
 //
 //=======================================================================
 //function :baddobjects
index d01c630..d735a98 100644 (file)
@@ -117,10 +117,10 @@ void BOPTest::PartitionCommands(Draw_Interpretor& theCommands)
   // Chapter's name
   const char* g = "Partition commands";
   // Commands  
-  theCommands.Add("bfillds"  , "use bfillds [-s -t]" , __FILE__, bfillds, g);
-  theCommands.Add("bbuild"   , "use bbuild r [-s -t]", __FILE__, bbuild, g);
-  theCommands.Add("bbop"     , "use bbop r op"       , __FILE__, bbop, g);
-  theCommands.Add("bclear"   , "use bclear"          , __FILE__, bclear, g);
+  theCommands.Add("bfillds", "use bfillds [-s -t]"  , __FILE__, bfillds, g);
+  theCommands.Add("bbuild" , "use bbuild r [-s -t]" , __FILE__, bbuild, g);
+  theCommands.Add("bbop"   , "use bbop r op [-s -t]", __FILE__, bbop, g);
+  theCommands.Add("bclear" , "use bclear"           , __FILE__, bclear, g);
 }
 
 //=======================================================================
@@ -314,8 +314,8 @@ Standard_Integer bbop(Draw_Interpretor& di,
                       Standard_Integer n, 
                       const char** a) 
 { 
-  if (n!=3) {
-    di << " use bbop r op\n";
+  if (n<3) {
+    di << " use bbop r op [-s -t]\n";
     return 0;
   }
   //
@@ -326,16 +326,30 @@ Standard_Integer bbop(Draw_Interpretor& di,
   }
   //
   char buf[32];
-  Standard_Integer iErr, iOp;
+  Standard_Boolean bRunParallel, bShowTime;
+  Standard_Integer iErr, iOp, i;
   BOPAlgo_Operation aOp;
-  BOPCol_ListIteratorOfListOfShape aIt;
+  BOPCol_ListIteratorOfListOfShape aIt; 
+  BOPTime_Chronometer aChrono;
   //
   iOp=Draw::Atoi(a[2]);
   if (iOp<0 || iOp>4) {
     di << " invalid operation type\n";
+    return 0;
   }
   aOp=(BOPAlgo_Operation)iOp;
   //
+  bShowTime=Standard_False;
+  bRunParallel=Standard_True;
+  for (i=3; i<n; ++i) {
+    if (!strcmp(a[i], "-s")) {
+      bRunParallel=Standard_False;
+    }
+    else if (!strcmp(a[i], "-t")) {
+      bShowTime=Standard_True;
+    }
+  }
+  //
   BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
   //
   BOPAlgo_BOP& aBOP=BOPTest_Objects::BOP();
@@ -356,6 +370,9 @@ Standard_Integer bbop(Draw_Interpretor& di,
   }
   //
   aBOP.SetOperation(aOp);
+  aBOP.SetRunParallel(bRunParallel);
+  //
+  aChrono.Start();
   //
   aBOP.PerformWithFiller(aPF);
   iErr=aBOP.ErrorStatus();
@@ -365,6 +382,16 @@ Standard_Integer bbop(Draw_Interpretor& di,
     return 0;
   }
   //
+  aChrono.Stop();
+  //
+  if (bShowTime) {
+    Standard_Real aTime;
+    //
+    aTime=aChrono.Time();
+    Sprintf(buf, "  Tps: %7.2lf\n", aTime);
+    di << buf;
+  }
+  //
   const TopoDS_Shape& aR=aBOP.Shape();
   if (aR.IsNull()) {
     di << " null shape\n";
index 6437b6e..7a24330 100644 (file)
   void BRepFeat_Builder::FillRemoved()
 {
   TopExp_Explorer aExp;
-  aExp.Init(myArgs[0], TopAbs_SOLID);
+  //
+  const TopoDS_Shape& aArgs0=myArguments.First();
+  const TopoDS_Shape& aArgs1=myTools.First();
+  //
+  aExp.Init(aArgs0, TopAbs_SOLID);
   for (; aExp.More(); aExp.Next()) {
     const TopoDS_Shape& aS = aExp.Current();
     myImages.UnBind(aS);
   }
   //
-  if (!myImages.IsBound(myArgs[1])) {
+  if (!myImages.IsBound(aArgs1)) {
     return;
   }
   //
   BOPCol_ListIteratorOfListOfShape aItIm;
   //
-  BOPCol_ListOfShape& aLS = myImages.ChangeFind(myArgs[1]);
+  BOPCol_ListOfShape& aLS = myImages.ChangeFind(aArgs1);
   aItIm.Initialize(aLS);
   for (; aItIm.More(); aItIm.Next()) {
     const TopoDS_Shape& aS = aItIm.Value();
   BOPCol_ListIteratorOfListOfShape aIt;
   TopExp_Explorer aExp, aExpF;
   Standard_Boolean bFlagSD;
+  // 
+  const TopoDS_Shape& aArgs0=myArguments.First();
+  const TopoDS_Shape& aArgs1=myTools.First();
   //
-  const BOPCol_ListOfShape& aLSIm = myImages.Find(myArgs[1]);
+  const BOPCol_ListOfShape& aLSIm = myImages.Find(aArgs1);
   aIt.Initialize(aLSIm);
   for(;aIt.More();aIt.Next()) {
     const TopoDS_Shape& aSolIm = aIt.Value();
     aMST.Add(aST);
   }
   //
-  aExp.Init(myArgs[0], TopAbs_SOLID);
+  aExp.Init(aArgs0, TopAbs_SOLID);
   for(; aExp.More(); aExp.Next()) {
     const TopoDS_Shape& aSolid = aExp.Current();
     if (myImages.IsBound(aSolid)) {
index d3f2402..7e0b90f 100644 (file)
@@ -56,14 +56,15 @@ static void BoxParameters(const TopoDS_Shape&,
 
 void BRepFeat_MakeCylindricalHole::Perform(const Standard_Real Radius)
 {
-  if (Object().IsNull() || !myAxDef) {
+  const TopoDS_Shape& aObject=myArguments.First();
+  if (aObject.IsNull() || !myAxDef) {
     Standard_ConstructionError::Raise();
   }
 
   myIsBlind = Standard_False;
   myStatus = BRepFeat_NoError;
 
-  LocOpe_CurveShapeIntersector theASI(myAxis,Object());
+  LocOpe_CurveShapeIntersector theASI(myAxis,aObject);
   if (!theASI.IsDone() || theASI.NbPoints() <= 0) {
     myStatus = BRepFeat_InvalidPlacement;
     return;
@@ -76,7 +77,7 @@ void BRepFeat_MakeCylindricalHole::Perform(const Standard_Real Radius)
 
   // It is not possible to use infinite cylinder for topological operations.
   Standard_Real PMin,PMax;
-  BoxParameters(Object(),myAxis,PMin,PMax);
+  BoxParameters(aObject,myAxis,PMin,PMax);
   Standard_Real Heigth = 2.*(PMax-PMin);
   gp_XYZ theOrig = myAxis.Location().XYZ();
   theOrig += ((3.*PMin-PMax)/2.) * myAxis.Direction().XYZ();
@@ -102,9 +103,7 @@ void BRepFeat_MakeCylindricalHole::Perform(const Standard_Real Radius)
   //
   AddTool(theTool);
   SetOperation(Fuse);
-  BOPAlgo_Builder::Perform();
-  //myBuilder.Perform(theTool,theList,Fuse);
-//  myBuilder.PerformResult();
+  BOPAlgo_BOP::Perform();
 }
 
 
@@ -116,8 +115,9 @@ void BRepFeat_MakeCylindricalHole::Perform(const Standard_Real Radius)
 void BRepFeat_MakeCylindricalHole::PerformThruNext(const Standard_Real Radius,
                                                    const Standard_Boolean Cont)
 {
-
-  if (Object().IsNull() || !myAxDef) {
+  //
+  const TopoDS_Shape& aObject=myArguments.First();
+  if (aObject.IsNull() || !myAxDef) {
     Standard_ConstructionError::Raise();
   }
 
@@ -125,7 +125,7 @@ void BRepFeat_MakeCylindricalHole::PerformThruNext(const Standard_Real Radius,
   myValidate = Cont;
   myStatus = BRepFeat_NoError;
 
-  LocOpe_CurveShapeIntersector theASI(myAxis,Object());
+  LocOpe_CurveShapeIntersector theASI(myAxis,aObject);
   if (!theASI.IsDone()) {
     myStatus = BRepFeat_InvalidPlacement;
     return;
@@ -180,7 +180,7 @@ void BRepFeat_MakeCylindricalHole::PerformThruNext(const Standard_Real Radius,
 
   // It is not possible to use infinite cylinder for topological operations.
   Standard_Real PMin,PMax;
-  BoxParameters(Object(),myAxis,PMin,PMax);
+  BoxParameters(aObject,myAxis,PMin,PMax);
   Standard_Real Heigth = 2.*(PMax-PMin);
   gp_XYZ theOrig = myAxis.Location().XYZ();
   theOrig += ((3.*PMin-PMax)/2.) * myAxis.Direction().XYZ();
@@ -274,8 +274,9 @@ void BRepFeat_MakeCylindricalHole::PerformThruNext(const Standard_Real Radius,
 void BRepFeat_MakeCylindricalHole::PerformUntilEnd(const Standard_Real Radius,
                                                    const Standard_Boolean Cont)
 {
-
-  if (Object().IsNull() || !myAxDef) {
+  //
+  const TopoDS_Shape& aObject=myArguments.First();
+  if (aObject.IsNull() || !myAxDef) {
     Standard_ConstructionError::Raise();
   }
 
@@ -283,7 +284,7 @@ void BRepFeat_MakeCylindricalHole::PerformUntilEnd(const Standard_Real Radius,
   myValidate = Cont;
   myStatus = BRepFeat_NoError;
 
-  LocOpe_CurveShapeIntersector theASI(myAxis,Object());
+  LocOpe_CurveShapeIntersector theASI(myAxis,aObject);
   if (!theASI.IsDone()) {
     myStatus = BRepFeat_InvalidPlacement;
     return;
@@ -330,7 +331,7 @@ void BRepFeat_MakeCylindricalHole::PerformUntilEnd(const Standard_Real Radius,
 
   // It is not possible to use infinite cylinder for topological operations.
   Standard_Real PMin,PMax;
-  BoxParameters(Object(),myAxis,PMin,PMax);
+  BoxParameters(aObject,myAxis,PMin,PMax);
   Standard_Real Heigth = 2.*(PMax-PMin);
   gp_XYZ theOrig = myAxis.Location().XYZ();
   theOrig += ((3.*PMin-PMax)/2.) * myAxis.Direction().XYZ();
@@ -392,8 +393,9 @@ void BRepFeat_MakeCylindricalHole::Perform(const Standard_Real Radius,
                                            const Standard_Real PTo,
                                            const Standard_Boolean Cont)
 {
-
-  if (Object().IsNull() || !myAxDef) {
+  //
+  const TopoDS_Shape& aObject=myArguments.First();
+  if (aObject.IsNull() || !myAxDef) {
     Standard_ConstructionError::Raise();
   }
 
@@ -401,7 +403,7 @@ void BRepFeat_MakeCylindricalHole::Perform(const Standard_Real Radius,
   myValidate = Cont;
   myStatus = BRepFeat_NoError;
 
-  LocOpe_CurveShapeIntersector theASI(myAxis,Object());
+  LocOpe_CurveShapeIntersector theASI(myAxis,aObject);
   if (!theASI.IsDone()) {
     myStatus = BRepFeat_InvalidPlacement;
     return;
@@ -458,7 +460,7 @@ void BRepFeat_MakeCylindricalHole::Perform(const Standard_Real Radius,
 
   // // It is not possible to use infinite cylinder for topological operations.
   Standard_Real PMin,PMax;
-  BoxParameters(Object(),myAxis,PMin,PMax);
+  BoxParameters(aObject,myAxis,PMin,PMax);
   Standard_Real Heigth = 2.*(PMax-PMin);
   gp_XYZ theOrig = myAxis.Location().XYZ();
   theOrig += ((3.*PMin-PMax)/2.) * myAxis.Direction().XYZ();
@@ -522,8 +524,9 @@ void BRepFeat_MakeCylindricalHole::PerformBlind(const Standard_Real Radius,
                                                 const Standard_Real Length,
                                                 const Standard_Boolean Cont)
 {
-
-  if (Object().IsNull() || !myAxDef || Length <= 0.) {
+  //
+  const TopoDS_Shape& aObject=myArguments.First();
+  if (aObject.IsNull() || !myAxDef || Length <= 0.) {
     Standard_ConstructionError::Raise();
   }
 
@@ -531,7 +534,7 @@ void BRepFeat_MakeCylindricalHole::PerformBlind(const Standard_Real Radius,
   myValidate = Cont;
   myStatus = BRepFeat_NoError;
 
-  LocOpe_CurveShapeIntersector theASI(myAxis,Object());
+  LocOpe_CurveShapeIntersector theASI(myAxis,aObject);
   if (!theASI.IsDone()) {
     myStatus = BRepFeat_InvalidPlacement;
     return;
@@ -582,7 +585,7 @@ void BRepFeat_MakeCylindricalHole::PerformBlind(const Standard_Real Radius,
 
   //// It is not possible to use infinite cylinder for topological operations.
   Standard_Real PMin,PMax;
-  BoxParameters(Object(),myAxis,PMin,PMax);
+  BoxParameters(aObject,myAxis,PMin,PMax);
   if (PMin > Length) {
     myStatus = BRepFeat_InvalidPlacement;
     return;
old mode 100644 (file)
new mode 100755 (executable)
index c1b65e0..eae2028
@@ -3,4 +3,4 @@ restore [locate_data_file case_1_wire3.brep] b
 bcommon result b a
 set length 942.478
 set nbsh_v 2
-set nbsh_e 4
+set nbsh_e 2
old mode 100644 (file)
new mode 100755 (executable)
index 0416f3a..79df60b
@@ -3,4 +3,4 @@ restore [locate_data_file case_1_wire3.brep] b
 bcommon result b a
 set length 942.478
 set nbsh_v 2
-set nbsh_e 4
+set nbsh_e 2
old mode 100644 (file)
new mode 100755 (executable)
index 38d15b6..5a83db8
@@ -4,4 +4,4 @@ bop a b
 bopcommon result
 set length 942.478
 set nbsh_v 2
-set nbsh_e 4
+set nbsh_e 2
old mode 100644 (file)
new mode 100755 (executable)
index 1184d19..b58c041
@@ -4,4 +4,4 @@ bop a b
 bopcommon result
 set length 942.478
 set nbsh_v 2
-set nbsh_e 4
+set nbsh_e 2
diff --git a/tests/bugs/modalg_5/bug24825_common b/tests/bugs/modalg_5/bug24825_common
new file mode 100644 (file)
index 0000000..16adc18
--- /dev/null
@@ -0,0 +1,58 @@
+puts "========="
+puts "OCC24825"
+puts "========="
+puts ""
+###########################################################
+# Fit Boolean Operation Algorithm to treat multiple arguments.
+###########################################################
+
+restore [locate_data_file bug24825_steering-wheel-ring1.brep] b1
+restore [locate_data_file bug24825_steering-wheel-ring2.brep] b2
+restore [locate_data_file bug24825_steering-wheel-drum.brep] b4
+restore [locate_data_file bug24825_steering-wheel-handle.brep] hb
+
+set qs {}
+
+set N 10
+set N1 [expr 360. / $N ]
+for {set i 0} {$i < $N} {incr i} {
+  tcopy hb hb_${i}
+  trotate hb_${i} 0. 0. 0. 0. 0. 1. [expr $i * $N1 ]  
+  lappend qs hb_${i}
+}
+eval compound $qs b3
+
+tcopy b1 b5
+ttranslate b5 0 0 100
+
+tcopy b2 b6
+ttranslate b6 0 0 100
+
+tcopy b3 b7
+ttranslate b7 0 0 100
+
+#-common-#
+
+bclearobjects
+bcleartools
+baddobjects b2 b6 b4 b1 b5 
+baddctools b3
+baddctools b7
+
+bfillds
+bbop result 0
+
+set square 10008.5
+
+set nb_v_good 86
+set nb_e_good 132
+set nb_w_good 126
+set nb_f_good 126
+set nb_sh_good 40
+set nb_sol_good 40
+set nb_compsol_good 0
+set nb_compound_good 1
+set nb_shape_good 551
+
+set 2dviewer 1
diff --git a/tests/bugs/modalg_5/bug24825_cut b/tests/bugs/modalg_5/bug24825_cut
new file mode 100644 (file)
index 0000000..4b40448
--- /dev/null
@@ -0,0 +1,58 @@
+puts "========="
+puts "OCC24825"
+puts "========="
+puts ""
+###########################################################
+# Fit Boolean Operation Algorithm to treat multiple arguments.
+###########################################################
+
+restore [locate_data_file bug24825_steering-wheel-ring1.brep] b1
+restore [locate_data_file bug24825_steering-wheel-ring2.brep] b2
+restore [locate_data_file bug24825_steering-wheel-drum.brep] b4
+restore [locate_data_file bug24825_steering-wheel-handle.brep] hb
+
+set qs {}
+
+set N 10
+set N1 [expr 360. / $N ]
+for {set i 0} {$i < $N} {incr i} {
+  tcopy hb hb_${i}
+  trotate hb_${i} 0. 0. 0. 0. 0. 1. [expr $i * $N1 ]  
+  lappend qs hb_${i}
+}
+eval compound $qs b3
+
+tcopy b1 b5
+ttranslate b5 0 0 100
+
+tcopy b2 b6
+ttranslate b6 0 0 100
+
+tcopy b3 b7
+ttranslate b7 0 0 100
+
+#-cut-#
+
+bclearobjects
+bcleartools
+baddobjects b2 b6 b4 b1 b5 
+baddctools b3
+baddctools b7
+
+bfillds
+bbop result 2
+
+set square 103838
+
+set nb_v_good 106
+set nb_e_good 164
+set nb_w_good 142
+set nb_f_good 80
+set nb_sh_good 3
+set nb_sol_good 3
+set nb_compsol_good 0
+set nb_compound_good 1
+set nb_shape_good 499
+
+set 2dviewer 1
diff --git a/tests/bugs/modalg_5/bug24825_fuse b/tests/bugs/modalg_5/bug24825_fuse
new file mode 100644 (file)
index 0000000..a3f9aad
--- /dev/null
@@ -0,0 +1,59 @@
+puts "========="
+puts "OCC24825"
+puts "========="
+puts ""
+###########################################################
+# Fit Boolean Operation Algorithm to treat multiple arguments.
+###########################################################
+
+restore [locate_data_file bug24825_steering-wheel-ring1.brep] b1
+restore [locate_data_file bug24825_steering-wheel-ring2.brep] b2
+restore [locate_data_file bug24825_steering-wheel-drum.brep] b4
+restore [locate_data_file bug24825_steering-wheel-handle.brep] hb
+
+set qs {}
+
+set N 10
+set N1 [expr 360. / $N ]
+for {set i 0} {$i < $N} {incr i} {
+  tcopy hb hb_${i}
+  trotate hb_${i} 0. 0. 0. 0. 0. 1. [expr $i * $N1 ]  
+  lappend qs hb_${i}
+}
+eval compound $qs b3
+
+tcopy b1 b5
+ttranslate b5 0 0 100
+
+tcopy b2 b6
+ttranslate b6 0 0 100
+
+tcopy b3 b7
+ttranslate b7 0 0 100
+
+#-fuse-#
+
+bclearobjects
+bcleartools
+baddobjects b2 b6 b4
+baddtools b1 b5 
+baddctools b3
+baddctools b7
+
+bfillds
+bbop result 1
+
+set square 157211
+
+set nb_v_good 106
+set nb_e_good 164
+set nb_w_good 142
+set nb_f_good 80
+set nb_sh_good 1
+set nb_sol_good 1
+set nb_compsol_good 0
+set nb_compound_good 1
+set nb_shape_good 495
+
+set 2dviewer 1