mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-06-01 00:21:51 +08:00
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:
@@ -16,16 +16,24 @@
|
||||
|
||||
#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>
|
||||
@@ -39,18 +47,84 @@
|
||||
#include <BOPAlgo_BOP.hxx>
|
||||
#include <BOPAlgo_Section.hxx>
|
||||
|
||||
//XXXX
|
||||
//=======================================================================
|
||||
//class : BRepAlgoAPI_DumpOper
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BRepAlgoAPI_DumpOper {
|
||||
public:
|
||||
BRepAlgoAPI_DumpOper() :
|
||||
myIsDump(Standard_False),
|
||||
myIsDumpArgs(Standard_False),
|
||||
myIsDumpRes(Standard_False) {
|
||||
char *pathdump = getenv("CSF_DEBUG_BOP");
|
||||
myIsDump=(pathdump!=NULL);
|
||||
myPath=pathdump;
|
||||
};
|
||||
//
|
||||
virtual ~BRepAlgoAPI_DumpOper() {
|
||||
};
|
||||
//
|
||||
Standard_Boolean IsDump()const {
|
||||
return myIsDump;
|
||||
};
|
||||
//
|
||||
void SetIsDumpArgs(const Standard_Boolean bFlag) {
|
||||
myIsDumpArgs=bFlag;
|
||||
}
|
||||
//
|
||||
Standard_Boolean IsDumpArgs()const {
|
||||
return myIsDumpArgs;
|
||||
};
|
||||
//
|
||||
void SetIsDumpRes(const Standard_Boolean bFlag) {
|
||||
myIsDumpRes=bFlag;
|
||||
};
|
||||
//
|
||||
Standard_Boolean IsDumpRes()const {
|
||||
return myIsDumpRes;
|
||||
};
|
||||
//
|
||||
void Dump(
|
||||
const TopoDS_Shape& theShape1,
|
||||
const TopoDS_Shape& theShape2,
|
||||
const TopoDS_Shape& theResult,
|
||||
BOPAlgo_Operation theOperation);
|
||||
//
|
||||
protected:
|
||||
Standard_Boolean myIsDump;
|
||||
Standard_Boolean myIsDumpArgs;
|
||||
Standard_Boolean myIsDumpRes;
|
||||
Standard_CString myPath;
|
||||
};
|
||||
//XXXX
|
||||
//=======================================================================
|
||||
//function : BRepAlgoAPI_BooleanOperation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation()
|
||||
:
|
||||
BRepAlgoAPI_BuilderAlgo(),
|
||||
BRepAlgoAPI_BuilderAlgo(),
|
||||
myOperation(BOPAlgo_UNKNOWN),
|
||||
myEntryType(1),
|
||||
myBuilderCanWork(Standard_False),
|
||||
myFuseEdges(Standard_False)
|
||||
{
|
||||
{
|
||||
myEntryType=1;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BRepAlgoAPI_BooleanOperation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
|
||||
(const BOPAlgo_PaveFiller& aPF)
|
||||
:
|
||||
BRepAlgoAPI_BuilderAlgo(aPF),
|
||||
myOperation(BOPAlgo_UNKNOWN),
|
||||
myBuilderCanWork(Standard_False),
|
||||
myFuseEdges(Standard_False)
|
||||
{
|
||||
myEntryType=0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BRepAlgoAPI_BooleanOperation
|
||||
@@ -62,13 +136,14 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
|
||||
const BOPAlgo_Operation anOp)
|
||||
:
|
||||
BRepAlgoAPI_BuilderAlgo(),
|
||||
myS1(aS1),
|
||||
myS2(aS2),
|
||||
myOperation(anOp),
|
||||
myEntryType(1),
|
||||
myBuilderCanWork(Standard_False),
|
||||
myFuseEdges(Standard_False)
|
||||
{
|
||||
myEntryType=1;
|
||||
//
|
||||
myArguments.Append(aS1);
|
||||
myTools.Append(aS2);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BRepAlgoAPI_BooleanOperation
|
||||
@@ -80,14 +155,16 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
|
||||
const BOPAlgo_PaveFiller& aPF,
|
||||
const BOPAlgo_Operation anOp)
|
||||
:
|
||||
BRepAlgoAPI_BuilderAlgo(),
|
||||
myS1(aS1),
|
||||
myS2(aS2),
|
||||
BRepAlgoAPI_BuilderAlgo(aPF),
|
||||
myOperation(anOp),
|
||||
myEntryType(0),
|
||||
myBuilderCanWork(Standard_False),
|
||||
myFuseEdges(Standard_False)
|
||||
{
|
||||
{
|
||||
myEntryType=0;
|
||||
//
|
||||
myArguments.Append(aS1);
|
||||
myTools.Append(aS2);
|
||||
//
|
||||
myDSFiller=(BOPAlgo_PaveFiller*)&aPF;
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -96,19 +173,37 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_BooleanOperation::~BRepAlgoAPI_BooleanOperation()
|
||||
{
|
||||
if (myBuilder) {
|
||||
delete myBuilder;
|
||||
myBuilder=NULL;
|
||||
}
|
||||
if (myDSFiller && myEntryType) {
|
||||
delete myDSFiller;
|
||||
myDSFiller=NULL;
|
||||
}
|
||||
//
|
||||
Clear();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_BooleanOperation::Clear()
|
||||
{
|
||||
BRepAlgoAPI_BuilderAlgo::Clear();
|
||||
|
||||
myModifFaces.Clear();
|
||||
myEdgeMap.Clear();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetTools
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_BooleanOperation::SetTools
|
||||
(const TopTools_ListOfShape& theLS)
|
||||
{
|
||||
myTools=theLS;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Tools
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Tools()const
|
||||
{
|
||||
return myTools;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetOperation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
@@ -121,33 +216,17 @@ void BRepAlgoAPI_BooleanOperation::SetOperation
|
||||
//function : Operation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BOPAlgo_Operation BRepAlgoAPI_BooleanOperation::Operation ()const
|
||||
BOPAlgo_Operation BRepAlgoAPI_BooleanOperation::Operation()const
|
||||
{
|
||||
return myOperation;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetShape1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_BooleanOperation::SetShape1(const TopoDS_Shape& aS)
|
||||
{
|
||||
myS1=aS;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetShape2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_BooleanOperation::SetShape2(const TopoDS_Shape& aS)
|
||||
{
|
||||
myS2=aS;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Shape1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape1() const
|
||||
{
|
||||
return myS1;
|
||||
return myArguments.First();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Shape2
|
||||
@@ -155,13 +234,13 @@ const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape1() const
|
||||
//=======================================================================
|
||||
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape2() const
|
||||
{
|
||||
return myS2;
|
||||
return myTools.First();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BuilderCanWork
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepAlgoAPI_BooleanOperation::BuilderCanWork() const
|
||||
Standard_Boolean BRepAlgoAPI_BooleanOperation::BuilderCanWork() const
|
||||
{
|
||||
return myBuilderCanWork;
|
||||
}
|
||||
@@ -174,154 +253,159 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::FuseEdges ()const
|
||||
return myFuseEdges;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PrepareFiller
|
||||
//function : SetAttributes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepAlgoAPI_BooleanOperation::PrepareFiller()
|
||||
void BRepAlgoAPI_BooleanOperation::SetAttributes()
|
||||
{
|
||||
Standard_Boolean bIsNewFiller=Standard_False;
|
||||
myErrorStatus=1;
|
||||
//
|
||||
if (myS1.IsNull() || myS2.IsNull()) {
|
||||
myErrorStatus=2;
|
||||
return bIsNewFiller;
|
||||
}
|
||||
//
|
||||
if (myOperation==BOPAlgo_UNKNOWN) {
|
||||
myErrorStatus=6;
|
||||
return bIsNewFiller;
|
||||
}
|
||||
//
|
||||
if (myDSFiller==NULL) {
|
||||
bIsNewFiller=!bIsNewFiller;
|
||||
|
||||
myDSFiller=new BOPAlgo_PaveFiller;
|
||||
//
|
||||
if (myDSFiller==NULL) {
|
||||
myErrorStatus=4;
|
||||
return bIsNewFiller;
|
||||
}
|
||||
//
|
||||
BOPCol_ListOfShape aLS;
|
||||
aLS.Append(myS1);
|
||||
aLS.Append(myS2);
|
||||
//
|
||||
myDSFiller->SetArguments(aLS);
|
||||
myDSFiller->SetRunParallel(myRunParallel);
|
||||
myDSFiller->SetProgressIndicator(myProgressIndicator);
|
||||
myDSFiller->SetFuzzyValue(myFuzzyValue);
|
||||
}
|
||||
|
||||
return bIsNewFiller;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Build
|
||||
//function : Build2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_BooleanOperation::Build()
|
||||
{
|
||||
Standard_Boolean bIsNewFiller;
|
||||
Standard_Integer iErr;
|
||||
//
|
||||
//dump arguments and result of boolean operation in tcl script
|
||||
char *pathdump = getenv("CSF_DEBUG_BOP");
|
||||
Standard_Boolean isDump = (pathdump != NULL),
|
||||
isDumpArgs = Standard_False,
|
||||
isDumpRes = Standard_False;
|
||||
Standard_CString aPath = pathdump;
|
||||
Standard_Integer iErr, aNbArgs, aNbTools;
|
||||
BRepAlgoAPI_DumpOper aDumpOper;
|
||||
//
|
||||
myBuilderCanWork=Standard_False;
|
||||
myErrorStatus=0;
|
||||
NotDone();
|
||||
//
|
||||
bIsNewFiller=PrepareFiller();
|
||||
//
|
||||
if (myErrorStatus!=1) {
|
||||
// there was errors during the preparation
|
||||
aNbArgs=myArguments.Extent();
|
||||
aNbTools=myTools.Extent();
|
||||
if (aNbArgs<1 && aNbTools<1) {
|
||||
myErrorStatus=2;
|
||||
return;
|
||||
}
|
||||
if (myOperation==BOPAlgo_UNKNOWN) {
|
||||
myErrorStatus=6;
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (bIsNewFiller) {
|
||||
//Prepare the DS
|
||||
myDSFiller->Perform();
|
||||
//-----------------------------------------------
|
||||
TopTools_ListOfShape aLS;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
aIt.Initialize(myArguments);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Value();
|
||||
aLS.Append(aS);
|
||||
}
|
||||
//
|
||||
if (myBuilder!=NULL) {
|
||||
delete myBuilder;
|
||||
myBuilder=NULL;
|
||||
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 (isDump) {
|
||||
BRepAlgoAPI_Check aChekArgs(aS1, aS2, myOperation);
|
||||
isDumpArgs = !aChekArgs.IsValid();
|
||||
}
|
||||
//
|
||||
myShape.Nullify();
|
||||
//
|
||||
if (myOperation==BOPAlgo_SECTION) {
|
||||
myBuilder=new BOPAlgo_Section;
|
||||
myBuilder->AddArgument(aS1);
|
||||
myBuilder->AddArgument(aS2);
|
||||
}
|
||||
else {
|
||||
BOPAlgo_BOP *pBOP;
|
||||
if (myEntryType) {
|
||||
if (myDSFiller) {
|
||||
delete myDSFiller;
|
||||
}
|
||||
myDSFiller=new BOPAlgo_PaveFiller(myAllocator);
|
||||
//
|
||||
pBOP=new BOPAlgo_BOP;
|
||||
myBuilder=pBOP;
|
||||
pBOP->AddArgument(aS1);
|
||||
pBOP->AddTool(aS2);
|
||||
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) {
|
||||
//
|
||||
//XXXX
|
||||
const TopoDS_Shape& aS1 = myArguments.First();
|
||||
const TopoDS_Shape& aS2 = myTools.First();
|
||||
if (aDumpOper.IsDump()) {
|
||||
BRepAlgoAPI_Check aChekArgs(aS1, aS2, myOperation);
|
||||
aDumpOper.SetIsDumpArgs(!aChekArgs.IsValid());
|
||||
}
|
||||
//XXXX
|
||||
//
|
||||
if (myBuilder) {
|
||||
delete myBuilder;
|
||||
}
|
||||
//
|
||||
BOPAlgo_BOP *pBOP;
|
||||
//
|
||||
if(myOperation==BOPAlgo_SECTION) {
|
||||
myBuilder=new BOPAlgo_Section(myAllocator);
|
||||
myBuilder->SetArguments(aLS);
|
||||
}
|
||||
else{
|
||||
pBOP=new BOPAlgo_BOP(myAllocator);
|
||||
pBOP->SetArguments(myArguments);
|
||||
pBOP->SetTools(myTools);
|
||||
pBOP->SetOperation(myOperation);
|
||||
myBuilder=pBOP;
|
||||
}
|
||||
//
|
||||
myBuilder->SetRunParallel(myRunParallel);
|
||||
myBuilder->SetProgressIndicator(myProgressIndicator);
|
||||
//
|
||||
myBuilder->PerformWithFiller(*myDSFiller);
|
||||
iErr = myBuilder->ErrorStatus();
|
||||
if (!iErr) {
|
||||
myErrorStatus=0;
|
||||
myBuilderCanWork=Standard_True;
|
||||
myShape=myBuilder->Shape();
|
||||
//
|
||||
if (isDump) {
|
||||
BRepAlgoAPI_Check aCheckRes(myShape);
|
||||
isDumpRes = !aCheckRes.IsValid();
|
||||
if (isDumpArgs || isDumpRes) {
|
||||
BRepAlgoAPI::DumpOper(aPath,
|
||||
aS1,
|
||||
aS2,
|
||||
myShape,
|
||||
myOperation,
|
||||
isDumpArgs);
|
||||
}
|
||||
}
|
||||
//
|
||||
Done();
|
||||
}
|
||||
else {
|
||||
myErrorStatus=100+iErr;
|
||||
NotDone();
|
||||
if (iErr) {
|
||||
myErrorStatus=200+iErr;
|
||||
return;
|
||||
}
|
||||
//
|
||||
myShape=myBuilder->Shape();
|
||||
//
|
||||
myBuilderCanWork=Standard_True;
|
||||
Done();
|
||||
//
|
||||
//XXXX
|
||||
if (aDumpOper.IsDump()) {
|
||||
BRepAlgoAPI_Check aCheckRes(myShape);
|
||||
aDumpOper.SetIsDumpRes(!aCheckRes.IsValid());
|
||||
aDumpOper.Dump(aS1, aS2, myShape,myOperation);
|
||||
}
|
||||
//XXXX
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RefineEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_BooleanOperation::RefineEdges ()
|
||||
{
|
||||
if(myFuseEdges) return; //Edges have been refined yet
|
||||
|
||||
if(myFuseEdges) {
|
||||
return; //Edges have been refined
|
||||
}
|
||||
//
|
||||
TopTools_IndexedMapOfShape mapOldEdges;
|
||||
TopTools_ListOfShape aLS;
|
||||
TopTools_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
aIt.Initialize(myArguments);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Value();
|
||||
aLS.Append(aS);
|
||||
}
|
||||
aIt.Initialize(myTools);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Value();
|
||||
aLS.Append(aS);
|
||||
}
|
||||
//
|
||||
aIt.Initialize(aLS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Value();
|
||||
TopExp::MapShapes (aS, TopAbs_EDGE, mapOldEdges);
|
||||
}
|
||||
//----------------------------------------------
|
||||
BRepLib_FuseEdges FE(myShape);
|
||||
FE.SetConcatBSpl(Standard_True);
|
||||
|
||||
// avoid fusing old edges
|
||||
TopTools_IndexedMapOfShape mapOldEdges;
|
||||
TopExp::MapShapes (myS1, TopAbs_EDGE, mapOldEdges);
|
||||
TopExp::MapShapes (myS2, TopAbs_EDGE, mapOldEdges);
|
||||
FE.AvoidEdges (mapOldEdges);
|
||||
|
||||
//
|
||||
// Get List of edges that have been fused
|
||||
myFuseEdges = Standard_False;
|
||||
myModifFaces.Clear();
|
||||
@@ -529,3 +613,90 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasDeleted() const
|
||||
}
|
||||
return myBuilder->HasDeleted();
|
||||
}
|
||||
//XXXX
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_DumpOper::Dump (const TopoDS_Shape& theShape1,
|
||||
const TopoDS_Shape& theShape2,
|
||||
const TopoDS_Shape& theResult,
|
||||
BOPAlgo_Operation theOperation)
|
||||
{
|
||||
if (!(myIsDumpArgs && myIsDumpRes)) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
TCollection_AsciiString aPath(myPath);
|
||||
aPath += "/";
|
||||
Standard_Integer aNumOper = 1;
|
||||
Standard_Boolean isExist = Standard_True;
|
||||
TCollection_AsciiString aFileName;
|
||||
|
||||
while(isExist)
|
||||
{
|
||||
aFileName = aPath + "BO_" + TCollection_AsciiString(aNumOper) +".tcl";
|
||||
OSD_File aScript(aFileName);
|
||||
isExist = aScript.Exists();
|
||||
if(isExist)
|
||||
aNumOper++;
|
||||
}
|
||||
|
||||
FILE* afile = fopen(aFileName.ToCString(), "w+");
|
||||
if(!afile)
|
||||
return;
|
||||
if(myIsDumpArgs)
|
||||
fprintf(afile,"%s\n","# Arguments are invalid");
|
||||
|
||||
TCollection_AsciiString aName1;
|
||||
TCollection_AsciiString aName2;
|
||||
TCollection_AsciiString aNameRes;
|
||||
if(!theShape1.IsNull())
|
||||
{
|
||||
aName1 = aPath +
|
||||
"Arg1_" + TCollection_AsciiString(aNumOper) + ".brep";
|
||||
BRepTools::Write(theShape1, aName1.ToCString());
|
||||
}
|
||||
else
|
||||
fprintf(afile,"%s\n","# First argument is Null ");
|
||||
|
||||
if(!theShape2.IsNull())
|
||||
{
|
||||
aName2 = aPath +
|
||||
"Arg2_"+ TCollection_AsciiString(aNumOper) + ".brep";
|
||||
|
||||
BRepTools::Write(theShape2, aName2.ToCString());
|
||||
}
|
||||
else
|
||||
fprintf(afile,"%s\n","# Second argument is Null ");
|
||||
|
||||
if(!theResult.IsNull())
|
||||
{
|
||||
aNameRes = aPath +
|
||||
"Result_"+ TCollection_AsciiString(aNumOper) + ".brep";
|
||||
|
||||
BRepTools::Write(theResult, aNameRes.ToCString());
|
||||
}
|
||||
else
|
||||
fprintf(afile,"%s\n","# Result is Null ");
|
||||
|
||||
fprintf(afile, "%s %s %s\n","restore", aName1.ToCString(), "arg1");
|
||||
fprintf(afile, "%s %s %s\n","restore", aName2.ToCString(), "arg2");;
|
||||
TCollection_AsciiString aBopString;
|
||||
switch (theOperation)
|
||||
{
|
||||
case BOPAlgo_COMMON : aBopString += "bcommon Res "; break;
|
||||
case BOPAlgo_FUSE : aBopString += "bfuse Res "; break;
|
||||
case BOPAlgo_CUT :
|
||||
case BOPAlgo_CUT21 : aBopString += "bcut Res "; break;
|
||||
case BOPAlgo_SECTION : aBopString += "bsection Res "; break;
|
||||
default : break;
|
||||
};
|
||||
aBopString += ("arg1 arg2");
|
||||
if(theOperation == BOPAlgo_CUT21)
|
||||
aBopString += " 1";
|
||||
|
||||
fprintf(afile, "%s\n",aBopString.ToCString());
|
||||
fclose(afile);
|
||||
}
|
||||
//XXXX
|
||||
|
||||
Reference in New Issue
Block a user