0025614: Provide API access to the new fuctionalities of Boolean Components
authorpkv <pkv@opencascade.com>
Thu, 25 Dec 2014 14:55:02 +0000 (17:55 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 25 Dec 2014 14:55:50 +0000 (17:55 +0300)
I. New features:
1.1. class BOPAlgo_PaveFiller
method:
void BOPAlgo_PaveFiller::SetArguments(const TopTools_ListOfShape& theLS)
has been added to provide the setting argumemts  through
TopTools_ListOfShape

1.2. class BOPAlgo_Builder
method:
void BOPAlgo_Builder::SetArguments(const TopTools_ListOfShape& theLS)
has been added to provide the setting argumemts  through
TopTools_ListOfShape

1.3. class BOPAlgo_BOP
method:
void BOPAlgo_BOP::SetTools(const TopTools_ListOfShape& theLS)
has been added to provide the setting tools through
TopTools_ListOfShape

1.4. class BRepAlgoAPI_BuilderAlgo
construcror:
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo
  (const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

method:
void BRepAlgoAPI_BuilderAlgo::SetArguments
 (const TopTools_ListOfShape& theLS)
has been added to provide the setting argumemts

method:
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Arguments()const
has been added to provide access to the argumemts

1.5. class BRepAlgoAPI_BooleanOperation
method:
void BRepAlgoAPI_BooleanOperation::SetTools
  (const TopTools_ListOfShape& theLS)
has been added to provide the setting tools

method:
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Tools()const
has been added to provide access to the tools

1.6. class BRepAlgoAPI_Common
construcror:
BRepAlgoAPI_Common::BRepAlgoAPI_Common
(const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

1.7. class BRepAlgoAPI_Cut
construcror:
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut
(const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

1.8. class BRepAlgoAPI_Fuse
construcror:
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse
(const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

1.9. class BRepAlgoAPI_Section
construcror:
BRepAlgoAPI_Section::BRepAlgoAPI_Section
(const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

1.10. class BOPTest
method:
void BOPTest::APICommands(Draw_Interpretor& theCommands)
has been added to provide tcl commands to launch the algorithms
implemented in BRepAlgoAPI package using DRAWEXE application.

Commands:
 >bapibuild r
   performs General Fuse algorithm.
     r -the result of the operation

 >bapibop r type
   performs Boolean Operation agorithm
      r -the result of the operation
      type -type of the operation:
        0-common
        1-fuse
        2-cut
        3-cut21
        4-section

method:
void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
has been added to provide tcl commands to set/get the options that is
necessary for the algorithms implemented in BRepAlgoAPI package.

Commands:
 >boptions
   dump the state of current options

  >brunparallel [0/1]
   1 -sets the parallel mode of the computations
   0 -sets the sequential mode of the computations

  >bfuzzyvalue value
    sets the fuzzy value

-------------------------------------------------------------------------------------------------------------
II. Changes:
II.1. class BRepAlgoAPI_BuilderAlgo
methods:
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Generated
  (const TopoDS_Shape& aS)
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Modified
  (const TopoDS_Shape& aS)
Standard_Boolean BRepAlgoAPI_BuilderAlgo::IsDeleted
  (const TopoDS_Shape& aS)
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasModified() const
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasGenerated() const
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasDeleted() const
has been redefined to provide access to the history

II.1. class BOPTest
method:
void BOPTest::APICommands(Draw_Interpretor& theCommands)
has been added to provide tcl commands to launch the algorithms
implemented in BRepAlgoAPI package using DRAWEXE application.

method:
void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
has been added to provide tcl commands to set/get the options that is
necessary for the algorithms implemented in BRepAlgoAPI package.

II.2. class BRepAlgoAPI
method:
void BRepAlgoAPI::DumpOper(const Standard_CString theFilePath,
                           const TopoDS_Shape& theShape1,
                           const TopoDS_Shape& theShape2,
                           const TopoDS_Shape& theResult,
                           BOPAlgo_Operation theOperation,
                           Standard_Boolean isNonValidArgs)
has been removed. The contents has been shifted into the file:
BRepAlgoAPI_BooleanOperation.cxx

II.3. classes QANewModTopOpe_Glue, QANewModTopOpe_Intersection
the modifications have been done to provide the consistency with the
modifications in BRepAlgoAPI package [I].
-------------------------------------------------------------------------------------------------------------
III. Modified entities:
packages:
BOPAlgo
BRepAlgoAPI
BOPTest
QANewModTopOpe

Test cases for issue CR25614

44 files changed:
src/BOPAlgo/BOPAlgo_BOP.cdl
src/BOPAlgo/BOPAlgo_BOP.cxx
src/BOPAlgo/BOPAlgo_Builder.cdl
src/BOPAlgo/BOPAlgo_Builder.cxx
src/BOPAlgo/BOPAlgo_PaveFiller.cdl
src/BOPAlgo/BOPAlgo_PaveFiller.cxx
src/BOPTest/BOPTest.cdl
src/BOPTest/BOPTest.cxx
src/BOPTest/BOPTest_APICommands.cxx [new file with mode: 0644]
src/BOPTest/BOPTest_BOPCommands.cxx
src/BOPTest/BOPTest_Objects.cdl
src/BOPTest/BOPTest_Objects.cxx
src/BOPTest/BOPTest_OptionCommands.cxx [new file with mode: 0644]
src/BOPTest/BOPTest_PartitionCommands.cxx
src/BOPTest/FILES
src/BRepAlgoAPI/BRepAlgoAPI.cdl
src/BRepAlgoAPI/BRepAlgoAPI.cxx [deleted file]
src/BRepAlgoAPI/BRepAlgoAPI_Algo.cdl
src/BRepAlgoAPI/BRepAlgoAPI_Algo.cxx
src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cdl
src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx
src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cdl
src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx
src/BRepAlgoAPI/BRepAlgoAPI_Common.cdl
src/BRepAlgoAPI/BRepAlgoAPI_Common.cxx
src/BRepAlgoAPI/BRepAlgoAPI_Cut.cdl
src/BRepAlgoAPI/BRepAlgoAPI_Cut.cxx
src/BRepAlgoAPI/BRepAlgoAPI_Fuse.cdl
src/BRepAlgoAPI/BRepAlgoAPI_Fuse.cxx
src/BRepAlgoAPI/BRepAlgoAPI_Section.cdl
src/BRepAlgoAPI/BRepAlgoAPI_Section.cxx
src/QANewModTopOpe/QANewModTopOpe_Glue.cxx
src/QANewModTopOpe/QANewModTopOpe_Glue_SDFaces.cxx
src/QANewModTopOpe/QANewModTopOpe_Glue_shell.cxx
src/QANewModTopOpe/QANewModTopOpe_Glue_vertex.cxx
src/QANewModTopOpe/QANewModTopOpe_Glue_wire.cxx
src/QANewModTopOpe/QANewModTopOpe_Intersection.cdl
src/QANewModTopOpe/QANewModTopOpe_Intersection.cxx
tests/bugs/modalg_5/bug25614_common [new file with mode: 0755]
tests/bugs/modalg_5/bug25614_cut [new file with mode: 0755]
tests/bugs/modalg_5/bug25614_cut21 [new file with mode: 0755]
tests/bugs/modalg_5/bug25614_fuse [new file with mode: 0755]
tests/bugs/modalg_5/bug25614_genfuse [new file with mode: 0755]
tests/bugs/modalg_5/bug25614_section [new file with mode: 0755]

index 7fa98ae..71404a8 100644 (file)
@@ -49,8 +49,16 @@ is
     AddTool (me:out;  
             theShape: Shape from TopoDS) 
     ---Purpose:  Adds Tool argument of the operation                
+        is virtual;  
+        
+    SetTools (me:out;
+            theShapes: ListOfShape from TopTools)
+        is virtual;  
+         
+    SetTools (me:out;
+            theShapes: ListOfShape from BOPCol)
         is virtual; 
-
     SetOperation(me:out;  
             theOperation: Operation from BOPAlgo); 
         
index e05cd20..ec88eab 100644 (file)
@@ -43,6 +43,7 @@
 #include <BOPTools_Set.hxx>
 #include <BOPTools_SetMapHasher.hxx>
 #include <NCollection_DataMap.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
 
 typedef NCollection_DataMap  
   <BOPTools_Set, 
@@ -129,6 +130,36 @@ void BOPAlgo_BOP::AddTool(const TopoDS_Shape& theShape)
   }
 }
 //=======================================================================
+//function : SetTools
+//purpose  : 
+//=======================================================================
+void BOPAlgo_BOP::SetTools(const TopTools_ListOfShape& theShapes)
+{
+  TopTools_ListIteratorOfListOfShape aIt;
+  //
+  myTools.Clear();
+  aIt.Initialize(theShapes);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aS = aIt.Value();
+    AddTool(aS);
+  }
+}
+//=======================================================================
+//function : SetTools
+//purpose  : 
+//=======================================================================
+void BOPAlgo_BOP::SetTools(const BOPCol_ListOfShape& theShapes)
+{
+  BOPCol_ListIteratorOfListOfShape aIt;
+  //
+  myTools.Clear();
+  aIt.Initialize(theShapes);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aS = aIt.Value();
+    AddTool(aS);
+  }
+}
+//=======================================================================
 //function : CheckData
 //purpose  : 
 //=======================================================================
index e7bfc23..4eb2798 100644 (file)
@@ -59,15 +59,18 @@ is
       returns PDS from BOPDS;
  
     AddArgument (me:out;  
-        theShape: Shape from TopoDS) 
-    is virtual; 
+            theShape: Shape from TopoDS) 
+        is virtual; 
  
+    SetArguments(me:out; 
+            theLS:ListOfShape from TopTools);  
+
     SetArguments (me:out;
-        theShapes: ListOfShape from BOPCol)
-    is virtual;
+            theLS: ListOfShape from BOPCol)
+        is virtual;
 
     Arguments(me) 
-    returns ListOfShape from BOPCol; 
+        returns ListOfShape from BOPCol; 
     ---C++: return const & 
       
         
index 0726dec..5307af8 100644 (file)
@@ -26,6 +26,7 @@
 #include <BRep_Builder.hxx>
 
 #include <BOPTools_AlgoTools.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
 
 //=======================================================================
 //function : 
@@ -106,10 +107,28 @@ void BOPAlgo_Builder::AddArgument(const TopoDS_Shape& theShape)
 //function : SetArguments
 //purpose  : 
 //=======================================================================
+void BOPAlgo_Builder::SetArguments(const TopTools_ListOfShape& theShapes)
+{
+  TopTools_ListIteratorOfListOfShape aIt;
+  //
+  myArguments.Clear();
+  //
+  aIt.Initialize(theShapes);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aS = aIt.Value();
+    AddArgument(aS);
+  }
+}
+//=======================================================================
+//function : SetArguments
+//purpose  : 
+//=======================================================================
 void BOPAlgo_Builder::SetArguments(const BOPCol_ListOfShape& theShapes)
 {
   BOPCol_ListIteratorOfListOfShape aIt;
   //
+  myArguments.Clear();
+  //
   aIt.Initialize(theShapes);
   for (; aIt.More(); aIt.Next()) {
     const TopoDS_Shape& aS = aIt.Value();
index 2e615c0..63d5694 100644 (file)
@@ -24,7 +24,9 @@ uses
     ShapeEnum from TopAbs,  
     Vertex from TopoDS,
     Face from TopoDS, 
-    Edge from TopoDS,
+    Edge from TopoDS,  
+        
+    ListOfShape from TopTools,
      
     BaseAllocator from BOPCol, 
     ListOfShape from BOPCol, 
@@ -81,10 +83,15 @@ is
       returns PIterator from BOPDS;  
     ---C++:return const & 
      
+    SetArguments(me:out; 
+            theLS:ListOfShape from BOPCol);   
+            
+    SetArguments(me:out; 
+            theLS:ListOfShape from TopTools);  
+
     Arguments(me) 
       returns ListOfShape from BOPCol; 
     ---C++: return const & 
-    ---C++: alias "Standard_EXPORT void SetArguments(const BOPCol_ListOfShape& theLS);" 
 
     Context(me:out) 
       returns Context from IntTools;  
@@ -127,7 +134,6 @@ is
     PerformFF(me:out) 
       is virtual protected;
      
-    --modified by NIZNHY-PKV Fri Sep 12 07:05:37 2014f 
     PerformVZ(me:out) 
       is virtual protected; 
        --Purpose: Computes Vertex/Solid interferences 
@@ -142,7 +148,6 @@ is
     PerformZZ(me:out) 
       is virtual protected;  
       --Purpose: Computes Solid/Solid interferences  
-    --modified by NIZNHY-PKV Fri Sep 12 07:05:45 2014t 
  
     TreatVerticesEE(me:out) 
       is protected; 
index 1114acf..fa1b96c 100644 (file)
@@ -25,6 +25,7 @@
 #include <IntTools_Context.hxx>
 #include <BOPDS_DS.hxx>
 #include <BOPDS_Iterator.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
 
 
 //=======================================================================
@@ -112,6 +113,21 @@ void BOPAlgo_PaveFiller::SetSectionAttribute
 //function : SetArguments
 //purpose  : 
 //=======================================================================
+void BOPAlgo_PaveFiller::SetArguments(const TopTools_ListOfShape& theLS)
+{
+  TopTools_ListIteratorOfListOfShape aItLS;
+  //
+  myArguments.Clear();
+  aItLS.Initialize(theLS);
+  for (; aItLS.More(); aItLS.Next()) {
+    const TopoDS_Shape& aS=aItLS.Value();
+    myArguments.Append(aS);
+  }
+}
+//=======================================================================
+//function : SetArguments
+//purpose  : 
+//=======================================================================
 void BOPAlgo_PaveFiller::SetArguments(const BOPCol_ListOfShape& theLS)
 {
   myArguments=theLS;
index 731d73a..8121dc3 100644 (file)
@@ -12,7 +12,7 @@
 --
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
-
 package BOPTest 
 ---Purpose: 
 
@@ -39,6 +39,8 @@ is
     LowCommands        (aDI:out Interpretor from Draw); 
     ObjCommands        (aDI:out Interpretor from Draw);
     PartitionCommands  (aDI:out Interpretor from Draw);
+    APICommands        (aDI:out Interpretor from Draw); 
+    OptionCommands     (aDI:out Interpretor from Draw); 
     Factory            (aDI:out Interpretor from Draw);
     
 end BOPTest;
index 455e61b..b986f7b 100644 (file)
@@ -20,9 +20,7 @@
 #include <GeometryTest.hxx>
 #include <BRepTest.hxx>
 #include <MeshTest.hxx>
-//#include <CorrectTest.hxx>
 #include <HLRTest.hxx>
-//#include <stdio.h>
 
 //=======================================================================
 //function : AllCommands
@@ -40,6 +38,8 @@ void  BOPTest::AllCommands(Draw_Interpretor& theCommands)
   BOPTest::TolerCommands     (theCommands);
   BOPTest::ObjCommands       (theCommands);
   BOPTest::PartitionCommands (theCommands);
+  BOPTest::APICommands      (theCommands);
+  BOPTest::OptionCommands   (theCommands);
 }
 //=======================================================================
 //function : Factory
@@ -57,10 +57,6 @@ void  BOPTest::AllCommands(Draw_Interpretor& theCommands)
   GeometryTest::AllCommands(theCommands);
   BRepTest::AllCommands(theCommands);
   MeshTest::Commands(theCommands);
-  //CorrectTest::CorrectCommands(theCommands);
   HLRTest::Commands(theCommands);
   BOPTest::AllCommands(theCommands);
-  //printf(" BOP Plugin is loaded\n");
 }
-//#include <Draw_PluginMacro.hxx>
-//DPLUGIN(BOPTest)
diff --git a/src/BOPTest/BOPTest_APICommands.cxx b/src/BOPTest/BOPTest_APICommands.cxx
new file mode 100644 (file)
index 0000000..772bed1
--- /dev/null
@@ -0,0 +1,217 @@
+// Created by: Peter KURNEV
+// Copyright (c) 2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// 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.
+
+#include <BOPTest.ixx>
+
+#include <stdio.h>
+#include <string.h>
+
+#include <DBRep.hxx>
+#include <Draw.hxx>
+
+#include <TopoDS_Shape.hxx>
+
+#include <TopTools_ListOfShape.hxx>
+
+#include <BOPCol_ListOfShape.hxx>
+#include <BOPTest_Objects.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+
+#include <BRepAlgoAPI_BooleanOperation.hxx>
+#include <BRepAlgoAPI_BuilderAlgo.hxx>
+#include <BRepAlgoAPI_Common.hxx>
+#include <BRepAlgoAPI_Fuse.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepAlgoAPI_Section.hxx>
+
+static 
+  void ConvertList(const BOPCol_ListOfShape& aLSB,
+                   TopTools_ListOfShape& aLS);
+
+static Standard_Integer bapibuild(Draw_Interpretor&, Standard_Integer, const char**); 
+static Standard_Integer bapibop  (Draw_Interpretor&, Standard_Integer, const char**); 
+
+//=======================================================================
+//function : APICommands
+//purpose  : 
+//=======================================================================
+void BOPTest::APICommands(Draw_Interpretor& theCommands)
+{
+  static Standard_Boolean done = Standard_False;
+  if (done) return;
+  done = Standard_True;
+  // Chapter's name
+  const char* g = "Partition commands";
+  // Commands  
+  theCommands.Add("bapibuild", "use bapibuild r" , __FILE__, bapibuild, g);
+  theCommands.Add("bapibop", "use bapibop r type" , __FILE__, bapibop, g);
+}
+//=======================================================================
+//function : bapibop
+//purpose  : 
+//=======================================================================
+Standard_Integer bapibop(Draw_Interpretor& di,
+                         Standard_Integer n, 
+                         const char** a) 
+{ 
+  if (n<3) {
+    di << " use bapibop r type\n";
+    return 0;
+  }
+  //
+  char buf[128];
+  Standard_Boolean bRunParallel;
+  Standard_Integer iErr, iOp;
+  Standard_Real aFuzzyValue;
+  BRepAlgoAPI_Common aCommon;
+  BRepAlgoAPI_Fuse aFuse;
+  BRepAlgoAPI_Cut aCut;
+  BRepAlgoAPI_Section aSection;
+  BRepAlgoAPI_BooleanOperation *pBuilder;
+  BOPAlgo_Operation aOp;
+  //
+  pBuilder=NULL;
+  iOp=atoi(a[2]);
+  if (iOp<0 || iOp>4) {
+    printf(" invalid operation type\n");
+    return 0;
+  }
+  aOp=(BOPAlgo_Operation)iOp;
+  //
+  switch (aOp) {
+   case BOPAlgo_COMMON:
+     pBuilder=&aCommon;
+     break;
+     //
+   case BOPAlgo_FUSE:
+     pBuilder=&aFuse;
+     break;
+     //
+   case BOPAlgo_CUT:
+   case BOPAlgo_CUT21:
+     pBuilder=&aCut;
+     break;
+     //
+   case BOPAlgo_SECTION:
+     pBuilder=&aSection;
+     break;
+     //
+   default:
+     break;
+  }
+  //
+  BOPCol_ListOfShape& aLSB=BOPTest_Objects::Shapes();
+  BOPCol_ListOfShape& aLTB=BOPTest_Objects::Tools();
+  //
+  TopTools_ListOfShape aLS, aLT;
+  ConvertList(aLSB, aLS);
+  ConvertList(aLTB, aLT);
+  //
+  bRunParallel=BOPTest_Objects::RunParallel();
+  aFuzzyValue=BOPTest_Objects::FuzzyValue();
+  //
+  if (aOp!=BOPAlgo_CUT21) {
+    pBuilder->SetArguments(aLS);
+    pBuilder->SetTools(aLT);
+  }
+  else {
+    pBuilder->SetArguments(aLT);
+    pBuilder->SetTools(aLS);
+  }
+  //
+  pBuilder->SetRunParallel(bRunParallel);
+  pBuilder->SetFuzzyValue(aFuzzyValue);
+  //
+  pBuilder->Build(); 
+  iErr=pBuilder->ErrorStatus();
+  if (iErr) {
+    Sprintf(buf, " error: %d\n",  iErr);
+    di << buf;
+    return 0;
+  }
+  //
+  const TopoDS_Shape& aR=pBuilder->Shape();
+  if (aR.IsNull()) {
+    di << " null shape\n";
+    return 0;
+  }
+  //
+  DBRep::Set(a[1], aR);
+  return 0;
+}
+//=======================================================================
+//function : bapibuild
+//purpose  : 
+//=======================================================================
+Standard_Integer bapibuild(Draw_Interpretor& di,
+                        Standard_Integer n, 
+                        const char** a) 
+{ 
+  if (n<2) {
+    di << " use bapibuild r\n";
+    return 0;
+  }
+  //
+  char buf[128];
+  Standard_Boolean bRunParallel;
+  Standard_Integer iErr;
+  Standard_Real aFuzzyValue;
+  BRepAlgoAPI_BuilderAlgo aBuilder;
+  //
+  BOPCol_ListOfShape& aLSB=BOPTest_Objects::Shapes();
+  //
+  TopTools_ListOfShape aLS, aLT;
+  ConvertList(aLSB, aLS);
+  //
+  bRunParallel=BOPTest_Objects::RunParallel();
+  aFuzzyValue=BOPTest_Objects::FuzzyValue();
+  //
+  aBuilder.SetArguments(aLS);
+  aBuilder.SetRunParallel(bRunParallel);
+  aBuilder.SetFuzzyValue(aFuzzyValue);
+  //
+  aBuilder.Build(); 
+  iErr=aBuilder.ErrorStatus();
+  if (iErr) {
+    Sprintf(buf, " error: %d\n",  iErr);
+    di << buf;
+    return 0;
+  }
+  //
+  const TopoDS_Shape& aR=aBuilder.Shape();
+  if (aR.IsNull()) {
+    di << " null shape\n";
+    return 0;
+  }
+  //
+  DBRep::Set(a[1], aR);
+  return 0;
+}
+//=======================================================================
+//function : ConvertLists
+//purpose  : 
+//=======================================================================
+void ConvertList(const BOPCol_ListOfShape& aLSB,
+                 TopTools_ListOfShape& aLS)
+{
+  BOPCol_ListIteratorOfListOfShape aItB;
+  //
+  aLS.Clear();
+  aItB.Initialize(aLSB);
+  for (; aItB.More(); aItB.Next()) {
+    const TopoDS_Shape& aS=aItB.Value();
+    aLS.Append(aS);
+  }
+}
+  
index e48dd62..ca7da1c 100644 (file)
 
 #include <stdio.h>
 
+#include <TCollection_AsciiString.hxx>
+
 #include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <Draw_Color.hxx>
+#include <Draw.hxx>
 
 #include <NCollection_BaseAllocator.hxx>
 #include <NCollection_IncAllocator.hxx>
 //
 #include <BRep_Builder.hxx>
 
+#include <IntTools_FaceFace.hxx>
+#include <IntTools_Curve.hxx>
+
+#include <BOPCol_ListOfShape.hxx>
+
+#include <BOPDS_DS.hxx>
+
 #include <BOPAlgo_PaveFiller.hxx>
 #include <BOPAlgo_Operation.hxx>
 #include <BOPAlgo_BOP.hxx>
 #include <BOPAlgo_MakerVolume.hxx>
-#include <BOPDS_DS.hxx>
-#include <BOPTest_DrawableShape.hxx>
-#include <BOPCol_ListOfShape.hxx>
+#include <BOPAlgo_Section.hxx>
 
-#include <TCollection_AsciiString.hxx>
-#include <IntTools_FaceFace.hxx>
-#include <IntTools_Curve.hxx>
-#include <DrawTrSurf.hxx>
-#include <Draw_Color.hxx>
-#include <Draw.hxx>
 #include <BRepAlgoAPI_BooleanOperation.hxx>
 #include <BRepAlgoAPI_Common.hxx>
 #include <BRepAlgoAPI_Fuse.hxx>
 #include <BRepAlgoAPI_Cut.hxx>
 #include <BRepAlgoAPI_Section.hxx>
-#include <BOPAlgo_Section.hxx>
+
+#include <BOPTest_DrawableShape.hxx>
+#include <BOPTest_Objects.hxx>
 
 //
 static BOPAlgo_PaveFiller* pPF=NULL;
@@ -123,9 +129,10 @@ static Standard_Integer mkvolume   (Draw_Interpretor&, Standard_Integer, const c
 //function : bop
 //purpose  : 
 //=======================================================================
-Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
+Standard_Integer bop(Draw_Interpretor& di, Standard_Integer n, const char** a)
 {
   char buf[32];
+  Standard_Boolean bRunParallel;
   Standard_Integer iErr;
   Standard_Real aTol;
   TopoDS_Shape aS1, aS2;
@@ -133,7 +140,7 @@ Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
   //
   if (n < 3 || n > 4) {
     di << " use bop Shape1 Shape2 [tol]\n";
-    return 1;
+    return 0;
   }
   //
   aS1=DBRep::Get(a[1]);
@@ -141,14 +148,16 @@ Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
   //
   if (aS1.IsNull() || aS2.IsNull()) {
     di << " null shapes are not allowed \n";
-    return 1;
+    return 0;
   }
   //
-  aTol = 0.;
+  aTol=BOPTest_Objects::FuzzyValue();
   if (n == 4) {
     aTol = Draw::Atof(a[3]);
   }
   //
+  bRunParallel=BOPTest_Objects::RunParallel();
+  //
   aLC.Append(aS1);
   aLC.Append(aS2);
   //
@@ -161,6 +170,7 @@ Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
   //
   pPF->SetArguments(aLC);
   pPF->SetFuzzyValue(aTol);
+  pPF->SetRunParallel(bRunParallel);
   //
   pPF->Perform();
   iErr=pPF->ErrorStatus();
@@ -229,6 +239,7 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
   }
   //
   char buf[64];
+  Standard_Boolean bRunParallel;
   Standard_Integer aNb, iErr;
   BOPAlgo_BOP aBOP;
   //
@@ -239,6 +250,8 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
     di << buf;
     return 0;
   }
+  // 
+  bRunParallel=BOPTest_Objects::RunParallel();
   //
   const TopoDS_Shape& aS1=aLC.First();
   const TopoDS_Shape& aS2=aLC.Last();
@@ -246,6 +259,7 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
   aBOP.AddArgument(aS1);
   aBOP.AddTool(aS2);
   aBOP.SetOperation(aOp);
+  aBOP.SetRunParallel (bRunParallel);
   //
   aBOP.PerformWithFiller(*pPF);
   iErr=aBOP.ErrorStatus();
@@ -286,6 +300,7 @@ Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char
   }
   //
   char buf[64];
+  Standard_Boolean bRunParallel;
   Standard_Integer aNb, iErr;
   BOPAlgo_Section aBOP;
   //
@@ -297,11 +312,14 @@ Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char
     return 0;
   }
   //
+  bRunParallel=BOPTest_Objects::RunParallel();
+  //
   const TopoDS_Shape& aS1=aLC.First();
   const TopoDS_Shape& aS2=aLC.Last();
   //
   aBOP.AddArgument(aS1);
   aBOP.AddArgument(aS2);
+  aBOP.SetRunParallel (bRunParallel);
   //
   aBOP.PerformWithFiller(*pPF);
   iErr=aBOP.ErrorStatus();
@@ -363,7 +381,7 @@ Standard_Integer  bsection(Draw_Interpretor& di,
   const char* usage = " Usage: bsection Result s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]\n";
   if (n < 4) {
     di << usage;
-    return 1;
+    return 0;
   }
   //
   TopoDS_Shape aS1 = DBRep::Get(a[2]);
@@ -371,17 +389,19 @@ Standard_Integer  bsection(Draw_Interpretor& di,
   //
   if (aS1.IsNull() || aS2.IsNull()) {
     di << " Null shapes are not allowed \n";
-    return 1;
+    return 0;
   }
-  //
-  Standard_Boolean bApp, bPC1, bPC2;
-  Standard_Integer i;
+  // 
+  char buf[80];
+  Standard_Boolean bRunParallel, bApp, bPC1, bPC2;
+  Standard_Integer i, iErr;
   Standard_Real aTol;
   //
   bApp = Standard_True;
   bPC1 = Standard_True;
   bPC2 = Standard_True;
-  aTol = 0.;
+  aTol = BOPTest_Objects::FuzzyValue(); 
+  bRunParallel = BOPTest_Objects::RunParallel();
   //
   for (i = 4; i < n; ++i) {
     if (!strcmp(a[i], "-n2d")) {
@@ -402,14 +422,13 @@ Standard_Integer  bsection(Draw_Interpretor& di,
     }
   }
   //
-  Standard_Integer iErr;
-  char buf[80];
-  //
   BRepAlgoAPI_Section aSec(aS1, aS2, Standard_False);
+  //
   aSec.Approximation(bApp);
   aSec.ComputePCurveOn1(bPC1);
   aSec.ComputePCurveOn2(bPC2);
   aSec.SetFuzzyValue(aTol);
+  aSec.SetRunParallel(bRunParallel);
   //
   aSec.Build();
   iErr=aSec.ErrorStatus();
@@ -427,7 +446,6 @@ Standard_Integer  bsection(Draw_Interpretor& di,
   DBRep::Set(a[1], aR);
   return 0;
 }
-
 //=======================================================================
 //function : bsmt
 //purpose  : 
@@ -438,6 +456,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
                        const BOPAlgo_Operation aOp)
 {
   char buf[32];
+  Standard_Boolean bRunParallel;
   Standard_Integer iErr;
   TopoDS_Shape aS1, aS2;
   BOPCol_ListOfShape aLC;
@@ -445,7 +464,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
   //
   if (n < 4 || n > 5) {
     di << " use bx r s1 s2 [tol]\n";
-    return 1;
+    return 0;
   }
   //
   aS1=DBRep::Get(a[2]);
@@ -453,22 +472,26 @@ Standard_Integer bsmt (Draw_Interpretor& di,
   //
   if (aS1.IsNull() || aS2.IsNull()) {
     di << " null shapes are not allowed \n";
-    return 1;
+    return 0;
   }
-  //
-  aTol = 0.;
+  aLC.Append(aS1);
+  aLC.Append(aS2);
+  // 
+  aTol=BOPTest_Objects::FuzzyValue();
   if (n == 5) {
     aTol = Draw::Atof(a[4]);
   }
   //
-  aLC.Append(aS1);
-  aLC.Append(aS2);
+  bRunParallel = BOPTest_Objects::RunParallel();
   //
   Handle(NCollection_BaseAllocator)aAL=new NCollection_IncAllocator;
+  //
+  //---------------------------------------------------------------
   BOPAlgo_PaveFiller aPF(aAL);
   //
   aPF.SetArguments(aLC);
-  aPF.SetFuzzyValue(aTol);
+  aPF.SetFuzzyValue(aTol); 
+  aPF.SetRunParallel(bRunParallel);
   //
   aPF.Perform();
   iErr=aPF.ErrorStatus();
@@ -478,36 +501,31 @@ Standard_Integer bsmt (Draw_Interpretor& di,
     return 0;
   }
   //
-  BRepAlgoAPI_BooleanOperation* pBuilder=NULL;
+  //---------------------------------------------------------------
+  BOPAlgo_BOP aBOP(aAL);
+  //
+  aBOP.AddArgument(aS1);
+  aBOP.AddTool(aS2);
+  aBOP.SetOperation(aOp);
+  aBOP.SetRunParallel(bRunParallel);
   // 
-  if (aOp==BOPAlgo_COMMON) {
-    pBuilder=new BRepAlgoAPI_Common(aS1, aS2, aPF);
-  }
-  else if (aOp==BOPAlgo_FUSE) {
-    pBuilder=new BRepAlgoAPI_Fuse(aS1, aS2, aPF);
-  }
-  else if (aOp==BOPAlgo_CUT) {
-    pBuilder=new BRepAlgoAPI_Cut (aS1, aS2, aPF);
-  }
-  else if (aOp==BOPAlgo_CUT21) {
-    pBuilder=new BRepAlgoAPI_Cut(aS1, aS2, aPF, Standard_False);
-  }
+  aBOP.PerformWithFiller(aPF);
   //
-  iErr = pBuilder->ErrorStatus();
-  if (!pBuilder->IsDone()) {
+  iErr=aBOP.ErrorStatus();
+  if (iErr) {
     Sprintf(buf, " ErrorStatus : %d\n",  iErr);
     di << buf;
     return 0;
   }
-  const TopoDS_Shape& aR=pBuilder->Shape();
+  const TopoDS_Shape& aR=aBOP.Shape();
   if (aR.IsNull()) {
     di << " null shape\n";
     return 0;
   }
+  //
   DBRep::Set(a[1], aR);
   return 0;
 }
-
 //=======================================================================
 //function : bopnews
 //purpose  : 
@@ -579,7 +597,6 @@ Standard_Integer bopnews (Draw_Interpretor& di,
   //
   return 0;
 }
-
 //=======================================================================
 //function : bopcurves
 //purpose  : 
@@ -617,7 +634,8 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
   const TopoDS_Face& aF1=*(TopoDS_Face*)(&S1);
   const TopoDS_Face& aF2=*(TopoDS_Face*)(&S2);
 
-  Standard_Boolean aToApproxC3d, aToApproxC2dOnS1, aToApproxC2dOnS2, anIsDone, bMake2dCurves;
+  Standard_Boolean aToApproxC3d, aToApproxC2dOnS1, 
+  aToApproxC2dOnS2, anIsDone, bMake2dCurves;
   Standard_Integer i, aNbCurves;
   Standard_Real anAppTol, aTolR;
   TCollection_AsciiString aNm("c_");
@@ -666,8 +684,7 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
     di << " has no 3d curve\n";
     return 1;
   }
-  else
-  {
+  else  {
     di << aNbCurves << " curve(s) found.\n";
   }
 
@@ -707,7 +724,8 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
         di << "(" << nameC2d2 << ") ";
         di << " \n Null first 2d curve of the curve #" << i << "\n";
         continue;
-      } else {
+      } 
+      else {
         TCollection_AsciiString pc1N("c2d1_"), pc1Nx;
         pc1Nx = pc1N + anIndx;
         Standard_CString nameC2d1 = pc1Nx.ToCString();
@@ -719,7 +737,8 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
       if (aPC2.IsNull()) {
         di << ") \n Null second 2d curve of the curve #" << i << "\n";
         continue;
-      } else {
+      } 
+      else {
         TCollection_AsciiString pc2N("c2d2_"), pc2Nx;
         pc2Nx = pc2N + anIndx;
         Standard_CString nameC2d2 = pc2Nx.ToCString();
@@ -734,36 +753,6 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
   
   return 0;
 }
-
-//=======================================================================
-//function : bparallelmode
-//purpose  : 
-//=======================================================================
-Standard_Integer bparallelmode(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
-  if (n == 2)
-  {
-    Standard_Boolean isParallelOn = Draw::Atoi (a[1]) == 1;
-    if (isParallelOn == 1)
-    {
-      BOPAlgo_Algo::SetParallelMode(Standard_True);
-      di << "Parallel mode for boolean operations has been enabled";
-    }
-    else
-    {
-      BOPAlgo_Algo::SetParallelMode(Standard_False);
-      di << "Parallel mode for boolean operations has been disabled";
-    }
-  }
-  else
-  {
-    di << "Parallel mode state for boolean operations: "
-       << (BOPAlgo_Algo::GetParallelMode()? "enabled" : "disabled");
-  }
-
-  return 0;
-}
-
 //=======================================================================
 //function : mkvolume
 //purpose  : 
@@ -789,9 +778,9 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
   TopoDS_Shape aS;
   BOPCol_ListOfShape aLS;
   //
-  aTol = 0.;
+  aTol = BOPTest_Objects::FuzzyValue();
   bToIntersect = Standard_True;
-  bRunParallel = Standard_True;
+  bRunParallel = BOPTest_Objects::RunParallel();
   bCompounds = Standard_False;
   //
   for (i = 2; i < n; ++i) {
@@ -858,3 +847,31 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
   //
   return 0;
 }
+//=======================================================================
+//function : bparallelmode
+//purpose  : 
+//=======================================================================
+Standard_Integer bparallelmode(Draw_Interpretor& di, Standard_Integer n, const char** a)
+{
+  if (n == 2)
+  {
+    Standard_Boolean isParallelOn = Draw::Atoi (a[1]) == 1;
+    if (isParallelOn == 1)
+    {
+      BOPAlgo_Algo::SetParallelMode(Standard_True);
+      di << "Parallel mode for boolean operations has been enabled";
+    }
+    else
+    {
+      BOPAlgo_Algo::SetParallelMode(Standard_False);
+      di << "Parallel mode for boolean operations has been disabled";
+    }
+  }
+  else
+  {
+    di << "Parallel mode state for boolean operations: "
+       << (BOPAlgo_Algo::GetParallelMode()? "enabled" : "disabled");
+  }
+
+  return 0;
+}
index 23b9a02..e06be99 100644 (file)
@@ -64,6 +64,18 @@ is
   
     SetBuilderDefault(myclass); 
  
+    SetRunParallel(myclass; 
+            theFlag: Boolean from Standard); 
+       
+    RunParallel(myclass) 
+        returns  Boolean from Standard; 
+      
+    SetFuzzyValue(myclass; 
+            theValue: Real from Standard); 
+       
+    FuzzyValue(myclass) 
+        returns  Real from Standard;     
 --fields
 
 end Objects;
index c7af19d..5c45f9e 100644 (file)
@@ -45,6 +45,8 @@ class BOPTest_Session {
     myBuilderDefault=new BOPAlgo_Builder(pA2);
     //
     myBuilder=myBuilderDefault;
+    myRunParallel=Standard_False;
+    myFuzzyValue=0.;
   };
   //
   // Clear
@@ -84,11 +86,40 @@ class BOPTest_Session {
     myBuilder=myBuilderDefault;
   };
   //
+  BOPCol_ListOfShape& Shapes() {
+    return myShapes;
+  }
+  //
+  BOPCol_ListOfShape& Tools() {
+    return myTools;
+  }
+  //
+  void SetRunParallel(const Standard_Boolean bFlag) {
+    myRunParallel=bFlag;
+  };
+  //
+  Standard_Boolean RunParallel()const {
+    return myRunParallel;
+  };
+  //
+  void SetFuzzyValue(const Standard_Real aValue) {
+    myFuzzyValue=aValue;
+  };
+  //
+  Standard_Real FuzzyValue()const {
+    return myFuzzyValue;
+  };
+  //
  protected:
   //
   BOPAlgo_PaveFiller* myPaveFiller;
   BOPAlgo_Builder* myBuilder;
   BOPAlgo_Builder* myBuilderDefault;
+  //
+  BOPCol_ListOfShape myShapes;
+  BOPCol_ListOfShape myTools;
+  Standard_Boolean myRunParallel;
+  Standard_Real myFuzzyValue;
 };
 //
 //=======================================================================
@@ -120,8 +151,6 @@ void BOPTest_Objects::Init()
 void BOPTest_Objects::Clear() 
 {
   GetSession().Clear();
-  //
-  //clear objects and tools
   Shapes().Clear();
   Tools().Clear();
 }
@@ -192,8 +221,7 @@ BOPAlgo_Section& BOPTest_Objects::Section()
 //=======================================================================
 BOPCol_ListOfShape& BOPTest_Objects::Shapes()
 {
-  static BOPCol_ListOfShape s_Shapes;
-  return s_Shapes;
+  return GetSession().Shapes();
 }
 //=======================================================================
 //function : Tools
@@ -201,8 +229,39 @@ BOPCol_ListOfShape& BOPTest_Objects::Shapes()
 //=======================================================================
 BOPCol_ListOfShape& BOPTest_Objects::Tools()
 {
-  static BOPCol_ListOfShape s_Tools;
-  return s_Tools;
+  return GetSession().Tools();
+}
+//=======================================================================
+//function : SetRunParallel
+//purpose  : 
+//=======================================================================
+void BOPTest_Objects::SetRunParallel(const Standard_Boolean bFlag)
+{
+  GetSession().SetRunParallel(bFlag);
+}
+//=======================================================================
+//function : RunParallel
+//purpose  : 
+//=======================================================================
+Standard_Boolean BOPTest_Objects::RunParallel()
+{
+  return GetSession().RunParallel();
+}
+//=======================================================================
+//function : SetFuzzyValue
+//purpose  : 
+//=======================================================================
+void BOPTest_Objects::SetFuzzyValue(const Standard_Real aValue)
+{
+  GetSession().SetFuzzyValue(aValue);
+}
+//=======================================================================
+//function : FuzzyValue
+//purpose  : 
+//=======================================================================
+Standard_Real BOPTest_Objects::FuzzyValue()
+{
+  return GetSession().FuzzyValue();
 }
 //=======================================================================
 //function : Allocator1
diff --git a/src/BOPTest/BOPTest_OptionCommands.cxx b/src/BOPTest/BOPTest_OptionCommands.cxx
new file mode 100644 (file)
index 0000000..3176dd1
--- /dev/null
@@ -0,0 +1,123 @@
+// Created by: Peter KURNEV
+// Copyright (c) 2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// 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.
+
+#include <BOPTest.ixx>
+
+#include <stdio.h>
+#include <string.h>
+
+#include <DBRep.hxx>
+#include <Draw.hxx>
+
+#include <BOPTest_Objects.hxx>
+
+static Standard_Integer boptions (Draw_Interpretor&, Standard_Integer, const char**); 
+static Standard_Integer brunparallel (Draw_Interpretor&, Standard_Integer, const char**); 
+static Standard_Integer bfuzzyvalue (Draw_Interpretor&, Standard_Integer, const char**); 
+
+//=======================================================================
+//function : OptionCommands
+//purpose  : 
+//=======================================================================
+void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
+{
+  static Standard_Boolean done = Standard_False;
+  if (done) return;
+  done = Standard_True;
+  // Chapter's name
+  const char* g = "Partition commands";
+  // Commands  
+  theCommands.Add("boptions", "use boptions" , __FILE__, boptions, g);
+  theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
+  theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value" , __FILE__, bfuzzyvalue, g);
+}
+//=======================================================================
+//function : boptions
+//purpose  : 
+//=======================================================================
+Standard_Integer boptions(Draw_Interpretor& di,
+                          Standard_Integer n, 
+                          const char** ) 
+{ 
+  if (n!=1) {
+    di << " use boptions\n";
+    return 0;
+  }
+  //
+  char buf[128];
+  Standard_Boolean bRunParallel;
+  Standard_Real aFuzzyValue;
+  //
+  bRunParallel=BOPTest_Objects::RunParallel();
+  aFuzzyValue=BOPTest_Objects::FuzzyValue();
+  
+  Sprintf(buf, " RunParallel: %d\n",  bRunParallel);
+  di << buf;
+  Sprintf(buf, " FuzzyValue : %lf\n", aFuzzyValue);
+  di << buf;
+  //
+  return 0;
+}
+//=======================================================================
+//function : bfuzzyvalue
+//purpose  : 
+//=======================================================================
+Standard_Integer bfuzzyvalue(Draw_Interpretor& di,
+                             Standard_Integer n, 
+                             const char** a) 
+{ 
+  if (n!=2) {
+    di << " use bfuzzyvalue value\n";
+    return 0;
+  }
+  //
+  Standard_Real aFuzzyValue;
+  //
+  aFuzzyValue=Draw::Atof(a[1]);
+  if (aFuzzyValue<0.) {
+    di << " Wrong value.\n"; 
+    return 0;  
+  }
+  //
+  BOPTest_Objects::SetFuzzyValue(aFuzzyValue);
+  //
+  return 0;
+}
+//=======================================================================
+//function : brunparallel
+//purpose  : 
+//=======================================================================
+Standard_Integer brunparallel(Draw_Interpretor& di,
+                              Standard_Integer n, 
+                              const char** a) 
+{ 
+  if (n!=2) {
+    di << " use brunparallel [0/1]\n";
+    return 0;
+  }
+  //
+  Standard_Integer iX;
+  Standard_Boolean bRunParallel;
+  //
+  iX=Draw::Atoi(a[1]);
+  if (iX<0 || iX>1) {
+    di << " Wrong value.\n"; 
+    return 0;  
+  }
+  //
+  bRunParallel=(Standard_Boolean)(iX);
+  BOPTest_Objects::SetRunParallel(bRunParallel);
+  //
+  return 0;
+}
index d7ce474..d13302a 100644 (file)
@@ -59,7 +59,6 @@ void BOPTest::PartitionCommands(Draw_Interpretor& theCommands)
   theCommands.Add("bbop"   , "use bbop r op [-s -t]"     , __FILE__, bbop, g);
   theCommands.Add("bclear" , "use bclear"                , __FILE__, bclear, g);
 }
-
 //=======================================================================
 //function : bclear
 //purpose  : 
@@ -105,8 +104,10 @@ Standard_Integer bfillds(Draw_Interpretor& di,
   }
   //
   bShowTime = Standard_False;
-  bRunParallel = Standard_True;
-  aTol = 0.;
+  //
+  bRunParallel=BOPTest_Objects::RunParallel();
+  aTol=BOPTest_Objects::FuzzyValue();
+  //
   for (i=1; i<n; ++i) {
     if (!strcmp(a[i], "-s")) {
       bRunParallel=Standard_False;
@@ -207,7 +208,7 @@ Standard_Integer bbuild(Draw_Interpretor& di,
   }
   //
   bShowTime=Standard_False;
-  bRunParallel=Standard_True;
+  bRunParallel=BOPTest_Objects::RunParallel();
   for (i=2; i<n; ++i) {
     if (!strcmp(a[i], "-s")) {
       bRunParallel=Standard_False;
@@ -282,7 +283,7 @@ Standard_Integer bbop(Draw_Interpretor& di,
   aOp=(BOPAlgo_Operation)iOp;
   //
   bShowTime=Standard_False;
-  bRunParallel=Standard_True;
+  bRunParallel=BOPTest_Objects::RunParallel();
   for (i=3; i<n; ++i) {
     if (!strcmp(a[i], "-s")) {
       bRunParallel=Standard_False;
index 1a1377d..fad6632 100755 (executable)
@@ -4,4 +4,5 @@ BOPTest_LowCommands.cxx
 BOPTest_CheckCommands.cxx
 BOPTest_TolerCommands.cxx
 BOPTest_ObjCommands.cxx
-BOPTest_Chronometer.hxx
+BOPTest_APICommands.cxx
+BOPTest_OptionCommands.cxx
index 1fbd068..de14928 100644 (file)
 -- commercial license or contractual agreement.
 
 package BRepAlgoAPI 
-        
-uses  
-   TopTools,
-   TopoDS,
-   gp,
-   Geom,
-   Geom2d,
-   Message,
-   BOPCol,
-   BOPAlgo,
-   BOPDS,
-   BRepBuilderAPI
-is
-
-    deferred class BooleanOperation;
-    class Fuse;
-    class Common;
-    class Cut;
-    class Section;
-    class Check;
-    ---Purpose: Check shapes on validity for boolean
-    --- operation.
-
-    deferred class Algo;
-    deferred class BuilderAlgo;
-
-    DumpOper( theFilePath : CString from Standard;
-              theShape1 : Shape from TopoDS;
-              theShape2 : Shape from TopoDS;
-              theResult : Shape from TopoDS;
-              theOperation : Operation from BOPAlgo;
-              isNonValidArgs : Boolean from Standard );
-        ---Purpose: Dump arguments and result of boolean operation in the file specified by path.
-        ---Level: Public
-
-end BRepAlgoAPI;
-
-
-
-     ---Purpose:  The BRepAlgoAPI package provides a full range of
+    
+    ---Purpose:  The BRepAlgoAPI package provides a full range of
      -- services to perform Boolean Operations on arguments (shapes
      -- that are defined in the BRep data structures). The
      -- implemented new algorithm is intended to replace the Old
@@ -119,3 +81,34 @@ end BRepAlgoAPI;
      -- each other. The same condition is true for SHELLs or FACEs,
      -- WIREs or EDGEs.
      -- It does not support Boolean Operations for COMPSOLID type of shape.
+     
+uses  
+   TopTools,
+   TopoDS,
+   gp,
+   Geom,
+   Geom2d,
+   Message,
+   BOPCol,
+   BOPAlgo,
+   BOPDS,
+   BRepBuilderAPI
+is
+
+    deferred class BooleanOperation;
+    class Fuse;
+    class Common;
+    class Cut;
+    class Section;
+    class Check;
+    ---Purpose: Check shapes on validity for boolean
+    --- operation.
+
+    deferred class Algo; 
+    class BuilderAlgo;
+    
+end BRepAlgoAPI;
+
+
+
+     
diff --git a/src/BRepAlgoAPI/BRepAlgoAPI.cxx b/src/BRepAlgoAPI/BRepAlgoAPI.cxx
deleted file mode 100644 (file)
index b6bfa4d..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-// Created on: 2012-12-25
-// Created by: KULIKOVA Galina
-// Copyright (c) 2012-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// 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.
-
-#include <BRepAlgoAPI.ixx>
-
-#include <stdio.h>
-#include <TCollection_AsciiString.hxx>
-#include <BRepTools.hxx>
-#include <OSD_File.hxx>
-
-//=======================================================================
-//function : dumpOper
-//purpose  : 
-//=======================================================================
-void BRepAlgoAPI::DumpOper(const Standard_CString theFilePath,
-                           const TopoDS_Shape& theShape1,
-                           const TopoDS_Shape& theShape2,
-                           const TopoDS_Shape& theResult,
-                           BOPAlgo_Operation theOperation,
-                           Standard_Boolean isNonValidArgs)
-{
-  TCollection_AsciiString aPath(theFilePath);
-  aPath += "/";
-  Standard_Integer aNumOper = 1;
-  Standard_Boolean isExist = Standard_True;
-  TCollection_AsciiString aFileName;
-  while(isExist)
-  {
-    aFileName = aPath + "BO_" + TCollection_AsciiString(aNumOper) +".tcl";
-    OSD_File aScript(aFileName);
-    isExist = aScript.Exists();
-    if(isExist)
-      aNumOper++;
-  }
-
-  FILE* afile = fopen(aFileName.ToCString(), "w+");
-  if(!afile)
-    return;
-  if(isNonValidArgs)
-    fprintf(afile,"%s\n","# Arguments are invalid");
-
-  TCollection_AsciiString aName1;
-  TCollection_AsciiString aName2;
-  TCollection_AsciiString aNameRes;
-  if(!theShape1.IsNull())
-  {
-    aName1 = aPath +
-      "Arg1_" + TCollection_AsciiString(aNumOper) + ".brep";
-    BRepTools::Write(theShape1, aName1.ToCString());
-  }
-  else
-    fprintf(afile,"%s\n","# First argument is Null ");
-   
-  if(!theShape2.IsNull())
-  {
-    aName2 =  aPath +
-      "Arg2_"+ TCollection_AsciiString(aNumOper) + ".brep";
-
-    BRepTools::Write(theShape2, aName2.ToCString());
-  }
-  else
-    fprintf(afile,"%s\n","# Second argument is Null ");
-   
-   if(!theResult.IsNull())
-  {
-    aNameRes =  aPath +
-      "Result_"+ TCollection_AsciiString(aNumOper) + ".brep";
-
-    BRepTools::Write(theResult, aNameRes.ToCString());
-  }
-  else
-    fprintf(afile,"%s\n","# Result is Null ");
-  
-  fprintf(afile, "%s %s %s\n","restore",  aName1.ToCString(), "arg1");
-  fprintf(afile, "%s %s %s\n","restore",  aName2.ToCString(), "arg2");;
-  TCollection_AsciiString aBopString;
-  switch (theOperation)
-  {
-    case BOPAlgo_COMMON : aBopString += "bcommon Res "; break;
-    case BOPAlgo_FUSE   : aBopString += "bfuse Res "; break;
-    case BOPAlgo_CUT    : 
-    case BOPAlgo_CUT21  : aBopString += "bcut Res "; break;
-    case BOPAlgo_SECTION : aBopString += "bsection Res "; break;
-    default : break;
-  };
-  aBopString += ("arg1 arg2");
-  if(theOperation == BOPAlgo_CUT21)
-    aBopString += " 1";
-
-  fprintf(afile, "%s\n",aBopString.ToCString());
-  fclose(afile);
-}
index 77e4f92..db044a6 100644 (file)
@@ -27,16 +27,24 @@ is
     Initialize 
         returns Algo from BRepAlgoAPI;
     ---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Algo();"
-
+    ---Purpose:  Empty constructor  
+    
     Initialize (theAllocator: BaseAllocator from BOPCol) 
         returns Algo from BRepAlgoAPI;
-
+    ---Purpose:  Empty constructor   
+     
     ErrorStatus (me)
         returns Integer from Standard; 
-
+    ---Purpose: Returns error status of the algorithm 
+    --  ==0 - no errors occured 
+    --  !=0 - is in the event of various error conditions     
+    
     WarningStatus (me)
         returns Integer from Standard;
-
+    ---Purpose: Returns warning  status of the algorithm 
+    --  ==0 - no warning occured 
+    --  !=0 - is in the event of various warning conditions      
+    
     Allocator(me)
         returns BaseAllocator from BOPCol;
     ---C++: return const &
@@ -63,8 +71,11 @@ is
     Shape(me)
         returns Shape from TopoDS
         is redefined;
-    ---C++: return const &
-
+    ---C++: return const &  
+    
+    Clear(me:out) 
+        is virtual protected; 
 fields 
     myAllocator     : BaseAllocator from BOPCol is protected;
     myErrorStatus   : Integer from Standard is protected;
index a48f78b..18ae908 100644 (file)
@@ -120,7 +120,13 @@ const TopoDS_Shape& BRepAlgoAPI_Algo::Shape() const
 {
   return myShape;
 }
-
+//=======================================================================
+//function : Clear
+//purpose  : 
+//=======================================================================
+void BRepAlgoAPI_Algo::Clear()
+{
+}
 //  myErrorStatus
 //
 // 1 - object is just initialized
index 43fbd29..aa4cf22 100644 (file)
 
 deferred class BooleanOperation from BRepAlgoAPI
     inherits BuilderAlgo from BRepAlgoAPI
-
-     ---Purpose: The abstract class BooleanOperation is the root
-     -- class of Boolean Operations (see Overview).
-     -- Boolean Operations algorithm is divided onto two parts.
-     -- -      The first one is computing interference between arguments.
-     -- -      The second one is building the result of operation.
-     -- The BooleanOperation class provides execution of both parts
-     -- of the Boolean Operations algorithm. The second part
-     -- (building the result) depends on given type of the Boolean
-     -- Operation (see Constructor).
+    
+    ---Purpose:  
+    -- The abstract class BooleanOperation is the root
+    -- class of Boolean Operations (see Overview).
+    -- Boolean Operations algorithm is divided onto two parts.
+    -- - The first one is computing interference between arguments.
+    -- - The second one is building the result of operation.
+    -- The class BooleanOperation provides API level of both parts
   
 uses
 
     Shape from TopoDS, 
     DataMapOfShapeShape from TopTools, 
-    ListOfShape from TopTools,
+    ListOfShape from TopTools, 
+    --
     Operation   from BOPAlgo,
-    PaveFiller from BOPAlgo
+    PaveFiller from BOPAlgo 
+    
     
 is 
     Initialize
         returns BooleanOperation from BRepAlgoAPI; 
-
+    ---Purpose:  Empty constructor        
+     
+    Initialize (PF :PaveFiller from BOPAlgo) 
+        returns BooleanOperation from BRepAlgoAPI; 
+    ---Purpose:  Empty constructor   
+    -- <PF> - PaveFiller object that is carried out  
+     
     Initialize (S1 :Shape from TopoDS;  
                 S2 :Shape from TopoDS; 
                 anOperation:Operation from BOPAlgo); 
-    
-    ---Purpose: Prepares the operations for S1 and S2.
+    ---Purpose: Constructor with two arguments  
+    -- <S1>, <S2>  -arguments     
+    -- <anOperation> - the type of the operation
+    -- Obsolete 
      
-    Initialize (S1   :Shape from TopoDS; 
-                S2   :Shape from TopoDS; 
-                aPF  :PaveFiller from BOPAlgo;               
+    Initialize (S1 :Shape from TopoDS; 
+                S2 :Shape from TopoDS; 
+                PF :PaveFiller from BOPAlgo;               
                 anOperation:Operation from BOPAlgo); 
-     ---Purpose: Prepares the operations for S1 and S2.
-
-   
+    ---Purpose: Constructor with two arguments  
+    -- <S1>, <S2>  -arguments     
+    -- <anOperation> - the type of the operation 
+    -- <PF> - PaveFiller object that is carried out  
+    -- Obsolete  
     
-    SetShape1(me:out; 
-            S:Shape from TopoDS); 
-
-    SetShape2(me:out; 
-            S:Shape from TopoDS);  
     Shape1(me)   
         returns Shape from TopoDS 
         is static; 
-    ---Purpose: Returns the first shape involved in this Boolean operation.
+    ---Purpose: Returns the first argument involved in this Boolean operation. 
+    -- Obsolete 
     ---C++: return const &
-    ---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_BooleanOperation();" 
+    
 
     Shape2(me)  
         returns Shape from TopoDS 
         is static;
-    ---Purpose: Returns the second shape involved in this Boolean operation.
+    ---Purpose: Returns the second argument involved in this Boolean operation. 
+    -- Obsolete 
     ---C++: return const &
-       
+      
+    SetTools(me:out; 
+           theLS: ListOfShape from TopTools); 
+    ---Purpose: Sets the tools    
+     
+    Tools(me) 
+      returns ListOfShape from TopTools; 
+    ---C++: return const &   
+    ---Purpose: Gets the tools    
+     
     SetOperation (me:out; 
-            anOp:  Operation from BOPAlgo); 
-    ---Purpose:  Sets the type of Boolean operation to perform      
-    ---          It can be BOPAlgo_SECTION 
-    ---                    BOPAlgo_COMMON 
-    ---                    BOPAlgo_FUSE 
-    ---                    BOPAlgo_CUT 
-    ---                    BOPAlgo_CUT21 
-    ---  
+            anOp:  Operation from BOPAlgo);  
+    ---Purpose:  Sets the type of Boolean operation 
      
     Operation  (me) 
         returns Operation from BOPAlgo;
-    ---Purpose: Returns the type of Boolean Operation that has been performed.  
-   
+    ---Purpose: Returns the type of Boolean Operation 
+    ---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_BooleanOperation();"  
+    
     Build  (me:out) 
-        is redefined virtual
-    ---Purpose: Provides the algorithm of Boolean Operations
-    -- -      Filling interference Data Structure (if it is necessary)
-    -- -      Building the result of the operation. 
+        is redefined ; 
+    ---Purpose: Performs the algorithm 
+    -- Filling interference Data Structure (if it is necessary)
+    -- Building the result of the operation. 
      
     BuilderCanWork(me)  
         returns Boolean from Standard;  
+    ---Purpose: Returns True if there was no errors occured 
+    -- obsolete 
+     
     FuseEdges(me)   
         returns Boolean from Standard;
     ---Purpose: Returns the flag of edge refining  
@@ -102,7 +114,7 @@ is
     RefineEdges(me:out);
     ---Purpose: Fuse C1 edges
      
-     SectionEdges (me:  in  out)  
+    SectionEdges (me:  in  out)  
         returns ListOfShape from TopTools;    
     --- Purpose: Returns a list of section edges.
     -- The edges represent the result of intersection between arguments of
@@ -112,70 +124,70 @@ is
     Modified (me: in out;  
             aS : Shape from TopoDS) 
         returns ListOfShape from TopTools
-        is redefined virtual;
+        is redefined;
     ---Purpose: Returns the list  of shapes modified from the shape <S>. 
     ---C++: return const & 
 
     IsDeleted (me: in out;  
             aS : Shape from TopoDS)
         returns Boolean
-        is redefined virtual;
+        is redefined;
     ---Purpose: Returns true if the shape S has been deleted. The
     -- result shape of the operation does not contain the shape S.
         
     Generated (me: in out;  
             S : Shape from TopoDS)
         returns ListOfShape from TopTools
-        is redefined virtual;
+        is redefined;
     ---Purpose: Returns the list  of shapes generated from the shape <S>.
     ---         For use in BRepNaming.
     ---C++:  return const &
     
     HasModified (me) 
         returns Boolean from Standard
-        is virtual;
+        is redefined;
     ---Purpose: Returns true if there is at least one modified shape.
     ---         For use in BRepNaming.
 
     HasGenerated (me)
         returns Boolean from Standard
-        is virtual;
+        is redefined;
     ---Purpose: Returns true if there is at least one generated shape.
     ---         For use in BRepNaming.
 
     HasDeleted (me)
         returns Boolean from Standard
-        is virtual;
+        is redefined;
     ---Purpose: Returns true if there is at least one deleted shape.
     ---         For use in BRepNaming.
  
     --  
-    -- protected 
-    --    
-    PrepareFiller(me:out) 
-        returns Boolean from Standard 
-        is protected;      
-       
+    -- protected methods
+    --     
+    Clear(me:out) 
+        is redefined protected;  
+        
+    SetAttributes (me:out) 
+        is virtual protected;   
+       
     RefinedList (me:  in  out;  
             theL : ListOfShape from TopTools)  
         returns ListOfShape from TopTools
         is protected;
     ---Purpose: Returns the list  of shapes generated from the shape <S>.
     ---         For use in BRepNaming.
-    ---C++:  return const &
+    ---C++:  return const & 
+     
+    
     
-fields
-    myS1       : Shape from TopoDS        is protected;
-    myS2       : Shape from TopoDS        is protected;
+fields 
+    myTools    : ListOfShape from TopTools is protected; 
     myOperation: Operation from BOPAlgo   is protected;   
-    --
-    myEntryType: Integer from Standard is protected;    
-    myBuilderCanWork : Boolean from Standard is protected;  
-     
+    -- 
+    myBuilderCanWork : Boolean from Standard is protected;   
     --    for  edge  refiner
     myFuseEdges      : Boolean from Standard ; 
     myModifFaces     : DataMapOfShapeShape from TopTools;   
     myEdgeMap        : DataMapOfShapeShape from TopTools; 
     
 end BooleanOperation;
-
index 24a9841..f98f2ac 100644 (file)
 
 #include <BRepAlgoAPI_BooleanOperation.ixx>
 
+///XXXXXXXXXX
+#include <stdio.h>
+#include <TCollection_AsciiString.hxx>
+#include <BRepTools.hxx>
+#include <OSD_File.hxx>
+//XXXXXXXXXX
+
 #include <TopExp.hxx>
 
 #include <TopTools_IndexedMapOfShape.hxx>
 #include <TopTools_DataMapOfIntegerListOfShape.hxx>
 #include <TopTools_DataMapOfIntegerShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <TopTools_MapOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
 
 #include <BRepAlgoAPI_Check.hxx>
-#include <BRepAlgoAPI.hxx>
+
 #include <BRepLib_FuseEdges.hxx>
 
 #include <BOPDS_PDS.hxx>
 #include <BOPAlgo_BOP.hxx>
 #include <BOPAlgo_Section.hxx>
 
+//XXXX
+//=======================================================================
+//class : BRepAlgoAPI_DumpOper
+//purpose  : 
+//=======================================================================
+class BRepAlgoAPI_DumpOper {
+ public:
+  BRepAlgoAPI_DumpOper() :
+    myIsDump(Standard_False),
+    myIsDumpArgs(Standard_False),
+    myIsDumpRes(Standard_False)  {
+      char *pathdump = getenv("CSF_DEBUG_BOP");
+      myIsDump=(pathdump!=NULL);
+      myPath=pathdump;
+  };
+  //
+  virtual ~BRepAlgoAPI_DumpOper() {
+  };
+  //
+  Standard_Boolean IsDump()const {
+    return myIsDump;
+  };
+  //
+  void SetIsDumpArgs(const Standard_Boolean bFlag) {
+    myIsDumpArgs=bFlag;
+  }
+  //
+  Standard_Boolean IsDumpArgs()const {
+    return myIsDumpArgs;
+  };
+  //
+  void SetIsDumpRes(const Standard_Boolean bFlag) {
+    myIsDumpRes=bFlag;
+  };
+  //
+  Standard_Boolean IsDumpRes()const {
+    return myIsDumpRes;
+  };
+  //
+  void Dump(
+            const TopoDS_Shape& theShape1,
+            const TopoDS_Shape& theShape2,
+            const TopoDS_Shape& theResult,
+            BOPAlgo_Operation theOperation);
+  //
+ protected:
+  Standard_Boolean myIsDump;
+  Standard_Boolean myIsDumpArgs;
+  Standard_Boolean myIsDumpRes;
+  Standard_CString myPath;
+};
+//XXXX
 //=======================================================================
 //function : BRepAlgoAPI_BooleanOperation
 //purpose  : 
 //=======================================================================
 BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation()
 :
-  BRepAlgoAPI_BuilderAlgo(), 
+  BRepAlgoAPI_BuilderAlgo(),  
   myOperation(BOPAlgo_UNKNOWN),
-  myEntryType(1),
   myBuilderCanWork(Standard_False),
   myFuseEdges(Standard_False)
-{
+{ 
+  myEntryType=1;
+}
+//=======================================================================
+//function : BRepAlgoAPI_BooleanOperation
+//purpose  : 
+//=======================================================================
+BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
+  (const BOPAlgo_PaveFiller& aPF)
+:
+  BRepAlgoAPI_BuilderAlgo(aPF),  
+  myOperation(BOPAlgo_UNKNOWN),
+  myBuilderCanWork(Standard_False),
+  myFuseEdges(Standard_False)
+{ 
+  myEntryType=0;
 }
 //=======================================================================
 //function : BRepAlgoAPI_BooleanOperation
@@ -62,13 +136,14 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
    const BOPAlgo_Operation anOp)
 : 
   BRepAlgoAPI_BuilderAlgo(),
-  myS1(aS1),
-  myS2(aS2),
   myOperation(anOp),
-  myEntryType(1),
   myBuilderCanWork(Standard_False),
   myFuseEdges(Standard_False)
 {
+  myEntryType=1;
+  //
+  myArguments.Append(aS1);
+  myTools.Append(aS2);
 }
 //=======================================================================
 //function : BRepAlgoAPI_BooleanOperation
@@ -80,14 +155,16 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
    const BOPAlgo_PaveFiller& aPF,
    const BOPAlgo_Operation anOp)
 : 
-  BRepAlgoAPI_BuilderAlgo(),
-  myS1(aS1),
-  myS2(aS2),
+  BRepAlgoAPI_BuilderAlgo(aPF),
   myOperation(anOp),
-  myEntryType(0),
   myBuilderCanWork(Standard_False),
   myFuseEdges(Standard_False)
-{
+{ 
+  myEntryType=0;
+  //
+  myArguments.Append(aS1);
+  myTools.Append(aS2);
+  //
   myDSFiller=(BOPAlgo_PaveFiller*)&aPF;
 }
 //=======================================================================
@@ -96,58 +173,60 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
 //=======================================================================
 BRepAlgoAPI_BooleanOperation::~BRepAlgoAPI_BooleanOperation()
 {
-  if (myBuilder) {
-    delete myBuilder;
-    myBuilder=NULL;
-  }
-  if (myDSFiller && myEntryType) {
-    delete myDSFiller;
-    myDSFiller=NULL;
-  }
-  //
+  Clear();
+}
+//=======================================================================
+//function : Clear
+//purpose  : 
+//=======================================================================
+void BRepAlgoAPI_BooleanOperation::Clear()
+{
+  BRepAlgoAPI_BuilderAlgo::Clear();
   myModifFaces.Clear();
   myEdgeMap.Clear();
 }
 //=======================================================================
-//function : SetOperation
+//function : SetTools
 //purpose  : 
 //=======================================================================
-void BRepAlgoAPI_BooleanOperation::SetOperation 
-  (const BOPAlgo_Operation anOp)
+void BRepAlgoAPI_BooleanOperation::SetTools
+  (const TopTools_ListOfShape& theLS)
 {
-  myOperation=anOp;
+  myTools=theLS;
 }
 //=======================================================================
-//function : Operation
+//function : Tools
 //purpose  : 
 //=======================================================================
-BOPAlgo_Operation BRepAlgoAPI_BooleanOperation::Operation ()const
+const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Tools()const
 {
-  return myOperation;
+  return myTools;
 }
 //=======================================================================
-//function : SetShape1
+//function : SetOperation
 //purpose  : 
 //=======================================================================
-void  BRepAlgoAPI_BooleanOperation::SetShape1(const TopoDS_Shape& aS) 
+void BRepAlgoAPI_BooleanOperation::SetOperation 
+  (const BOPAlgo_Operation anOp)
 {
-  myS1=aS;
-} 
+  myOperation=anOp;
+}
 //=======================================================================
-//function : SetShape2
+//function : Operation
 //purpose  : 
 //=======================================================================
-void  BRepAlgoAPI_BooleanOperation::SetShape2(const TopoDS_Shape& aS) 
+BOPAlgo_Operation BRepAlgoAPI_BooleanOperation::Operation()const
 {
-  myS2=aS;
-} 
+  return myOperation;
+}
 //=======================================================================
 //function : Shape1
 //purpose  : 
 //=======================================================================
 const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape1() const 
 {
-  return myS1;
+  return myArguments.First();
 }
 //=======================================================================
 //function : Shape2
@@ -155,13 +234,13 @@ const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape1() const
 //=======================================================================
 const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape2() const 
 {
-  return myS2;
+  return myTools.First();
 }
 //=======================================================================
 //function : BuilderCanWork
 //purpose  : 
 //=======================================================================
-  Standard_Boolean BRepAlgoAPI_BooleanOperation::BuilderCanWork() const
+Standard_Boolean BRepAlgoAPI_BooleanOperation::BuilderCanWork() const
 {
   return myBuilderCanWork;
 }
@@ -174,154 +253,159 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::FuseEdges ()const
   return myFuseEdges;
 }
 //=======================================================================
-//function : PrepareFiller
+//function : SetAttributes
 //purpose  : 
 //=======================================================================
-Standard_Boolean BRepAlgoAPI_BooleanOperation::PrepareFiller()
+void BRepAlgoAPI_BooleanOperation::SetAttributes()
 {
-  Standard_Boolean bIsNewFiller=Standard_False;
-  myErrorStatus=1;
-  //
-  if (myS1.IsNull() || myS2.IsNull()) {
-    myErrorStatus=2;
-    return bIsNewFiller;
-  }
-  //
-  if (myOperation==BOPAlgo_UNKNOWN) {
-    myErrorStatus=6;
-    return bIsNewFiller;
-  }
-  //
-  if (myDSFiller==NULL) {
-    bIsNewFiller=!bIsNewFiller;
-
-    myDSFiller=new BOPAlgo_PaveFiller;
-    //
-    if (myDSFiller==NULL) {
-      myErrorStatus=4;
-      return bIsNewFiller;
-    }
-    //
-    BOPCol_ListOfShape aLS;
-    aLS.Append(myS1);
-    aLS.Append(myS2);
-    //
-    myDSFiller->SetArguments(aLS);
-    myDSFiller->SetRunParallel(myRunParallel);
-    myDSFiller->SetProgressIndicator(myProgressIndicator);
-    myDSFiller->SetFuzzyValue(myFuzzyValue);
-  }
-
-  return bIsNewFiller;
 }
 //=======================================================================
-//function : Build
+//function : Build2
 //purpose  : 
 //=======================================================================
 void BRepAlgoAPI_BooleanOperation::Build()
 {
-  Standard_Boolean bIsNewFiller;
-  Standard_Integer iErr;
-  //
-  //dump arguments and result of boolean operation in tcl script
-  char *pathdump = getenv("CSF_DEBUG_BOP");
-  Standard_Boolean isDump = (pathdump != NULL),
-                   isDumpArgs = Standard_False,
-                   isDumpRes = Standard_False;
-  Standard_CString aPath = pathdump;
+  Standard_Integer iErr, aNbArgs, aNbTools;  
+  BRepAlgoAPI_DumpOper aDumpOper;
   //
   myBuilderCanWork=Standard_False;
+  myErrorStatus=0;
   NotDone();
   //
-  bIsNewFiller=PrepareFiller();
-  //
-  if (myErrorStatus!=1) {
-    // there was errors during the preparation 
+  aNbArgs=myArguments.Extent();
+  aNbTools=myTools.Extent();
+  if (aNbArgs<1 && aNbTools<1) {
+    myErrorStatus=2;
     return;
   }
-  //
-  if (bIsNewFiller) {
-    //Prepare the DS
-    myDSFiller->Perform();
+  if (myOperation==BOPAlgo_UNKNOWN) {
+    myErrorStatus=6;
+    return;
   }
   //
-  if (myBuilder!=NULL) {
-    delete myBuilder;
-    myBuilder=NULL;
+  //-----------------------------------------------
+  TopTools_ListOfShape aLS;
+  TopTools_ListIteratorOfListOfShape aIt;
+  //
+  aIt.Initialize(myArguments);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aS = aIt.Value();
+    aLS.Append(aS);
+  }
+  aIt.Initialize(myTools);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aS = aIt.Value();
+    aLS.Append(aS);
   }
+  //-----------------------------------------------
   //
-  const TopoDS_Shape& aS1 = myS1;
-  const TopoDS_Shape& aS2 = myS2;
+  if (myEntryType) {
+    if (myDSFiller) {
+      delete myDSFiller;
+    }
+    myDSFiller=new BOPAlgo_PaveFiller(myAllocator);
+    //
+    myDSFiller->SetArguments(aLS);
+    //
+    myDSFiller->SetRunParallel(myRunParallel);
+    myDSFiller->SetProgressIndicator(myProgressIndicator);
+    myDSFiller->SetFuzzyValue(myFuzzyValue);
+    //
+    SetAttributes();
+    //
+    myDSFiller->Perform(); 
+    iErr=myDSFiller->ErrorStatus();
+    if (iErr) {
+      myErrorStatus=100+iErr;
+      return;
+    }
+  }// if (myEntryType) {
   //
-  if (isDump) {
+  //XXXX
+  const TopoDS_Shape& aS1 = myArguments.First();
+  const TopoDS_Shape& aS2 = myTools.First();
+  if (aDumpOper.IsDump()) {
     BRepAlgoAPI_Check aChekArgs(aS1, aS2, myOperation);
-    isDumpArgs = !aChekArgs.IsValid();
+    aDumpOper.SetIsDumpArgs(!aChekArgs.IsValid());
+  }
+  //XXXX
+  // 
+  if (myBuilder) {
+    delete myBuilder;
   }
   //
-  myShape.Nullify();
+  BOPAlgo_BOP *pBOP;
   //
-  if (myOperation==BOPAlgo_SECTION) {
-    myBuilder=new BOPAlgo_Section;
-    myBuilder->AddArgument(aS1);
-    myBuilder->AddArgument(aS2);
+  if(myOperation==BOPAlgo_SECTION) {
+    myBuilder=new BOPAlgo_Section(myAllocator);
+    myBuilder->SetArguments(aLS);
   }
-  else {
-    BOPAlgo_BOP *pBOP;
-    //
-    pBOP=new BOPAlgo_BOP;
-    myBuilder=pBOP;
-    pBOP->AddArgument(aS1);
-    pBOP->AddTool(aS2);
+  else{
+    pBOP=new BOPAlgo_BOP(myAllocator); 
+    pBOP->SetArguments(myArguments);
+    pBOP->SetTools(myTools); 
     pBOP->SetOperation(myOperation);
+    myBuilder=pBOP;
   }
   //
   myBuilder->SetRunParallel(myRunParallel);
   myBuilder->SetProgressIndicator(myProgressIndicator);
+  //
   myBuilder->PerformWithFiller(*myDSFiller);
   iErr = myBuilder->ErrorStatus();
-  if (!iErr) {
-    myErrorStatus=0;
-    myBuilderCanWork=Standard_True;
-    myShape=myBuilder->Shape();
-    //
-    if (isDump) {
-      BRepAlgoAPI_Check aCheckRes(myShape);
-      isDumpRes = !aCheckRes.IsValid();
-      if (isDumpArgs || isDumpRes) {
-        BRepAlgoAPI::DumpOper(aPath, 
-                              aS1, 
-                              aS2, 
-                              myShape, 
-                              myOperation, 
-                              isDumpArgs);
-      }
-    }
-    //
-    Done(); 
-  } 
-  else {
-    myErrorStatus=100+iErr;
-    NotDone();
+  if (iErr) {
+    myErrorStatus=200+iErr;
+    return;
   }
+  //
+  myShape=myBuilder->Shape();
+  //
+  myBuilderCanWork=Standard_True;
+  Done(); 
+  //
+  //XXXX
+  if (aDumpOper.IsDump()) {
+    BRepAlgoAPI_Check aCheckRes(myShape);
+    aDumpOper.SetIsDumpRes(!aCheckRes.IsValid());
+    aDumpOper.Dump(aS1, aS2, myShape,myOperation);
+  }
+  //XXXX
 }
-
 //=======================================================================
 //function : RefineEdges
 //purpose  : 
 //=======================================================================
 void BRepAlgoAPI_BooleanOperation::RefineEdges ()
 {
-  if(myFuseEdges) return; //Edges have been refined yet
-
+  if(myFuseEdges) { 
+    return; //Edges have been refined
+  }
+  //
+  TopTools_IndexedMapOfShape mapOldEdges;
+  TopTools_ListOfShape aLS;
+  TopTools_ListIteratorOfListOfShape aIt;
+  //
+  aIt.Initialize(myArguments);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aS = aIt.Value();
+    aLS.Append(aS);
+  }
+  aIt.Initialize(myTools);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aS = aIt.Value();
+    aLS.Append(aS);
+  }
+  //
+  aIt.Initialize(aLS);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aS = aIt.Value();
+    TopExp::MapShapes (aS, TopAbs_EDGE, mapOldEdges);
+  }
+  //----------------------------------------------
   BRepLib_FuseEdges FE(myShape);
   FE.SetConcatBSpl(Standard_True);
-
-  // avoid fusing old edges
-  TopTools_IndexedMapOfShape mapOldEdges;
-  TopExp::MapShapes (myS1, TopAbs_EDGE, mapOldEdges);
-  TopExp::MapShapes (myS2, TopAbs_EDGE, mapOldEdges);
   FE.AvoidEdges (mapOldEdges);
-
+  //
   // Get List of edges that have been fused
   myFuseEdges = Standard_False;
   myModifFaces.Clear();
@@ -529,3 +613,90 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasDeleted() const
   }
   return myBuilder->HasDeleted();
 }
+//XXXX
+//=======================================================================
+//function : Dump
+//purpose  : 
+//=======================================================================
+void BRepAlgoAPI_DumpOper::Dump (const TopoDS_Shape& theShape1,
+                                 const TopoDS_Shape& theShape2,
+                                 const TopoDS_Shape& theResult,
+                                 BOPAlgo_Operation theOperation)
+{
+  if (!(myIsDumpArgs && myIsDumpRes)) {
+    return;
+  }
+  //
+  TCollection_AsciiString aPath(myPath);
+  aPath += "/";
+  Standard_Integer aNumOper = 1;
+  Standard_Boolean isExist = Standard_True;
+  TCollection_AsciiString aFileName;
+  while(isExist)
+  {
+    aFileName = aPath + "BO_" + TCollection_AsciiString(aNumOper) +".tcl";
+    OSD_File aScript(aFileName);
+    isExist = aScript.Exists();
+    if(isExist)
+      aNumOper++;
+  }
+
+  FILE* afile = fopen(aFileName.ToCString(), "w+");
+  if(!afile)
+    return;
+  if(myIsDumpArgs)
+    fprintf(afile,"%s\n","# Arguments are invalid");
+
+  TCollection_AsciiString aName1;
+  TCollection_AsciiString aName2;
+  TCollection_AsciiString aNameRes;
+  if(!theShape1.IsNull())
+  {
+    aName1 = aPath +
+      "Arg1_" + TCollection_AsciiString(aNumOper) + ".brep";
+    BRepTools::Write(theShape1, aName1.ToCString());
+  }
+  else
+    fprintf(afile,"%s\n","# First argument is Null ");
+   
+  if(!theShape2.IsNull())
+  {
+    aName2 =  aPath +
+      "Arg2_"+ TCollection_AsciiString(aNumOper) + ".brep";
+
+    BRepTools::Write(theShape2, aName2.ToCString());
+  }
+  else
+    fprintf(afile,"%s\n","# Second argument is Null ");
+   
+   if(!theResult.IsNull())
+  {
+    aNameRes =  aPath +
+      "Result_"+ TCollection_AsciiString(aNumOper) + ".brep";
+
+    BRepTools::Write(theResult, aNameRes.ToCString());
+  }
+  else
+    fprintf(afile,"%s\n","# Result is Null ");
+  
+  fprintf(afile, "%s %s %s\n","restore",  aName1.ToCString(), "arg1");
+  fprintf(afile, "%s %s %s\n","restore",  aName2.ToCString(), "arg2");;
+  TCollection_AsciiString aBopString;
+  switch (theOperation)
+  {
+    case BOPAlgo_COMMON : aBopString += "bcommon Res "; break;
+    case BOPAlgo_FUSE   : aBopString += "bfuse Res "; break;
+    case BOPAlgo_CUT    : 
+    case BOPAlgo_CUT21  : aBopString += "bcut Res "; break;
+    case BOPAlgo_SECTION : aBopString += "bsection Res "; break;
+    default : break;
+  };
+  aBopString += ("arg1 arg2");
+  if(theOperation == BOPAlgo_CUT21)
+    aBopString += " 1";
+
+  fprintf(afile, "%s\n",aBopString.ToCString());
+  fclose(afile);
+}
+//XXXX
index c5a1b53..7c9a978 100644 (file)
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
-deferred class BuilderAlgo from BRepAlgoAPI
-        inherits Algo from BRepAlgoAPI
- ---Purpose: provides the root interface for algorithms
+class BuilderAlgo from BRepAlgoAPI
+        inherits Algo from BRepAlgoAPI 
+    ---Purpose:  
+    --  The clsss contains API level of General Fuse algorithm
 
 uses
-    BaseAllocator from BOPCol,
-    PPaveFiller from BOPAlgo,
+    Shape from TopoDS, 
+    ListOfShape from TopTools,
+    --
+    PPaveFiller from BOPAlgo, 
+    PaveFiller from BOPAlgo,
     PBuilder from BOPAlgo
-
+    
 --raises
 
 is
-    Initialize
-    returns BuilderAlgo from BRepAlgoAPI;
+    Create  
+        returns BuilderAlgo from BRepAlgoAPI; 
+    ---Purpose:  Empty constructor 
     ---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_BuilderAlgo();"
 
-    Initialize (theAllocator: BaseAllocator from BOPCol)
-    returns BuilderAlgo from BRepAlgoAPI;
-
+    Create(thePF  :PaveFiller from BOPAlgo)  
+        returns BuilderAlgo from BRepAlgoAPI; 
+    ---Purpose:  Empty constructor  
+     
     SetFuzzyValue(me:out; 
         theFuzz : Real from Standard);
     ---Purpose: Sets the additional tolerance
 
     FuzzyValue(me)
-    returns Real from Standard;
-    ---Purpose: Returns the additional tolerance 
+        returns Real from Standard;
+    ---Purpose: Returns the additional tolerance   
+    
+    SetArguments(me:out; 
+        theLS: ListOfShape from TopTools);  
+    ---Purpose: Sets the arguments    
+            
+    Arguments(me) 
+        returns ListOfShape from TopTools; 
+    ---C++: return const & 
+    ---Purpose: Gets the arguments   
+    
+    Build  (me:out) 
+        is redefined virtual; 
+    ---Purpose:  Performs the algorithm 
+    -- 
+    --  H  I  S  T  O  R  Y           
+    --
+    Modified (me: in out;  
+            aS : Shape from TopoDS) 
+        returns ListOfShape from TopTools
+        is redefined virtual;
+    ---Purpose: Returns the list  of shapes modified from the shape <S>. 
+    ---C++: return const & 
+
+    IsDeleted (me: in out;  
+            aS : Shape from TopoDS)
+        returns Boolean
+        is redefined virtual;
+    ---Purpose: Returns true if the shape S has been deleted. The
+    -- result shape of the operation does not contain the shape S.
+        
+    Generated (me: in out;  
+            S : Shape from TopoDS)
+        returns ListOfShape from TopTools
+        is redefined virtual;
+    ---Purpose: Returns the list  of shapes generated from the shape <S>.
+    ---         For use in BRepNaming.
+    ---C++:  return const &
+    
+    HasModified (me) 
+        returns Boolean from Standard
+        is virtual;
+    ---Purpose: Returns true if there is at least one modified shape.
+    ---         For use in BRepNaming.
+
+    HasGenerated (me)
+        returns Boolean from Standard
+        is virtual;
+    ---Purpose: Returns true if there is at least one generated shape.
+    ---         For use in BRepNaming.
+
+    HasDeleted (me)
+        returns Boolean from Standard
+        is virtual;
+    ---Purpose: Returns true if there is at least one deleted shape.
+    ---         For use in BRepNaming. 
+    --
+    --  protected methods
+    --
+    Clear(me:out) 
+        is redefined protected; 
 
 fields
+    myEntryType  : Integer from Standard is protected;    
     myDSFiller   : PPaveFiller from BOPAlgo  is protected;
     myBuilder    : PBuilder    from BOPAlgo  is protected;
-    myFuzzyValue : Real        from Standard is protected;
-
+    myFuzzyValue : Real        from Standard is protected; 
+    myArguments  : ListOfShape from TopTools is protected;   
 end BuilderAlgo;
index 6eee113..8deab8e 100644 (file)
@@ -14,7 +14,8 @@
 
 #include <BRepAlgoAPI_BuilderAlgo.ixx>
 
-#include <NCollection_BaseAllocator.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+#include <BOPAlgo_Builder.hxx>
 
 //=======================================================================
 // function: 
@@ -23,6 +24,7 @@
 BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
 :
   BRepAlgoAPI_Algo(),
+  myEntryType(1),
   myDSFiller(NULL),
   myBuilder(NULL),
   myFuzzyValue(0.)
@@ -32,20 +34,23 @@ BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
 // purpose: 
 //=======================================================================
 BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo
-  (const Handle(NCollection_BaseAllocator)& theAllocator)
+  (const BOPAlgo_PaveFiller& aPF)
 :
-  BRepAlgoAPI_Algo(theAllocator),
-  myDSFiller(NULL),
+  BRepAlgoAPI_Algo(),
+  myEntryType(0),
   myBuilder(NULL),
   myFuzzyValue(0.)
-{}
-
+{
+  BOPAlgo_PaveFiller* pPF=(BOPAlgo_PaveFiller*)&aPF;
+  myDSFiller=pPF;
+}
 //=======================================================================
 // function: ~
 // purpose: 
 //=======================================================================
 BRepAlgoAPI_BuilderAlgo::~BRepAlgoAPI_BuilderAlgo()
 {
+  Clear();
 }
 //=======================================================================
 //function : SetFuzzyValue
@@ -65,3 +70,160 @@ Standard_Real BRepAlgoAPI_BuilderAlgo::FuzzyValue() const
 {
   return myFuzzyValue;
 }
+//=======================================================================
+//function : Clear
+//purpose  : 
+//=======================================================================
+void BRepAlgoAPI_BuilderAlgo::Clear()
+{
+  if (myDSFiller && myEntryType) {
+    delete myDSFiller;
+    myDSFiller=NULL;
+  }
+  if (myBuilder) {
+    delete myBuilder;
+    myBuilder=NULL;
+  }
+}
+//=======================================================================
+//function : SetArguments
+//purpose  : 
+//=======================================================================
+void BRepAlgoAPI_BuilderAlgo::SetArguments
+  (const TopTools_ListOfShape& theLS)
+{
+  myArguments=theLS;
+}
+//=======================================================================
+//function : Arguments
+//purpose  : 
+//=======================================================================
+const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Arguments()const
+{
+  return myArguments;
+}
+//=======================================================================
+//function : Build
+//purpose  : 
+//=======================================================================
+void BRepAlgoAPI_BuilderAlgo::Build()
+{
+  Standard_Integer iErr;
+  //
+  NotDone();
+  myErrorStatus=0;
+  //
+  Clear();
+  //
+  if (myEntryType) {
+    if (myDSFiller) {
+      delete myDSFiller;
+    }
+    myDSFiller=new BOPAlgo_PaveFiller(myAllocator);
+    //
+    myDSFiller->SetArguments(myArguments);
+    //
+    myDSFiller->SetRunParallel(myRunParallel);
+    myDSFiller->SetProgressIndicator(myProgressIndicator);
+    myDSFiller->SetFuzzyValue(myFuzzyValue);
+    //
+    myDSFiller->Perform();
+    iErr=myDSFiller->ErrorStatus();
+    if (iErr) {
+      myErrorStatus=100+iErr;
+    }
+  }// if (myEntryType) {
+  // 
+  if (myBuilder) {
+    delete myBuilder;
+  }
+  myBuilder=new BOPAlgo_Builder(myAllocator);
+  //
+  myBuilder->SetArguments(myArguments);
+  //
+  myBuilder->SetRunParallel(myRunParallel);
+  myBuilder->SetProgressIndicator(myProgressIndicator);
+  //
+  myBuilder->PerformWithFiller(*myDSFiller);
+  iErr=myBuilder->ErrorStatus();
+  if (iErr) {
+    myErrorStatus=200+iErr;
+  }
+  //
+  Done();
+  myShape=myBuilder->Shape();
+}
+//=======================================================================
+//function : Generated
+//purpose  : 
+//=======================================================================
+const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Generated
+  (const TopoDS_Shape& aS) 
+{
+  if (myBuilder==NULL) {
+    myGenerated.Clear();
+    return myGenerated;
+  }
+  myGenerated = myBuilder->Generated(aS);
+  return myGenerated;
+}
+//=======================================================================
+//function : Modified
+//purpose  : 
+//=======================================================================
+const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Modified
+  (const TopoDS_Shape& aS) 
+{
+  if (myBuilder==NULL) {
+    myGenerated.Clear();
+    return myGenerated;
+  }
+  myGenerated = myBuilder->Modified(aS);
+  return myGenerated;
+}
+//=======================================================================
+//function : IsDeleted
+//purpose  : 
+//=======================================================================
+Standard_Boolean BRepAlgoAPI_BuilderAlgo::IsDeleted
+  (const TopoDS_Shape& aS) 
+{
+  Standard_Boolean bDeleted = Standard_True; 
+  if (myBuilder != NULL) {
+    bDeleted=myBuilder->IsDeleted(aS);
+  }
+  return bDeleted; 
+}
+//=======================================================================
+//function : HasModified
+//purpose  : 
+//=======================================================================
+Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasModified() const
+{
+  if (myBuilder==NULL) {
+    return Standard_False;
+  }
+  return myBuilder->HasModified();
+}
+//=======================================================================
+//function : HasGenerated
+//purpose  : 
+//=======================================================================
+Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasGenerated() const
+{
+  if (myBuilder==NULL) {
+    return Standard_False;
+  }
+  return myBuilder->HasGenerated();
+}
+//=======================================================================
+//function : HasDeleted
+//purpose  : 
+//=======================================================================
+Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasDeleted() const
+{
+  if (myBuilder==NULL) {
+    return Standard_False;
+  }
+  return myBuilder->HasDeleted();
+}
index 3e221a6..678dd57 100644 (file)
 class Common from BRepAlgoAPI  
     inherits BooleanOperation from BRepAlgoAPI
 
- ---Purpose: The class Common provides a
-     -- Boolean common operation on a pair of arguments (Boolean Intersection).
-     --  The class Common provides a framework for:
-     -- -           Defining the construction of a common shape;
-     -- -           Implementing the   building algorithm
-     -- -           Consulting the result.
+    ---Purpose:  
+    -- The class provides Boolean common operation
+    -- between arguments and tools (Boolean Intersection).
 
 uses
     Shape from TopoDS, 
     PaveFiller from BOPAlgo
-
 is  
     Create 
         returns Common from BRepAlgoAPI;  
     ---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Common();"  
-    --- Purpose: Empty constructor      
-        
+    --- Purpose: Empty constructor       
+      
+    Create (PF: PaveFiller from BOPAlgo)
+        returns Common from BRepAlgoAPI;  
+    --- Purpose: Empty constructor  
+    -- <PF> - PaveFiller object that is carried out     
     Create (S1,S2 : Shape from TopoDS)  
-     returns Common from BRepAlgoAPI;  
-    ---Purpose: Constructs a common part for shapes aS1 and aS2 .
+        returns Common from BRepAlgoAPI;  
+    ---Purpose: Constructor with two shapes  
+    -- <S1>  -argument     
+    -- <S2>  -tool     
+    -- <anOperation> - the type of the operation
+    -- Obsolete  
  
-    Create (S1,S2 : Shape from TopoDS; 
-         aDSF:PaveFiller from BOPAlgo)  
-     returns Common from BRepAlgoAPI; 
-    --- Purpose: Constructs a common part for shapes aS1 and aS2 using aDSFiller 
+    Create (S1: Shape from TopoDS; 
+            S2: Shape from TopoDS; 
+            PF: PaveFiller from BOPAlgo)  
+        returns Common from BRepAlgoAPI; 
+    ---Purpose: Constructor with two shapes  
+    -- <S1>  -argument     
+    -- <S2>  -tool    
+    -- <anOperation> - the type of the operation 
+    -- <PF> - PaveFiller object that is carried out  
+    -- Obsolete   
     
 end Common;
 
index 587cb94..3f9a5d0 100644 (file)
@@ -29,6 +29,16 @@ BRepAlgoAPI_Common::BRepAlgoAPI_Common()
   myOperation=BOPAlgo_COMMON;
 }
 //=======================================================================
+//function : BRepAlgoAPI_Common
+//purpose  : 
+//=======================================================================
+BRepAlgoAPI_Common::BRepAlgoAPI_Common(const BOPAlgo_PaveFiller& aPF)
+:
+  BRepAlgoAPI_BooleanOperation(aPF)
+{
+  myOperation=BOPAlgo_COMMON;
+}
+//=======================================================================
 //function : ~BRepAlgoAPI_Common
 //purpose  : 
 //=======================================================================
@@ -39,8 +49,8 @@ BRepAlgoAPI_Common::~BRepAlgoAPI_Common()
 //function : BRepAlgoAPI_Common
 //purpose  : 
 //=======================================================================
-  BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1, 
-                                         const TopoDS_Shape& S2)
+BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1, 
+                                       const TopoDS_Shape& S2)
 : BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_COMMON)
 {
   BRepAlgoAPI_BooleanOperation* pBO=
@@ -51,9 +61,9 @@ BRepAlgoAPI_Common::~BRepAlgoAPI_Common()
 //function : BRepAlgoAPI_Common
 //purpose  : 
 //=======================================================================
-  BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1, 
-                                         const TopoDS_Shape& S2,
-                                         const BOPAlgo_PaveFiller& aDSF)
+BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1, 
+                                       const TopoDS_Shape& S2,
+                                       const BOPAlgo_PaveFiller& aDSF)
 : BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, BOPAlgo_COMMON)
 {
   BRepAlgoAPI_BooleanOperation* pBO=
index 89e7772..de15578 100644 (file)
 -- commercial license or contractual agreement.
 
 class Cut from BRepAlgoAPI  
-    inherits BooleanOperation from BRepAlgoAPI
- ---Purpose:  The class Cut provides a Boolean
-     -- cut operation on a pair of arguments (Boolean Subtraction).
-     -- The class Cut provides a framework for:
-     --   -      Defining the construction of a cut shape
-     --   -      Implementing the building algorithm
-     --   -      Consulting the result
+    inherits BooleanOperation from BRepAlgoAPI 
+    
+    ---Purpose:   
+    -- The class Cut provides Boolean cut operation  
+    -- between arguments and tools (Boolean Subtraction).
 
 uses
     Shape from TopoDS,
@@ -33,20 +31,29 @@ is
         returns Cut from BRepAlgoAPI;   
     ---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Cut();"  
     --- Purpose: Empty constructor 
-        
-
+      
+    Create (PF: PaveFiller from BOPAlgo)
+        returns Cut from BRepAlgoAPI;  
+    --- Purpose: Empty constructor        
+    -- <PF> - PaveFiller object that is carried out 
+     
     Create (S1,S2 : Shape from TopoDS)  
         returns Cut from BRepAlgoAPI;  
-    ---Purpose: Shape aS2 cuts shape aS1. The
-     -- resulting shape is a new shape produced by the cut operation.
+    ---Purpose: Constructor with two shapes  
+    -- <S1>  -argument     
+    -- <S2>  -tool 
+    -- <anOperation> - the type of the operation
+    -- Obsolete   
 
     Create (S1,S2 : Shape from TopoDS; 
             aDSF  : PaveFiller  from BOPAlgo; 
             bFWD  : Boolean from Standard=Standard_True)  
         returns Cut from BRepAlgoAPI;  
-     --- Purpose: Constructs a new shape cut from
-     -- shape aS1 by shape aS2 using aDSFiller (see
-     -- BRepAlgoAPI_BooleanOperation Constructor).
-        
+    ---Purpose: Constructor with two shapes  
+    -- <S1>  -argument     
+    -- <S2>  -tool  
+    -- <anOperation> - the type of the operation 
+    -- <PF> - PaveFiller object that is carried out  
+    -- Obsolete    
+     
 end Cut;
index 5870c1e..2faf2b8 100644 (file)
@@ -29,13 +29,22 @@ BRepAlgoAPI_Cut::BRepAlgoAPI_Cut()
   myOperation=BOPAlgo_CUT;
 }
 //=======================================================================
+//function : BRepAlgoAPI_Cut
+//purpose  : 
+//=======================================================================
+BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const BOPAlgo_PaveFiller& aPF)
+:
+  BRepAlgoAPI_BooleanOperation(aPF)
+{
+  myOperation=BOPAlgo_CUT;
+}
+//=======================================================================
 //function : ~BRepAlgoAPI_Cut
 //purpose  : 
 //=======================================================================
 BRepAlgoAPI_Cut::~BRepAlgoAPI_Cut()
 {
 }
-
 //=======================================================================
 //function : BRepAlgoAPI_Cut
 //purpose  : 
@@ -58,7 +67,8 @@ BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
                                  const BOPAlgo_PaveFiller& aDSF,
                                  const Standard_Boolean bFWD)
 : 
-  BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, (bFWD) ? BOPAlgo_CUT : BOPAlgo_CUT21)
+  BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, 
+                               (bFWD) ? BOPAlgo_CUT : BOPAlgo_CUT21)
 {
   BRepAlgoAPI_BooleanOperation* pBO=
     (BRepAlgoAPI_BooleanOperation*) (void*) this;
index e775745..37a8592 100644 (file)
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
-class Fuse from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
-
- ---Purpose:  The class Fuse provides a
-     -- Boolean fusion operation on a pair of arguments (Boolean Union).
-     -- The class Fuse provides a framework for:
-     --   -       Defining the construction of a fused shape;
-     --   -       Implementing the building algorithm
-     --   -       Consulting the result.
+class Fuse from BRepAlgoAPI  
+    inherits BooleanOperation from BRepAlgoAPI
+  
+    ---Purpose:   
+    -- The class provides Boolean fusion operation  
+    -- between arguments and tools  (Boolean Union).
 
 uses
     Shape from TopoDS, 
@@ -33,14 +31,28 @@ is
         returns Fuse from BRepAlgoAPI;   
     ---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Fuse();"  
     --- Purpose: Empty constructor 
-        
+     
+    Create (PF: PaveFiller from BOPAlgo)
+        returns Fuse from BRepAlgoAPI;  
+    --- Purpose: Empty constructor      
+    -- <PF> - PaveFiller object that is carried out     
+     
     Create (S1,S2 : Shape from TopoDS)  
         returns Fuse from BRepAlgoAPI;  
-    ---Purpose: Constructs a fuse of shapes aS1 and aS2.
-  
+    ---Purpose: Constructor with two shapes  
+    -- <S1>  -argument     
+    -- <S2>  -tool      
+    -- <anOperation> - the type of the operation
+    -- Obsolete  
+     
     Create (S1,S2 : Shape from TopoDS; 
             aDSF:PaveFiller from BOPAlgo)  
         returns Fuse from BRepAlgoAPI; 
-     ---Purpose: Constructs a new shape that is a fuse of shapes aS1 and aS2 using aDSFiller. 
+    ---Purpose: Constructor with two shapes  
+    -- <S1>  -argument     
+    -- <S2>  -tool   
+    -- <anOperation> - the type of the operation 
+    -- <PF> - PaveFiller object that is carried out  
+    -- Obsolete    
     
 end Fuse;
index c3dfeb3..ae46410 100644 (file)
@@ -29,13 +29,22 @@ BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse()
   myOperation=BOPAlgo_FUSE;
 }
 //=======================================================================
+//function : BRepAlgoAPI_Fuse
+//purpose  : 
+//=======================================================================
+BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const BOPAlgo_PaveFiller& aPF)
+:
+  BRepAlgoAPI_BooleanOperation(aPF)
+{
+  myOperation=BOPAlgo_FUSE;
+}
+//=======================================================================
 //function : ~BRepAlgoAPI_Fuse
 //purpose  : 
 //=======================================================================
 BRepAlgoAPI_Fuse::~BRepAlgoAPI_Fuse()
 {
 }
-
 //=======================================================================
 //function : BRepAlgoAPI_Fuse
 //purpose  : 
@@ -49,7 +58,6 @@ BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
     (BRepAlgoAPI_BooleanOperation*) (void*) this;
   pBO->Build();
 }
-
 //=======================================================================
 //function : BRepAlgoAPI_Fuse
 //purpose  : 
index 4ec3712..cf8fc0c 100644 (file)
 
 class Section from BRepAlgoAPI  
     inherits BooleanOperation from BRepAlgoAPI
+      
+    ---Purpose:  
+    -- The algorithm is to build a Secton operation between arguments and tools. 
+    -- The result of Section operation consists of vertices and edges. 
+    -- The result of Section operation contains:
+    -- 1. new vertices that are subjects of V/V, E/E, E/F, F/F interferences
+    -- 2. vertices that are subjects of V/E, V/F interferences
+    -- 3. new edges that are subjects of F/F interferences
+    -- 4. edges that are Common Blocks
 
-     ---Purpose: Computes the intersection of two shapes or geometries.
-     -- Geometries can be surfaces of planes.
-     -- Geometries are converted to faces
-     -- When a geometry has been converted to
-     -- topology the created shape can be found using
-     -- the methods Shape1 and Shape2 inherited from the class BooleanOperation.
-     -- The result (Shape() method) is a compound containing 
-     -- edges built on intersection curves.
-     -- By default, the section is performed immediatly in 
-     -- class constructors, with default values :
-     -- - geometries built are NOT approximated.
-     -- - PCurves are NOT computed on both parts.
-     -- Example : giving two shapes S1,S2 accessing faces,
-     -- let compute the section edges R on S1,S2, 
-     -- performing approximation on new curves,
-     -- performing PCurve on part 1 but not on part 2 :
-     -- Standard_Boolean PerformNow = Standard_False;
-     -- BRepBoolAPI_Section S(S1,S2,PerformNow);
-     -- S.ComputePCurveOn1(Standard_True);
-     -- S.Approximation(Standard_True);
-     -- S.Build();
-     -- TopoDS_Shape R = S.Shape();
-     -- On Null Shapes of geometries, NotDone() is called. 
-
+    -- The vertex is included in Section only when it is not shared 
+    -- between the edges above 
+    --  --  
+   
+    -- Default values:
+    --   - geometries built are NOT approximated.
+    --   - PCurves are NOT computed on both parts.
+      
+    -- Example of use:
+    -- Standard_Boolean bRunParallel; 
+    -- Standard_Integer iErr;
+    -- BRepAlgoAPI_Section aSection; 
+    -- //  
+    -- bRunParallel=...;  //  turn  parallelism on/off 
+    -- const TopTools_ListOfShape&  aLS=...;  //  Arguments 
+    -- const TopTools_ListOfShape&  aLT=...;  //  Tools 
+    -- // 
+    -- aSection.SetRunParallel();  
+    -- aSection.SetArguments(aLS);
+    -- aSection.SetTools(aLT); 
+    -- aSection.Approximation(Standard_True);
+    -- // 
+    -- aSection.Build();  // perform the algorithm     
+    -- iErr=pBuilder->ErrorStatus();
+    -- if (iErr) {
+    --   // errors  occured 
+    --   return 0;
+    -- }  
+    -- // 
+    -- const TopoDS_Shape& aR=aSection.Shape();// the result 
+    -- //... 
+     
+    
 uses
     Pln   from gp,
     Shape from TopoDS,
     Surface from Geom,
     Curve   from Geom2d,
-    PaveFiller from BOPAlgo,
-    ListOfShape from TopTools
+    PaveFiller from BOPAlgo, 
+    Operation from BOPAlgo,
+    ListOfShape from TopTools, 
+    BaseAllocator from BOPCol
     
 is
     Create 
         returns Section from BRepAlgoAPI;   
     ---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Section();"  
     --- Purpose: Empty constructor 
-        
-    Create (S1,S2 : Shape from TopoDS; 
+  
+    Create (PF: PaveFiller from BOPAlgo)
+        returns Section from BRepAlgoAPI;  
+    --- Purpose: Empty constructor    
+    -- <PF> - PaveFiller object that is carried out  
+      
+    Create(S1 : Shape from TopoDS; 
+           S2 : Shape from TopoDS;
+           PerformNow : Boolean = Standard_True) 
+        returns Section from BRepAlgoAPI;
+    ---Purpose: Constructor with two shapes  
+    -- <S1>  -argument     
+    -- <S2>  -tool   
+    -- <PerformNow> - the flag: 
+    -- if <PerformNow>=True - the algorithm is performed immediatly 
+    -- Obsolete   
+     
+    Create (S1 : Shape from TopoDS;  
+            S2 : Shape from TopoDS; 
             aDSF:PaveFiller from BOPAlgo;
             PerformNow : Boolean = Standard_True)  
         returns Section from BRepAlgoAPI;
-    
-
-    Create(Sh1,Sh2 : Shape from TopoDS;
-            PerformNow : Boolean = Standard_True) 
-        returns Section from BRepAlgoAPI;
-    ---Purpose: see upper
-    ---Level: Public
-     
+    ---Purpose: Constructor with two shapes  
+    -- <S1>  -argument     
+    -- <S2>  -tool   
+    -- <PF> - PaveFiller object that is carried out        
+    -- <PerformNow> - the flag: 
+    -- if <PerformNow>=True - the algorithm is performed immediatly 
+    -- Obsolete   
 
-    Create(Sh : Shape from TopoDS;  
-            Pl : Pln from gp;
-            PerformNow : Boolean = Standard_True) 
+    Create(S1 : Shape from TopoDS;  
+           Pl : Pln from gp;
+           PerformNow : Boolean = Standard_True) 
         returns Section from BRepAlgoAPI;
-     ---Purpose: see upper
-     ---Level: Public
+    ---Purpose: Constructor with two shapes  
+    -- <S1>  - argument
+    -- <Pl>  - tool  
+    -- <PerformNow> - the flag: 
+    -- if <PerformNow>=True - the algorithm is performed immediatly 
+    -- Obsolete   
      
 
-    Create(Sh : Shape from TopoDS;  
-            Sf : Surface from Geom;
-            PerformNow : Boolean = Standard_True) 
+    Create(S1 : Shape from TopoDS;  
+           Sf : Surface from Geom;
+           PerformNow : Boolean = Standard_True) 
         returns Section from BRepAlgoAPI;
-     ---Purpose: see upper
-     ---Level: Public
+     ---Purpose: Constructor with two shapes   
+     -- <S1>  - argument
+     -- <Sf>  - tool  
+     -- <PerformNow> - the flag: 
+     -- if <PerformNow>=True - the algorithm is performed immediatly 
+     -- Obsolete    
      
 
     Create(Sf : Surface from Geom;  
-            Sh : Shape from TopoDS;
-            PerformNow : Boolean = Standard_True) 
+           S2 : Shape from TopoDS;
+           PerformNow : Boolean = Standard_True) 
         returns Section from BRepAlgoAPI;
-     ---Purpose: see upper
-     ---Level: Public
+     ---Purpose: Constructor with two shapes   
+     -- <Sf>  - argument
+     -- <S2>  - tool  
+     -- <PerformNow> - the flag: 
+     -- if <PerformNow>=True - the algorithm is performed immediatly 
+     -- Obsolete
  
     Create(Sf1 : Surface from Geom;  
-            Sf2 : Surface from Geom;
-            PerformNow : Boolean = Standard_True) 
+           Sf2 : Surface from Geom;
+           PerformNow : Boolean = Standard_True) 
         returns Section from BRepAlgoAPI;
-     ---Purpose: This and the above classes construct a framework for
-     -- computing the section lines of:
-     -- -       two shapes Sh1 and Sh2, or
-     -- -       shape Sh and plane Pl,  or
-     -- -       shape Sh and surface Sf, or
-     -- -       surface Sf and shape Sh, or
-     -- -       two surfaces Sf1 and Sf2,
-     --   and builds a result if PerformNow equals true, its
-     -- default value. If PerformNow equals false, the intersection
-     -- will be computed later by the function Build.
-     --  The constructed shape will be returned by the function Shape.
-     -- This is a compound object composed of edges. These
-     -- intersection edges may be built:
-     -- -      on new intersection lines, or
-     -- -      on coincident portions of edges in the two intersected    shapes.
-     --   These intersection edges are independent: they are not
-     -- chained or grouped in wires. If no intersection edge exists, the
-     -- result is an empty compound object.
-     -- Note that other objects than TopoDS_Shape shapes involved in
-     -- these syntaxes are converted into faces or shells before
-     -- performing the computation of the intersection. A shape
-     -- resulting from this conversion can be retrieved with the
-     -- function Shape1 or Shape2.
-     -- Parametric 2D curves on intersection edges
-     -- No parametric 2D curve (pcurve) is defined for each elementary
-     -- edge of the result. To attach such parametric curves to the
-     -- constructed edges you may use a constructor with the PerformNow
-     -- flag equal to false; then you use:
-     -- -      the function ComputePCurveOn1 to ask for
-     --    the additional computation of a pcurve in the parametric
-     --    space of the first shape,
-     -- -      the function ComputePCurveOn2 to ask for
-     --    the additional computation of a pcurve in the parametric
-     --    space of the second shape, in the end,
-     -- -      the function Build to construct the result.
-     --   Approximation of intersection edges
-     --   The underlying 3D geometry attached to each elementary edge
-     -- of the result is:
-     -- -       analytic where possible, provided the corresponding
-     --    geometry corresponds to a type of analytic curve
-     --    defined in the Geom package; for example, the intersection
-     --    of a cylindrical shape with a plane gives an ellipse or a    circle;
-     -- -       or elsewhere, given as a succession of points grouped
-     --    together in a BSpline curve of degree 1.
-     -- If you prefer to have an attached 3D geometry which is a
-     -- BSpline approximation of the computed set of points on
-     -- computed elementary intersection edges whose underlying geometry
-     -- is not analytic, you may use a constructor with the PerformNow
-     -- flag equal to false. Then you use:
-     -- -      the function Approximation to ask for this
-     --    computation option, and
-     -- -      the function Build to construct the result.
-     -- -      Note that as a result, approximations will only be
-     --    computed on edges built on new intersection lines.
-     -- -      Example
-     -- You may also combine these computation options. In the following example:
-     -- - each elementary edge of the computed intersection,
-     --   built on a new intersection line, which does not
-     --  correspond to an analytic Geom curve, will be approximated by
-     --   a BSpline curve whose degree is not greater than 8.
-     -- - each elementary edge built on a new intersection line, will have:
-     -- - a pcurve in the parametric space of the intersected face of shape S1,
-     -- - no pcurve in the parametric space of the intersected face of shape S2.
-     --       // TopoDS_Shape S1 = ... , S2 = ... ;
-     -- Standard_Boolean PerformNow = Standard_False;
-     -- BRepAlgoAPI_Section S ( S1, S2, PerformNow );
-     -- S.ComputePCurveOn1 (Standard_True);
-     -- S.Approximation (Standard_True);
-     -- S.Build();
-     -- TopoDS_Shape R = S.Shape();
+     ---Purpose:  
+     ---Purpose: Constructor with two shapes   
+     -- <Sf1>  - argument
+     -- <Sf2>  - tool  
+     -- <PerformNow> - the flag: 
+     -- if <PerformNow>=True - the algorithm is performed immediatly 
+     -- Obsolete 
 
     Init1(me : out; 
             S1 : Shape from TopoDS);
-     ---Purpose: initialize first part
-     ---Level: Public
+    ---Purpose: initialize the argument  
+    -- <S1>  - argument
+    -- Obsolete 
+     
     Init1(me : out; 
-            Pl : Pln from gp);
-     ---Purpose: initialize first part
-     ---Level: Public
+            Pl : Pln from gp); 
+    ---Purpose: initialize the argument  
+    -- <Pl>  - argument
+    -- Obsolete  
+        
     Init1(me : out; 
             Sf : Surface from Geom);
-     ---Purpose: initialize first part
-     ---Level: Public
+    ---Purpose: initialize the argument 
+    -- <Sf>  - argument
+    -- Obsolete 
+     
     Init2(me : out; 
             S2 : Shape from TopoDS);
-     ---Purpose: initialize second part
-     ---Level: Public
+    ---Purpose: initialize the tool 
+    -- <S2>  - tool
+    -- Obsolete 
+     
     Init2(me : out; 
             Pl : Pln from gp);
-     ---Purpose: initialize second part
-     ---Level: Public
+    ---Purpose: initialize the tool 
+    -- <Pl>  - tool
+    -- Obsolete  
  
     Init2(me : out; 
             Sf : Surface from Geom);
-     ---Purpose: Reinitializes the first and the
-     -- second parts on which this algorithm is going to perform
-     -- the intersection computation. This is done with either: the
-     -- surface Sf, the plane Pl or the shape Sh.
-     -- You use the function Build to construct the result.
+    ---Purpose: initialize the tool 
+    -- <Sf>  - tool
+    -- Obsolete   
+    
     Approximation(me : out; 
         B : Boolean from Standard);
-     ---Level: Public
-     ---Purpose: Defines an option for computation
-     -- of further intersections. This computation will be performed by
-     -- the function Build in this framework.
-     -- By default, the underlying 3D geometry attached to each
-     -- elementary edge of the result of a computed intersection is:
-     -- - analytic where possible, provided the corresponding
-     --    geometry corresponds to a type of analytic curve defined in
-     --    the Geom package; for example the intersection of a
-     --    cylindrical shape with a plane gives an ellipse or a circle;
-     -- -      or elsewhere, given as a succession of points grouped
-     -- together in a BSpline curve of degree 1. If Approx equals
-     -- true, when further computations are performed in this framework
-     -- with the function Build, these edges will have an attached 3D
-     --    geometry which is a BSpline approximation of the computed
-     --    set of points.
-     --   Note that as a result, approximations will be computed
-     -- on edges built only on new intersection lines.
+    ---Purpose:  
+    --Defines an option for computation
+    -- of further intersections. 
+    -- By default, the underlying 3D geometry attached to each
+    -- elementary edge of the result is:
+    -- - analytic where possible, provided the corresponding
+    --   geometry corresponds to a type of analytic curve defined in
+    -- - or elsewhere, given as a succession of points grouped
+    --   together in a BSpline curve of degree 1.  
+    --   If Approx equals true, these edges will have an attached 3D
+    --   geometry which is a BSpline approximation of the computed
+    --   set of points.
+    --   Note that as a result, approximations will be computed
+    --   on edges built only on new intersection curves.
  
     ComputePCurveOn1(me : out; 
         B : Boolean from Standard);
-     ---Level: Public
-     ---Purpose: 
-     -- Indicates if the Pcurve must be (or not) performed on first part. 
-
+    ---Purpose: 
+    -- Indicates whether the P-Curve should be (or not)  
+    -- performed on the argument. 
+    -- By default, no parametric 2D curve (pcurve) is defined for the
+    -- edges of the result.  
+    -- If ComputePCurve1 equals true, further computations performed  
+    -- to attach an P-Curve in the parametric space of the argument  
+    -- to the constructed edges. 
+    -- Obsolete   
     ComputePCurveOn2(me : out; 
             B : Boolean from Standard);
-     ---Level: Public
-     ---Purpose: Define options for the computation of further
-     -- intersections, which will be performed by the function Build
-     -- in this framework.
-     -- By default, no parametric 2D curve (pcurve) is defined for the
-     -- elementary edges of the result. If ComputePCurve1 equals true,
-     -- further computations performed in this framework with the function
-     -- Build will attach an additional pcurve in the parametric space of
-     -- the first shape to the constructed edges.
-     -- If ComputePCurve2 equals true, the additional pcurve will be
-     -- attached to the constructed edges in the parametric space of the
-     -- second shape.
-     -- These two functions may be used together.
-    Build(me : in out) 
-        is redefined;
-     ---Purpose:  Performs the computation of
-     -- section lines between two parts defined at the time of
-     -- construction of this framework or reinitialized with the Init1 and
-     -- Init2 functions.
-     -- The constructed shape will be returned by the function Shape.
-     -- This is a compound object composed of edges. These
-     -- intersection edges may be built:
-     -- -      on new intersection lines, or
-     -- -      on coincident portions of edges in the two intersected shapes.
-     -- These intersection edges are independent: they are not chained
-     -- or grouped into wires.
-     -- If no intersection edge exists, the result is an empty compound object.
-     -- The shapes involved in the construction of section lines can
-     -- be retrieved with the function Shape1 or Shape2. Note that other
-     -- objects than TopoDS_Shape shapes given as arguments at the
-     -- construction time of this framework, or to the Init1 or
-     -- Init2 function, are converted into faces or shells before
-     -- performing the computation of the intersection.
-     -- Parametric 2D curves on intersection edges
-     -- No parametric 2D curve (pcurve) is defined for the elementary
-     -- edges of the result. To attach parametric curves like this to
-     -- the constructed edges you have to use:
-     -- -      the function
-     -- ComputePCurveOn1 to ask for the additional computation of a
-     -- pcurve in the parametric space of the first shape,
-     -- -      the function
-     --    ComputePCurveOn2 to ask for the additional computation of a
-     --    pcurve in the parametric space of the second shape.
-     -- This must be done before calling this function.
-     --   Approximation of intersection edges
-     -- The underlying 3D geometry attached to each elementary edge of the result is:
-     -- -      analytic (where possible) provided the corresponding
-     -- geometry corresponds to a type of analytic curve defined in
-     --    the Geom package; for example, the intersection of a
-     --    cylindrical shape with a plane gives an ellipse or a circle;    or
-     -- -      elsewhere, given as a succession of points grouped
-     --    together in a BSpline curve of degree 1.
-     --   If, on computed elementary intersection edges whose
-     -- underlying geometry is not analytic, you prefer to have an
-     -- attached 3D geometry which is a Bspline approximation of the
-     -- computed set of points, you have to use the function Approximation
-     -- to ask for this computation option before calling this function.
-     -- You may also have combined these computation options: look at the
-     -- example given above to illustrate the use of the constructors.
+    ---Purpose:  
+    -- Indicates whether the P-Curve should be (or not)  
+    -- performed on the tool.  
+    -- By default, no parametric 2D curve (pcurve) is defined for the
+    -- edges of the result.  
+    -- If ComputePCurve1 equals true, further computations performed  
+    -- to attach an P-Curve in the parametric space of the tool  
+    -- to the constructed edges.
+    -- Obsolete   
      
-
+    Build(me : in out) 
+        is redefined;   
+    ---Purpose: Performs the algorithm 
+    -- Filling interference Data Structure (if it is necessary)
+    -- Building the result of the operation. 
     HasAncestorFaceOn1(me;  
             E : Shape from TopoDS;
             F : out Shape from TopoDS)
         returns Boolean from Standard;
-     ---Level: Public
      ---Purpose:
      -- get the face of the first part giving section edge <E>.
      -- Returns True on the 3 following conditions :
-     -- 1/ <E> is an edge returned by the Shape() method. 
+     -- 1/ <E> is an edge returned by the Shape() metwod. 
      -- 2/ First part of section performed is a shape.
      -- 3/ <E> is built on a intersection curve (i.e <E>
      --   is not the result of common edges)
      -- When False, F remains untouched.
-
+    -- Obsolete   
+    
     HasAncestorFaceOn2(me;  
             E : Shape from TopoDS;
             F : out Shape from TopoDS)
@@ -330,15 +272,20 @@ is
      -- To use these functions properly, you have to test the returned
      -- Boolean value before using the ancestor face: F is significant
      -- only if the returned Boolean value equals true.
-
-    InitParameters(me: out) 
-        is private;
-    ---Level: Private
+    -- Obsolete   
      
-
+    --
+    --  protected methods 
+    --
+    Init(me: out; 
+            PerformNow : Boolean) 
+        is protected;
+    
+    SetAttributes (me:out) 
+        is redefined protected;   
 fields
-    myshapeisnull       : Boolean from Standard;
-    myparameterschanged : Boolean from Standard;
+    myParametersChanged : Boolean from Standard;
     myApprox            : Boolean from Standard;
     myComputePCurve1    : Boolean from Standard;
     myComputePCurve2    : Boolean from Standard;
index b5255d1..b80442b 100644 (file)
 #include <TopoDS_Face.hxx>
 #include <BRep_Tool.hxx>
 
+#include <BOPDS_DS.hxx>
 #include <BOPAlgo_PaveFiller.hxx>
 #include <BOPAlgo_BOP.hxx>
-#include <BOPDS_DS.hxx>
+#include <BOPAlgo_Section.hxx>
 
 //
 static 
@@ -45,7 +46,12 @@ static
                                     const TopoDS_Shape&,
                                     TopoDS_Shape&,
                                     TopoDS_Shape&);
-
+static
+  Standard_Boolean HasAncestorFace (const BOPAlgo_PPaveFiller& ,
+                                    Standard_Integer ,
+                                    const TopoDS_Shape& ,
+                                    TopoDS_Shape& ); 
+//
 //=======================================================================
 //function : BRepAlgoAPI_Section
 //purpose  : 
@@ -54,27 +60,17 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section()
 :
   BRepAlgoAPI_BooleanOperation()
 {
-  myOperation=BOPAlgo_SECTION;
-  InitParameters(); 
-}
-//=======================================================================
-//function : ~BRepAlgoAPI_Section
-//purpose  : 
-//=======================================================================
-BRepAlgoAPI_Section::~BRepAlgoAPI_Section()
-{
+  Init(Standard_False);
 }
 //=======================================================================
-//function : InitParameters
+//function : BRepAlgoAPI_Section
 //purpose  : 
 //=======================================================================
-void BRepAlgoAPI_Section::InitParameters() 
+BRepAlgoAPI_Section::BRepAlgoAPI_Section(const BOPAlgo_PaveFiller& aPF)
+:
+  BRepAlgoAPI_BooleanOperation(aPF)
 {
-  myparameterschanged = Standard_False;
-  myshapeisnull = Standard_False;
-  myApprox = Standard_False;
-  myComputePCurve1 = Standard_False;
-  myComputePCurve2 = Standard_False;
+  Init(Standard_False);
 }
 //=======================================================================
 //function : Constructor
@@ -84,17 +80,11 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh1,
                                          const TopoDS_Shape& Sh2,
                                          const Standard_Boolean PerformNow)
 :
-  BRepAlgoAPI_BooleanOperation(Sh1, Sh2, BOPAlgo_SECTION)
+  BRepAlgoAPI_BooleanOperation(Sh1, 
+                               Sh2, 
+                               BOPAlgo_SECTION)
 {
-  InitParameters();
-  myparameterschanged = Standard_True;
-
-  if(myS1.IsNull() || myS2.IsNull()) {
-    myshapeisnull = Standard_True;
-  }
-  if (PerformNow) {
-    Build();
-  }
+  Init(PerformNow); 
 }
 //=======================================================================
 //function : BRepAlgoAPI_Section
@@ -106,18 +96,12 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
    const BOPAlgo_PaveFiller& aDSF,
    const Standard_Boolean   PerformNow)
 : 
-  BRepAlgoAPI_BooleanOperation(aS1, aS2, aDSF, BOPAlgo_SECTION)
+  BRepAlgoAPI_BooleanOperation(aS1, 
+                               aS2, 
+                               aDSF,
+                               BOPAlgo_SECTION)
 {
-  InitParameters();
-  myparameterschanged = Standard_True;
-
-  if(myS1.IsNull() || myS2.IsNull()) {
-    myshapeisnull = Standard_True;
-  }
-
-  if (PerformNow) {
-    Build();
-  }
+  Init(PerformNow); 
 }
 //=======================================================================
 //function : Constructor
@@ -128,18 +112,11 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
    const gp_Pln&          Pl,
    const Standard_Boolean PerformNow)
 : 
-  BRepAlgoAPI_BooleanOperation(Sh, MakeShape(new Geom_Plane(Pl)), 
+  BRepAlgoAPI_BooleanOperation(Sh, 
+                               MakeShape(new Geom_Plane(Pl)), 
                                BOPAlgo_SECTION)
 {
-  InitParameters();
-  myparameterschanged = Standard_True;
-
-  if(Sh.IsNull() || myS2.IsNull()) {
-    myshapeisnull = Standard_True;
-  }
-  if (PerformNow) {
-    Build();
-  }
+  Init(PerformNow); 
 }
 //=======================================================================
 //function : Constructor
@@ -150,17 +127,11 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
    const Handle(Geom_Surface)& Sf,
    const Standard_Boolean      PerformNow)
 : 
-  BRepAlgoAPI_BooleanOperation(Sh, MakeShape(Sf), BOPAlgo_SECTION)
+  BRepAlgoAPI_BooleanOperation(Sh, 
+                               MakeShape(Sf), 
+                               BOPAlgo_SECTION)
 {
-  InitParameters();
-  myparameterschanged = Standard_True;
-
-  if(Sh.IsNull() || myS2.IsNull()) {
-    myshapeisnull = Standard_True;
-  }
-  if (PerformNow) {
-    Build();
-  }
+  Init(PerformNow); 
 }
 //=======================================================================
 //function : Constructor
@@ -171,17 +142,11 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
    const TopoDS_Shape&         Sh,
    const Standard_Boolean      PerformNow)
 : 
-  BRepAlgoAPI_BooleanOperation(MakeShape(Sf), Sh, BOPAlgo_SECTION)
+  BRepAlgoAPI_BooleanOperation(MakeShape(Sf), 
+                               Sh, 
+                               BOPAlgo_SECTION)
 {
-  InitParameters();
-  myparameterschanged = Standard_True;
-
-  if(myS1.IsNull() || Sh.IsNull()) {
-    myshapeisnull = Standard_True;
-  }
-  if (PerformNow) {
-    Build();
-  }
+  Init(PerformNow); 
 }
 //=======================================================================
 //function : Constructor
@@ -196,14 +161,29 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
                                MakeShape(Sf2), 
                                BOPAlgo_SECTION)
 {
-  InitParameters();
-  myparameterschanged = Standard_True;
-
-  if(myS1.IsNull() || myS2.IsNull()) {
-    myshapeisnull = Standard_True;
-  }
-
-  if (PerformNow) {
+  Init(PerformNow); 
+}
+//=======================================================================
+//function : ~BRepAlgoAPI_Section
+//purpose  : 
+//=======================================================================
+BRepAlgoAPI_Section::~BRepAlgoAPI_Section()
+{
+}
+//=======================================================================
+//function : Init
+//purpose  : 
+//=======================================================================
+void BRepAlgoAPI_Section::Init(const Standard_Boolean bFlag) 
+{
+  myOperation=BOPAlgo_SECTION;
+  myParametersChanged = Standard_False;
+  myApprox = Standard_False;
+  myComputePCurve1 = Standard_False;
+  myComputePCurve2 = Standard_False;
+  myParametersChanged = Standard_True;
+  // 
+  if (bFlag) {
     Build();
   }
 }
@@ -213,26 +193,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
 //=======================================================================
 void BRepAlgoAPI_Section::Init1(const TopoDS_Shape& S1) 
 {
-  if(!S1.IsNull()) {
-    if (!S1.IsEqual(myS1)) {
-      myS1 = S1;
-
-      if(!myS2.IsNull()) {
-        myshapeisnull = Standard_False;
-      }
-      myparameterschanged = Standard_True;
-    }
-  }
-  else {
-    if(!myS1.IsNull()) {
-      myS1 = S1;
-      myshapeisnull = Standard_True;
-      myparameterschanged = Standard_True;
-    }
-  }
-
-  if(myparameterschanged)
-    NotDone();
+  myArguments.Clear();
+  myArguments.Append(S1);
+  myParametersChanged = Standard_True;
 }
 //=======================================================================
 //function : Init1
@@ -256,27 +219,9 @@ void BRepAlgoAPI_Section::Init1(const Handle(Geom_Surface)& Sf)
 //=======================================================================
 void BRepAlgoAPI_Section::Init2(const TopoDS_Shape& S2) 
 {
-  if(!S2.IsNull()) {
-    if (!S2.IsEqual(myS2)) {
-      myS2 = S2;
-
-      if(!myS1.IsNull()) {
-        myshapeisnull = Standard_False;
-      }
-      myparameterschanged = Standard_True;
-    }
-  }
-  else {
-    if(!myS2.IsNull()) {
-      myS2 = S2;
-      myshapeisnull = Standard_True;
-      myparameterschanged = Standard_True;
-    }
-  }
-
-  if(myparameterschanged) {
-    NotDone();
-  }
+  myTools.Clear();
+  myTools.Append(S2);
+  myParametersChanged = Standard_True;
 }
 //=======================================================================
 //function : Init2
@@ -302,7 +247,7 @@ void BRepAlgoAPI_Section::Approximation(const Standard_Boolean B)
 {
   if(myApprox != B) {
     myApprox = B;
-    myparameterschanged = Standard_True;
+    myParametersChanged = Standard_True;
   }
 }
 //=======================================================================
@@ -313,7 +258,7 @@ void BRepAlgoAPI_Section::ComputePCurveOn1(const Standard_Boolean B)
 {
   if(myComputePCurve1 != B) {
     myComputePCurve1 = B;
-    myparameterschanged = Standard_True;
+    myParametersChanged = Standard_True;
   }
 }
 //=======================================================================
@@ -324,133 +269,125 @@ void BRepAlgoAPI_Section::ComputePCurveOn2(const Standard_Boolean B)
 {
   if(myComputePCurve2 != B) {
     myComputePCurve2 = B;
-    myparameterschanged = Standard_True;
+    myParametersChanged = Standard_True;
   }
 }
 //=======================================================================
+//function : SetAttributes
+//purpose  : 
+//=======================================================================
+void BRepAlgoAPI_Section::SetAttributes()
+{
+  BOPAlgo_SectionAttribute theSecAttr(myApprox, 
+          myComputePCurve1, 
+          myComputePCurve2);
+  myDSFiller->SetSectionAttribute(theSecAttr);
+}
+//=======================================================================
 //function : Build
 //purpose  : 
 //=======================================================================
 void BRepAlgoAPI_Section::Build() 
 {
-  if(myshapeisnull) {
-    myErrorStatus = 2;
-    NotDone();
-    return;
-  }
-
-  if(myparameterschanged) {
-    Standard_Boolean bIsNewFiller = PrepareFiller();
-    //
-    if (myErrorStatus!=1) {
-      NotDone();
-      // there were errors during the preparation 
-      return;
-    }
-    //
-    if (bIsNewFiller) {
-      BOPAlgo_SectionAttribute theSecAttr(myApprox, 
-                                          myComputePCurve1, 
-                                          myComputePCurve2);
-      myDSFiller->SetSectionAttribute(theSecAttr);
-      myDSFiller->Perform();
-    }
-    //
-    BRepAlgoAPI_BooleanOperation::Build();
-    //
-    myparameterschanged = Standard_False;
-  }
+  BRepAlgoAPI_BooleanOperation::Build();
 }
 //=======================================================================
 //function : HasAncestorFaceOn1
 //purpose  : 
 //=======================================================================
 Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn1
-  (const TopoDS_Shape& E, 
-   TopoDS_Shape& F) const
+  (const TopoDS_Shape& aE, 
+   TopoDS_Shape& aF) const
 {
-  Standard_Boolean aResult = Standard_False;
-  if(E.IsNull()) {
-    return aResult;
-  }
-
-  if(E.ShapeType() != TopAbs_EDGE) {
-    return aResult;
-  }
-  TopoDS_Shape F1, F2;
-  aResult = HasAncestorFaces(myDSFiller, E, F1, F2);
-
-  if(F1.IsNull()) {
-    return Standard_False;
-  }
-  F = F1;
-  return aResult;
+  Standard_Boolean bRes;
+  //
+  bRes = HasAncestorFace(myDSFiller,1 , aE, aF);
+  return bRes;
 }
 //=======================================================================
 //function : HasAncestorFaceOn2
 //purpose  : 
 //=======================================================================
 Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn2
-  (const TopoDS_Shape& E,
-   TopoDS_Shape& F) const
+  (const TopoDS_Shape& aE,
+   TopoDS_Shape& aF) const
+{
+  Standard_Boolean bRes;
+  //
+  bRes = HasAncestorFace(myDSFiller, 2, aE, aF);
+  return bRes;
+}
+//=======================================================================
+//function : HasAncestorFace
+//purpose  : 
+//=======================================================================
+Standard_Boolean HasAncestorFace (const BOPAlgo_PPaveFiller& pPF,
+                                  Standard_Integer aIndex,
+                                  const TopoDS_Shape& aE,
+                                  TopoDS_Shape& aF) 
 {
-  Standard_Boolean aResult = Standard_False;
-  if(E.IsNull()) {
-    return aResult;
+  Standard_Boolean bRes;
+  //
+  bRes = Standard_False;
+  if(aE.IsNull()) {
+    return bRes;
   }
-
-  if(E.ShapeType() != TopAbs_EDGE) {
-    return aResult;
+  if(aE.ShapeType() != TopAbs_EDGE) {
+    return bRes;
   }
-  TopoDS_Shape F1, F2;
-  aResult = HasAncestorFaces(myDSFiller, E, F1, F2);
-
-  if(F2.IsNull()) {
-    return Standard_False;
+  //
+  TopoDS_Shape aF1, aF2;
+  //
+  bRes=HasAncestorFaces(pPF, aE, aF1, aF2);
+  if (!bRes) {
+    return bRes;
   }
-  F = F2;
-  return aResult;
+  //
+  aF=(aIndex==1) ? aF1 : aF2;
+  return bRes;
 }
 
 //=======================================================================
 //function : HasAncestorFaces
 //purpose  : 
 //=======================================================================
-Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller
-                                  const TopoDS_Shape& E,
-                                  TopoDS_Shape& F1,
-                                  TopoDS_Shape&F2) 
+Standard_Boolean HasAncestorFaces (const BOPAlgo_PPaveFiller& pPF
+                                   const TopoDS_Shape& aEx,
+                                   TopoDS_Shape& aF1,
+                                   TopoDS_Shape& aF2) 
 {
   
-  Standard_Integer aNb, i, j, nE, nF1, nF2, aNbCurves;
+  Standard_Integer aNbFF, i, j, nE, nF1, nF2, aNbVC;
+  BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
   //
-  const BOPDS_PDS& pDS = theDSFiller->PDS();
+  const BOPDS_PDS& pDS = pPF->PDS();
   BOPDS_VectorOfInterfFF& aFFs=pDS->InterfFF();
   //
-  aNb=aFFs.Extent();
   //section edges
-  for (i = 0; i < aNb; i++) {
+  aNbFF=aFFs.Extent();
+  for (i = 0; i<aNbFF; ++i) {
     BOPDS_InterfFF& aFFi=aFFs(i);
     aFFi.Indices(nF1, nF2);
     //
-    const BOPDS_VectorOfCurve& aSeqOfCurve=aFFi.Curves();
-    aNbCurves=aSeqOfCurve.Extent();
-    for (j=0; j<aNbCurves; j++) {
-      const BOPDS_Curve& aCurve=aSeqOfCurve(j);
-
-      const BOPDS_ListOfPaveBlock& aSectEdges = aCurve.PaveBlocks();
-
-      BOPDS_ListIteratorOfListOfPaveBlock anIt;
-      anIt.Initialize(aSectEdges);
-
-      for(; anIt.More(); anIt.Next()) {
-        const Handle(BOPDS_PaveBlock)& aPB = anIt.Value();
+    const BOPDS_VectorOfCurve& aVC=aFFi.Curves();
+    aNbVC=aVC.Extent();
+    for (j=0; j<aNbVC; j++) {
+      const BOPDS_Curve& aBC=aVC(j);
+      //
+      const BOPDS_ListOfPaveBlock& aLPB = aBC.PaveBlocks();
+      //
+      aItLPB.Initialize(aLPB);
+      for(; aItLPB.More(); aItLPB.Next()) {
+        const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
         nE = aPB->Edge();
-        if(nE < 0)  continue;
+        if(nE < 0)  {
+          continue;
+        }
         //
-        if(E.IsSame(pDS->Shape(nE))) {
-          F1 = pDS->Shape(nF1);
-          F2 = pDS->Shape(nF2);
+        const TopoDS_Shape aE=pDS->Shape(nE);
+        if(aEx.IsSame(aE)) {
+          aF1 = pDS->Shape(nF1);
+          aF2 = pDS->Shape(nF2);
           return Standard_True;
         }
       }
index 244a478..dc97cac 100644 (file)
@@ -104,7 +104,6 @@ QANewModTopOpe_Glue::QANewModTopOpe_Glue(const TopoDS_Shape& theS1,
   if (thePerformNow)
     Build();
 }
-
 //=======================================================================
 //function : Build
 //purpose  : 
@@ -112,6 +111,9 @@ QANewModTopOpe_Glue::QANewModTopOpe_Glue(const TopoDS_Shape& theS1,
 
 void QANewModTopOpe_Glue::Build() 
 {
+  TopoDS_Shape& myS1=myArguments.First();
+  TopoDS_Shape& myS2=myTools.First();
+
   if (myCompleted) return;
 
   TopAbs_ShapeEnum aType1, aType2;
index b0390b7..f88f57e 100644 (file)
@@ -323,6 +323,9 @@ Standard_Boolean QANewModTopOpe_Glue::SubstitudeSDFaces
 void
 QANewModTopOpe_Glue::PerformSDFaces()
 {
+  TopoDS_Shape& myS1=myArguments.First();
+  TopoDS_Shape& myS2=myTools.First();
+
   TopExp_Explorer anExp;
   TopoDS_Shape aS1, aS2;
   Standard_Boolean aWire1 = Standard_False, aWire2 = Standard_False; 
index d6e0420..da7fdc5 100644 (file)
@@ -322,7 +322,9 @@ CorrectAncestorsList (const TopoDS_Edge& theEdge, TopTools_ListOfShape& aListF)
 void
 QANewModTopOpe_Glue::PerformShell() 
 {
-//  Standard_Boolean isSolidShell = (myS1.ShapeType() == TopAbs_SOLID);
+  TopoDS_Shape& myS1=myArguments.First();
+  TopoDS_Shape& myS2=myTools.First();
+
   Standard_Boolean isSolidShell = Standard_False;
   Standard_Integer i;
 
index d78fd4c..4a1d634 100644 (file)
@@ -32,6 +32,9 @@
 void
 QANewModTopOpe_Glue::PerformVertex() 
 {
+  TopoDS_Shape& myS1=myArguments.First();
+  TopoDS_Shape& myS2=myTools.First();
+
   BRepExtrema_DistShapeShape aExtrema (myS1, myS2);
   if (!aExtrema.IsDone()) return;
   if (aExtrema.InnerSolution()) {
@@ -43,7 +46,9 @@ QANewModTopOpe_Glue::PerformVertex()
     TopTools_ListOfShape aList;
     aList.Append (aV);
     myMapGener.Bind(myS1, aList);
-        
+
+   
+    
     myShape = myS1;
     myShape.Orientation(myS1.Orientation());
     Done();
index 3fc3dd3..b60f1b3 100644 (file)
@@ -575,6 +575,9 @@ UpdateEdgeOnFace (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace)
 void
 QANewModTopOpe_Glue::PerformShellWire() 
 {
+  TopoDS_Shape& myS1=myArguments.First();
+  TopoDS_Shape& myS2=myTools.First();
+
   Standard_Boolean anOnlyOneFace = Standard_False;
   BRep_Builder aBld;
   if(myS1.ShapeType() == TopAbs_FACE) {
@@ -1258,6 +1261,9 @@ static void FillMapModif(const BRepTools_Substitution       &theSubst,
 void
 QANewModTopOpe_Glue::PerformWires() 
 {
+  TopoDS_Shape& myS1=myArguments.First();
+  TopoDS_Shape& myS2=myTools.First();
+
   Standard_Boolean S1IsEdge = Standard_False, S2IsEdge = Standard_False;
   if(myS1.ShapeType() == TopAbs_EDGE) {
     myS1 = BRepBuilderAPI_MakeWire(TopoDS::Edge(myS1));
index 1726cf2..54ab354 100644 (file)
@@ -13,8 +13,9 @@
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
-class Intersection from QANewModTopOpe inherits BooleanOperation from BRepAlgoAPI 
-
+class Intersection from QANewModTopOpe   
+    inherits BooleanOperation from BRepAlgoAPI 
 ---Purpose: provides  intersection  of  two  shapes;
  
 uses
index fd22400..2cd7663 100644 (file)
@@ -46,10 +46,19 @@ static Standard_Boolean NoFaces(const TopoDS_Shape& S1, const TopoDS_Shape& S2)
   return !f1&&!f2;
 }
 
-QANewModTopOpe_Intersection::QANewModTopOpe_Intersection( const TopoDS_Shape& theObject1, 
-                                               const TopoDS_Shape& theObject2 )
-: BRepAlgoAPI_BooleanOperation( theObject1, theObject2, BOPAlgo_SECTION)
+//=======================================================================
+//function : QANewModTopOpe_Intersection
+//purpose  : 
+//=======================================================================
+QANewModTopOpe_Intersection::QANewModTopOpe_Intersection
+  ( const TopoDS_Shape& theObject1, 
+   const TopoDS_Shape& theObject2 )
+: 
+  BRepAlgoAPI_BooleanOperation( theObject1, theObject2, BOPAlgo_SECTION)
 {
+  TopoDS_Shape& myS1=myArguments.First();
+  TopoDS_Shape& myS2=myTools.First();
+
   myMapGener.Clear();
 
   if(NoFaces(myS1, myS2)) {
@@ -100,14 +109,14 @@ QANewModTopOpe_Intersection::QANewModTopOpe_Intersection( const TopoDS_Shape& th
              BB.Add(myShape, mkV.Vertex());
 
              if (!myMapGener.IsBound(DSS. SupportOnShape1(i))) {
-               // for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(DSS.SupportOnShape1(i), TopTools_ListOfShape());
+               
                 TopTools_ListOfShape aListOfShape1;
                myMapGener.Bind(DSS.SupportOnShape1(i), aListOfShape1);
               }
              myMapGener(DSS.SupportOnShape1(i)).Append(mkV.Vertex());
 
              if (!myMapGener.IsBound(DSS.SupportOnShape2(i))) {
-               // for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(DSS.SupportOnShape2(i), TopTools_ListOfShape());
+               
                 TopTools_ListOfShape aListOfShape2;
                myMapGener.Bind(DSS.SupportOnShape2(i), aListOfShape2);
               }
@@ -123,20 +132,6 @@ QANewModTopOpe_Intersection::QANewModTopOpe_Intersection( const TopoDS_Shape& th
     Done();
     return;
   }
-
-  Standard_Boolean bIsNewFiller = PrepareFiller();
-    //
-  if (myErrorStatus!=1) {
-    // there were errors during the preparation 
-    return;
-  }
-  //
-  if (bIsNewFiller) {
-    //Prepare the DS
-    myDSFiller->Perform();
-
-  }
-
   Build();
 
   Standard_Boolean bcw = BuilderCanWork();
@@ -329,6 +324,9 @@ Standard_Boolean QANewModTopOpe_Intersection::IsDeleted(const TopoDS_Shape& aS)
 //=======================================================================
 Standard_Boolean QANewModTopOpe_Intersection::HasDeleted() const
 {
+  const TopoDS_Shape& myS1=myArguments.First();
+  const TopoDS_Shape& myS2=myTools.First();
+
   TopExp_Explorer anExp;
 
   for(Standard_Integer argit = 0; argit < 2; argit++) {
diff --git a/tests/bugs/modalg_5/bug25614_common b/tests/bugs/modalg_5/bug25614_common
new file mode 100755 (executable)
index 0000000..c1a2c27
--- /dev/null
@@ -0,0 +1,57 @@
+puts "============"
+puts "OCC25614"
+puts "============"
+puts ""
+###############################
+## Provide API access to the new functionalities of Boolean Components
+###############################
+
+#====================
+box b 10 10 4
+ttranslate b 0 0 -2
+set qs1 {}
+set N 11
+
+for {set i 0} {$i < $N} {incr i} {
+ for {set j 0} {$j < $N} {incr j} {
+  tcopy b b_${i}_${j}
+  ttranslate b_${i}_${j} [expr $i * 10] [expr $j * 10] 0. 
+  lappend qs1 b_${i}_${j} 
+ }
+}
+eval compound $qs1 b1
+
+pcylinder b 6 10
+ttranslate b 10 10 -5
+
+set qs2 {}
+set N 10
+
+for {set i 0} {$i < $N} {incr i} {
+ for {set j 0} {$j < $N} {incr j} {
+  tcopy b b_${i}_${j}
+  ttranslate b_${i}_${j} [expr $i * 10] [expr $j * 10] 0. 
+  lappend qs2 b_${i}_${j} 
+ }
+}
+eval compound $qs2 b2
+#====================
+
+bclearobjects
+bcleartools
+baddcompound b1
+baddctools b2
+
+bapibop result 0
+
+set nb_v_good 1720
+set nb_e_good 3800
+set nb_w_good 1920
+set nb_f_good 1920
+set nb_sh_good 1
+set nb_sol_good 1
+set nb_compsol_good 0
+set nb_compound_good 1
+set nb_shape_good 9363
+
+set 3dviewer 1
diff --git a/tests/bugs/modalg_5/bug25614_cut b/tests/bugs/modalg_5/bug25614_cut
new file mode 100755 (executable)
index 0000000..b8907e1
--- /dev/null
@@ -0,0 +1,57 @@
+puts "============"
+puts "OCC25614"
+puts "============"
+puts ""
+###############################
+## Provide API access to the new functionalities of Boolean Components
+###############################
+
+#====================
+box b 10 10 4
+ttranslate b 0 0 -2
+set qs1 {}
+set N 11
+
+for {set i 0} {$i < $N} {incr i} {
+ for {set j 0} {$j < $N} {incr j} {
+  tcopy b b_${i}_${j}
+  ttranslate b_${i}_${j} [expr $i * 10] [expr $j * 10] 0. 
+  lappend qs1 b_${i}_${j} 
+ }
+}
+eval compound $qs1 b1
+
+pcylinder b 6 10
+ttranslate b 10 10 -5
+
+set qs2 {}
+set N 10
+
+for {set i 0} {$i < $N} {incr i} {
+ for {set j 0} {$j < $N} {incr j} {
+  tcopy b b_${i}_${j}
+  ttranslate b_${i}_${j} [expr $i * 10] [expr $j * 10] 0. 
+  lappend qs2 b_${i}_${j} 
+ }
+}
+eval compound $qs2 b2
+#====================
+
+bclearobjects
+bcleartools
+baddcompound b1
+baddctools b2
+
+bapibop result 2
+
+set nb_v_good 888
+set nb_e_good 1412
+set nb_w_good 686
+set nb_f_good 686
+set nb_sh_good 82
+set nb_sol_good 82
+set nb_compsol_good 0
+set nb_compound_good 1
+set nb_shape_good 3837
+
+set 3dviewer 1
diff --git a/tests/bugs/modalg_5/bug25614_cut21 b/tests/bugs/modalg_5/bug25614_cut21
new file mode 100755 (executable)
index 0000000..a825b46
--- /dev/null
@@ -0,0 +1,57 @@
+puts "============"
+puts "OCC25614"
+puts "============"
+puts ""
+###############################
+## Provide API access to the new functionalities of Boolean Components
+###############################
+
+#====================
+box b 10 10 4
+ttranslate b 0 0 -2
+set qs1 {}
+set N 11
+
+for {set i 0} {$i < $N} {incr i} {
+ for {set j 0} {$j < $N} {incr j} {
+  tcopy b b_${i}_${j}
+  ttranslate b_${i}_${j} [expr $i * 10] [expr $j * 10] 0. 
+  lappend qs1 b_${i}_${j} 
+ }
+}
+eval compound $qs1 b1
+
+pcylinder b 6 10
+ttranslate b 10 10 -5
+
+set qs2 {}
+set N 10
+
+for {set i 0} {$i < $N} {incr i} {
+ for {set j 0} {$j < $N} {incr j} {
+  tcopy b b_${i}_${j}
+  ttranslate b_${i}_${j} [expr $i * 10] [expr $j * 10] 0. 
+  lappend qs2 b_${i}_${j} 
+ }
+}
+eval compound $qs2 b2
+#====================
+
+bclearobjects
+bcleartools
+baddcompound b1
+baddctools b2
+
+bapibop result 3
+
+set nb_v_good 2640
+set nb_e_good 5780
+set nb_w_good 2820
+set nb_f_good 2820
+set nb_sh_good 2
+set nb_sol_good 2
+set nb_compsol_good 0
+set nb_compound_good 1
+set nb_shape_good 14065
+
+set 3dviewer 1
diff --git a/tests/bugs/modalg_5/bug25614_fuse b/tests/bugs/modalg_5/bug25614_fuse
new file mode 100755 (executable)
index 0000000..f075ba8
--- /dev/null
@@ -0,0 +1,57 @@
+puts "============"
+puts "OCC25614"
+puts "============"
+puts ""
+###############################
+## Provide API access to the new functionalities of Boolean Components
+###############################
+
+#====================
+box b 10 10 4
+ttranslate b 0 0 -2
+set qs1 {}
+set N 11
+
+for {set i 0} {$i < $N} {incr i} {
+ for {set j 0} {$j < $N} {incr j} {
+  tcopy b b_${i}_${j}
+  ttranslate b_${i}_${j} [expr $i * 10] [expr $j * 10] 0. 
+  lappend qs1 b_${i}_${j} 
+ }
+}
+eval compound $qs1 b1
+
+pcylinder b 6 10
+ttranslate b 10 10 -5
+
+set qs2 {}
+set N 10
+
+for {set i 0} {$i < $N} {incr i} {
+ for {set j 0} {$j < $N} {incr j} {
+  tcopy b b_${i}_${j}
+  ttranslate b_${i}_${j} [expr $i * 10] [expr $j * 10] 0. 
+  lappend qs2 b_${i}_${j} 
+ }
+}
+eval compound $qs2 b2
+#====================
+
+bclearobjects
+bcleartools
+baddcompound b1
+baddctools b2
+
+bapibop result 1
+
+set nb_v_good 1808
+set nb_e_good 3392
+set nb_w_good 1586
+set nb_f_good 1586
+set nb_sh_good 1
+set nb_sol_good 1
+set nb_compsol_good 0
+set nb_compound_good 1
+set nb_shape_good 8375
+
+set 3dviewer 1
diff --git a/tests/bugs/modalg_5/bug25614_genfuse b/tests/bugs/modalg_5/bug25614_genfuse
new file mode 100755 (executable)
index 0000000..2fef6c5
--- /dev/null
@@ -0,0 +1,57 @@
+puts "============"
+puts "OCC25614"
+puts "============"
+puts ""
+###############################
+## Provide API access to the new functionalities of Boolean Components
+###############################
+
+#====================
+box b 10 10 4
+ttranslate b 0 0 -2
+set qs1 {}
+set N 11
+
+for {set i 0} {$i < $N} {incr i} {
+ for {set j 0} {$j < $N} {incr j} {
+  tcopy b b_${i}_${j}
+  ttranslate b_${i}_${j} [expr $i * 10] [expr $j * 10] 0. 
+  lappend qs1 b_${i}_${j} 
+ }
+}
+eval compound $qs1 b1
+
+pcylinder b 6 10
+ttranslate b 10 10 -5
+
+set qs2 {}
+set N 10
+
+for {set i 0} {$i < $N} {incr i} {
+ for {set j 0} {$j < $N} {incr j} {
+  tcopy b b_${i}_${j}
+  ttranslate b_${i}_${j} [expr $i * 10] [expr $j * 10] 0. 
+  lappend qs2 b_${i}_${j} 
+ }
+}
+eval compound $qs2 b2
+#====================
+
+bclearobjects
+bcleartools
+baddcompound b1
+baddcompound b2
+
+bapibuild result
+
+set nb_v_good 2728
+set nb_e_good 7032
+set nb_w_good 5746
+set nb_f_good 5746
+set nb_sh_good 1441
+set nb_sol_good 1441
+set nb_compsol_good 0
+set nb_compound_good 1
+set nb_shape_good 24135
+
+set 3dviewer 1
diff --git a/tests/bugs/modalg_5/bug25614_section b/tests/bugs/modalg_5/bug25614_section
new file mode 100755 (executable)
index 0000000..5b35c4e
--- /dev/null
@@ -0,0 +1,57 @@
+puts "============"
+puts "OCC25614"
+puts "============"
+puts ""
+###############################
+## Provide API access to the new functionalities of Boolean Components
+###############################
+
+#====================
+box b 10 10 4
+ttranslate b 0 0 -2
+set qs1 {}
+set N 11
+
+for {set i 0} {$i < $N} {incr i} {
+ for {set j 0} {$j < $N} {incr j} {
+  tcopy b b_${i}_${j}
+  ttranslate b_${i}_${j} [expr $i * 10] [expr $j * 10] 0. 
+  lappend qs1 b_${i}_${j} 
+ }
+}
+eval compound $qs1 b1
+
+pcylinder b 6 10
+ttranslate b 10 10 -5
+
+set qs2 {}
+set N 10
+
+for {set i 0} {$i < $N} {incr i} {
+ for {set j 0} {$j < $N} {incr j} {
+  tcopy b b_${i}_${j}
+  ttranslate b_${i}_${j} [expr $i * 10] [expr $j * 10] 0. 
+  lappend qs2 b_${i}_${j} 
+ }
+}
+eval compound $qs2 b2
+#====================
+
+bclearobjects
+bcleartools
+baddcompound b1
+baddctools b2
+
+bapibop result 4
+
+set nb_v_good 2700
+set nb_e_good 6000
+set nb_w_good 0
+set nb_f_good 0
+set nb_sh_good 0
+set nb_sol_good 0
+set nb_compsol_good 0
+set nb_compound_good 1
+set nb_shape_good 8701
+
+set 3dviewer 1