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);
#include <BOPTools_Set.hxx>
#include <BOPTools_SetMapHasher.hxx>
#include <NCollection_DataMap.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
typedef NCollection_DataMap
<BOPTools_Set,
}
}
//=======================================================================
+//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 :
//=======================================================================
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 &
#include <BRep_Builder.hxx>
#include <BOPTools_AlgoTools.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
//=======================================================================
//function :
//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();
ShapeEnum from TopAbs,
Vertex from TopoDS,
Face from TopoDS,
- Edge from TopoDS,
+ Edge from TopoDS,
+
+ ListOfShape from TopTools,
BaseAllocator from BOPCol,
ListOfShape from BOPCol,
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;
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
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;
#include <IntTools_Context.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Iterator.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
//=======================================================================
//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;
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-
+
package BOPTest
---Purpose:
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;
#include <GeometryTest.hxx>
#include <BRepTest.hxx>
#include <MeshTest.hxx>
-//#include <CorrectTest.hxx>
#include <HLRTest.hxx>
-//#include <stdio.h>
//=======================================================================
//function : AllCommands
BOPTest::TolerCommands (theCommands);
BOPTest::ObjCommands (theCommands);
BOPTest::PartitionCommands (theCommands);
+ BOPTest::APICommands (theCommands);
+ BOPTest::OptionCommands (theCommands);
}
//=======================================================================
//function : Factory
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)
--- /dev/null
+// 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);
+ }
+}
+
#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;
//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;
//
if (n < 3 || n > 4) {
di << " use bop Shape1 Shape2 [tol]\n";
- return 1;
+ return 0;
}
//
aS1=DBRep::Get(a[1]);
//
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);
//
//
pPF->SetArguments(aLC);
pPF->SetFuzzyValue(aTol);
+ pPF->SetRunParallel(bRunParallel);
//
pPF->Perform();
iErr=pPF->ErrorStatus();
}
//
char buf[64];
+ Standard_Boolean bRunParallel;
Standard_Integer aNb, iErr;
BOPAlgo_BOP aBOP;
//
di << buf;
return 0;
}
+ //
+ bRunParallel=BOPTest_Objects::RunParallel();
//
const TopoDS_Shape& aS1=aLC.First();
const TopoDS_Shape& aS2=aLC.Last();
aBOP.AddArgument(aS1);
aBOP.AddTool(aS2);
aBOP.SetOperation(aOp);
+ aBOP.SetRunParallel (bRunParallel);
//
aBOP.PerformWithFiller(*pPF);
iErr=aBOP.ErrorStatus();
}
//
char buf[64];
+ Standard_Boolean bRunParallel;
Standard_Integer aNb, iErr;
BOPAlgo_Section aBOP;
//
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();
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]);
//
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")) {
}
}
//
- 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();
DBRep::Set(a[1], aR);
return 0;
}
-
//=======================================================================
//function : bsmt
//purpose :
const BOPAlgo_Operation aOp)
{
char buf[32];
+ Standard_Boolean bRunParallel;
Standard_Integer iErr;
TopoDS_Shape aS1, aS2;
BOPCol_ListOfShape aLC;
//
if (n < 4 || n > 5) {
di << " use bx r s1 s2 [tol]\n";
- return 1;
+ return 0;
}
//
aS1=DBRep::Get(a[2]);
//
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();
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 :
//
return 0;
}
-
//=======================================================================
//function : bopcurves
//purpose :
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_");
di << " has no 3d curve\n";
return 1;
}
- else
- {
+ else {
di << aNbCurves << " curve(s) found.\n";
}
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();
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();
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 :
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) {
//
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;
+}
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;
myBuilderDefault=new BOPAlgo_Builder(pA2);
//
myBuilder=myBuilderDefault;
+ myRunParallel=Standard_False;
+ myFuzzyValue=0.;
};
//
// Clear
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;
};
//
//=======================================================================
void BOPTest_Objects::Clear()
{
GetSession().Clear();
- //
- //clear objects and tools
Shapes().Clear();
Tools().Clear();
}
//=======================================================================
BOPCol_ListOfShape& BOPTest_Objects::Shapes()
{
- static BOPCol_ListOfShape s_Shapes;
- return s_Shapes;
+ return GetSession().Shapes();
}
//=======================================================================
//function : Tools
//=======================================================================
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
--- /dev/null
+// 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;
+}
theCommands.Add("bbop" , "use bbop r op [-s -t]" , __FILE__, bbop, g);
theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g);
}
-
//=======================================================================
//function : bclear
//purpose :
}
//
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;
}
//
bShowTime=Standard_False;
- bRunParallel=Standard_True;
+ bRunParallel=BOPTest_Objects::RunParallel();
for (i=2; i<n; ++i) {
if (!strcmp(a[i], "-s")) {
bRunParallel=Standard_False;
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;
BOPTest_CheckCommands.cxx
BOPTest_TolerCommands.cxx
BOPTest_ObjCommands.cxx
-BOPTest_Chronometer.hxx
+BOPTest_APICommands.cxx
+BOPTest_OptionCommands.cxx
-- 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
-- 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;
+
+
+
+
+++ /dev/null
-// 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);
-}
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 &
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;
{
return myShape;
}
-
+//=======================================================================
+//function : Clear
+//purpose :
+//=======================================================================
+void BRepAlgoAPI_Algo::Clear()
+{
+}
// myErrorStatus
//
// 1 - object is just initialized
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
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
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;
-
#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
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
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;
}
//=======================================================================
//=======================================================================
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
//=======================================================================
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;
}
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();
}
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
-- 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;
#include <BRepAlgoAPI_BuilderAlgo.ixx>
-#include <NCollection_BaseAllocator.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+#include <BOPAlgo_Builder.hxx>
//=======================================================================
// function:
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
:
BRepAlgoAPI_Algo(),
+ myEntryType(1),
myDSFiller(NULL),
myBuilder(NULL),
myFuzzyValue(0.)
// 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
{
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();
+}
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;
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 :
//=======================================================================
//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=
//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=
-- 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,
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;
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 :
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;
-- 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,
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;
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 :
(BRepAlgoAPI_BooleanOperation*) (void*) this;
pBO->Build();
}
-
//=======================================================================
//function : BRepAlgoAPI_Fuse
//purpose :
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)
-- 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;
#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
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 :
:
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
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
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
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
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
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
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();
}
}
//=======================================================================
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
//=======================================================================
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
{
if(myApprox != B) {
myApprox = B;
- myparameterschanged = Standard_True;
+ myParametersChanged = Standard_True;
}
}
//=======================================================================
{
if(myComputePCurve1 != B) {
myComputePCurve1 = B;
- myparameterschanged = Standard_True;
+ myParametersChanged = Standard_True;
}
}
//=======================================================================
{
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;
}
}
if (thePerformNow)
Build();
}
-
//=======================================================================
//function : Build
//purpose :
void QANewModTopOpe_Glue::Build()
{
+ TopoDS_Shape& myS1=myArguments.First();
+ TopoDS_Shape& myS2=myTools.First();
+
if (myCompleted) return;
TopAbs_ShapeEnum aType1, aType2;
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;
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;
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()) {
TopTools_ListOfShape aList;
aList.Append (aV);
myMapGener.Bind(myS1, aList);
-
+
+
+
myShape = myS1;
myShape.Orientation(myS1.Orientation());
Done();
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) {
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));
-- 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
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)) {
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);
}
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();
//=======================================================================
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++) {
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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