0025614: Provide API access to the new fuctionalities of Boolean Components

I. New features:
1.1. class BOPAlgo_PaveFiller
method:
void BOPAlgo_PaveFiller::SetArguments(const TopTools_ListOfShape& theLS)
has been added to provide the setting argumemts  through
TopTools_ListOfShape

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Commands:
 >boptions
   dump the state of current options

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

  >bfuzzyvalue value
    sets the fuzzy value

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

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

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

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

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

Test cases for issue CR25614
This commit is contained in:
pkv
2014-12-25 17:55:02 +03:00
committed by bugmaster
parent 6219c44ce7
commit 49b0c452e2
44 changed files with 2160 additions and 1030 deletions

View File

@@ -32,9 +32,10 @@
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
#include <BOPDS_DS.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_BOP.hxx>
#include <BOPDS_DS.hxx>
#include <BOPAlgo_Section.hxx>
//
static
@@ -45,7 +46,12 @@ static
const TopoDS_Shape&,
TopoDS_Shape&,
TopoDS_Shape&);
static
Standard_Boolean HasAncestorFace (const BOPAlgo_PPaveFiller& ,
Standard_Integer ,
const TopoDS_Shape& ,
TopoDS_Shape& );
//
//=======================================================================
//function : BRepAlgoAPI_Section
//purpose :
@@ -54,27 +60,17 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section()
:
BRepAlgoAPI_BooleanOperation()
{
myOperation=BOPAlgo_SECTION;
InitParameters();
Init(Standard_False);
}
//=======================================================================
//function : ~BRepAlgoAPI_Section
//function : BRepAlgoAPI_Section
//purpose :
//=======================================================================
BRepAlgoAPI_Section::~BRepAlgoAPI_Section()
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const BOPAlgo_PaveFiller& aPF)
:
BRepAlgoAPI_BooleanOperation(aPF)
{
}
//=======================================================================
//function : InitParameters
//purpose :
//=======================================================================
void BRepAlgoAPI_Section::InitParameters()
{
myparameterschanged = Standard_False;
myshapeisnull = Standard_False;
myApprox = Standard_False;
myComputePCurve1 = Standard_False;
myComputePCurve2 = Standard_False;
Init(Standard_False);
}
//=======================================================================
//function : Constructor
@@ -84,17 +80,11 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh1,
const TopoDS_Shape& Sh2,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(Sh1, Sh2, BOPAlgo_SECTION)
BRepAlgoAPI_BooleanOperation(Sh1,
Sh2,
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || myS2.IsNull()) {
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
Init(PerformNow);
}
//=======================================================================
//function : BRepAlgoAPI_Section
@@ -106,18 +96,12 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
const BOPAlgo_PaveFiller& aDSF,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(aS1, aS2, aDSF, BOPAlgo_SECTION)
BRepAlgoAPI_BooleanOperation(aS1,
aS2,
aDSF,
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || myS2.IsNull()) {
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
Init(PerformNow);
}
//=======================================================================
//function : Constructor
@@ -128,18 +112,11 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
const gp_Pln& Pl,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(Sh, MakeShape(new Geom_Plane(Pl)),
BRepAlgoAPI_BooleanOperation(Sh,
MakeShape(new Geom_Plane(Pl)),
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(Sh.IsNull() || myS2.IsNull()) {
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
Init(PerformNow);
}
//=======================================================================
//function : Constructor
@@ -150,17 +127,11 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
const Handle(Geom_Surface)& Sf,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(Sh, MakeShape(Sf), BOPAlgo_SECTION)
BRepAlgoAPI_BooleanOperation(Sh,
MakeShape(Sf),
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(Sh.IsNull() || myS2.IsNull()) {
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
Init(PerformNow);
}
//=======================================================================
//function : Constructor
@@ -171,17 +142,11 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
const TopoDS_Shape& Sh,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(MakeShape(Sf), Sh, BOPAlgo_SECTION)
BRepAlgoAPI_BooleanOperation(MakeShape(Sf),
Sh,
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || Sh.IsNull()) {
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
Init(PerformNow);
}
//=======================================================================
//function : Constructor
@@ -196,14 +161,29 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
MakeShape(Sf2),
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || myS2.IsNull()) {
myshapeisnull = Standard_True;
}
if (PerformNow) {
Init(PerformNow);
}
//=======================================================================
//function : ~BRepAlgoAPI_Section
//purpose :
//=======================================================================
BRepAlgoAPI_Section::~BRepAlgoAPI_Section()
{
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void BRepAlgoAPI_Section::Init(const Standard_Boolean bFlag)
{
myOperation=BOPAlgo_SECTION;
myParametersChanged = Standard_False;
myApprox = Standard_False;
myComputePCurve1 = Standard_False;
myComputePCurve2 = Standard_False;
myParametersChanged = Standard_True;
//
if (bFlag) {
Build();
}
}
@@ -213,26 +193,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
//=======================================================================
void BRepAlgoAPI_Section::Init1(const TopoDS_Shape& S1)
{
if(!S1.IsNull()) {
if (!S1.IsEqual(myS1)) {
myS1 = S1;
if(!myS2.IsNull()) {
myshapeisnull = Standard_False;
}
myparameterschanged = Standard_True;
}
}
else {
if(!myS1.IsNull()) {
myS1 = S1;
myshapeisnull = Standard_True;
myparameterschanged = Standard_True;
}
}
if(myparameterschanged)
NotDone();
myArguments.Clear();
myArguments.Append(S1);
myParametersChanged = Standard_True;
}
//=======================================================================
//function : Init1
@@ -256,27 +219,9 @@ void BRepAlgoAPI_Section::Init1(const Handle(Geom_Surface)& Sf)
//=======================================================================
void BRepAlgoAPI_Section::Init2(const TopoDS_Shape& S2)
{
if(!S2.IsNull()) {
if (!S2.IsEqual(myS2)) {
myS2 = S2;
if(!myS1.IsNull()) {
myshapeisnull = Standard_False;
}
myparameterschanged = Standard_True;
}
}
else {
if(!myS2.IsNull()) {
myS2 = S2;
myshapeisnull = Standard_True;
myparameterschanged = Standard_True;
}
}
if(myparameterschanged) {
NotDone();
}
myTools.Clear();
myTools.Append(S2);
myParametersChanged = Standard_True;
}
//=======================================================================
//function : Init2
@@ -302,7 +247,7 @@ void BRepAlgoAPI_Section::Approximation(const Standard_Boolean B)
{
if(myApprox != B) {
myApprox = B;
myparameterschanged = Standard_True;
myParametersChanged = Standard_True;
}
}
//=======================================================================
@@ -313,7 +258,7 @@ void BRepAlgoAPI_Section::ComputePCurveOn1(const Standard_Boolean B)
{
if(myComputePCurve1 != B) {
myComputePCurve1 = B;
myparameterschanged = Standard_True;
myParametersChanged = Standard_True;
}
}
//=======================================================================
@@ -324,133 +269,125 @@ void BRepAlgoAPI_Section::ComputePCurveOn2(const Standard_Boolean B)
{
if(myComputePCurve2 != B) {
myComputePCurve2 = B;
myparameterschanged = Standard_True;
myParametersChanged = Standard_True;
}
}
//=======================================================================
//function : SetAttributes
//purpose :
//=======================================================================
void BRepAlgoAPI_Section::SetAttributes()
{
BOPAlgo_SectionAttribute theSecAttr(myApprox,
myComputePCurve1,
myComputePCurve2);
myDSFiller->SetSectionAttribute(theSecAttr);
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepAlgoAPI_Section::Build()
{
if(myshapeisnull) {
myErrorStatus = 2;
NotDone();
return;
}
if(myparameterschanged) {
Standard_Boolean bIsNewFiller = PrepareFiller();
//
if (myErrorStatus!=1) {
NotDone();
// there were errors during the preparation
return;
}
//
if (bIsNewFiller) {
BOPAlgo_SectionAttribute theSecAttr(myApprox,
myComputePCurve1,
myComputePCurve2);
myDSFiller->SetSectionAttribute(theSecAttr);
myDSFiller->Perform();
}
//
BRepAlgoAPI_BooleanOperation::Build();
//
myparameterschanged = Standard_False;
}
BRepAlgoAPI_BooleanOperation::Build();
}
//=======================================================================
//function : HasAncestorFaceOn1
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn1
(const TopoDS_Shape& E,
TopoDS_Shape& F) const
(const TopoDS_Shape& aE,
TopoDS_Shape& aF) const
{
Standard_Boolean aResult = Standard_False;
if(E.IsNull()) {
return aResult;
}
if(E.ShapeType() != TopAbs_EDGE) {
return aResult;
}
TopoDS_Shape F1, F2;
aResult = HasAncestorFaces(myDSFiller, E, F1, F2);
if(F1.IsNull()) {
return Standard_False;
}
F = F1;
return aResult;
Standard_Boolean bRes;
//
bRes = HasAncestorFace(myDSFiller,1 , aE, aF);
return bRes;
}
//=======================================================================
//function : HasAncestorFaceOn2
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn2
(const TopoDS_Shape& E,
TopoDS_Shape& F) const
(const TopoDS_Shape& aE,
TopoDS_Shape& aF) const
{
Standard_Boolean aResult = Standard_False;
if(E.IsNull()) {
return aResult;
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 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;
}
}