mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-15 05:10:43 +08:00
0021762: Integration of new Boolean Operation algorithm to OCCT.
Modifications:
- BRepOffset/BRepOffset_Tool.cxx, Features and Fillets algorithms have been ported on new BO algorithm.
- Old BO algorithm, that was implemented in BOP, BooleanOperations and BOPTools packages, has - been deleted.
- Porting SALOME algorithms to new BOP algorithm.
- Fixing regressions. Rebased on current master.
- Corrections in post treatment of section edges;
- Corrections in the accordance with the bug 0023293;
- Small corrections in the bopcheck and bopargcheck commands.
- NCollection maps have been replaced by NCollection indexed maps to guarantee the constant order of sub-shapes in the result of boolean operation.
- Test case feat featprism M9 has been fixed.
- Test cases chl 902 E3 H3 have been fixed (corrections in the treatment of section edges).
- Test cases caf driver B6 B7, caf named_shape F6 F7 have been modified according to the new order of sub-shapes in the result of boolean operation.
- Test cases blend buildevol G1, blend simple K4, bcommon_complex C7, feat featprism L6 have been modified as they are improvements.
- Test case boolean bsection A3 has been modified according to the new syntax of the bsection command.
- Test cases boolean bfuse_complex J1 P9 have been fixed (the function IsInternalFace has been modified to use the function GetFaceOff);
- Test case chl 902 H3 has been fixed (changes in the treatment of section edges);
- Test case boolean bsection D8 has been modified (removed TODO statement);
- Test case boolean bsection A3 has been modified (as the shapes have been changed).
- Added correction of the tolerance values of the shapes according to the bug 0023610.
- test cases:
boolean bcommon_complex C3,
boolean bcut_complex F2 O7,
boolean bfuse_complex C4 C5 E4,
boolean bsection B6 M8 M9 N4 N5 N7,
boolean bfuse_simple ZP6,
draft angle G8,
feat featprism S2
have been marked as invalid according to the bug 0022033;
- New value of result has been set in the test cases :
boolean bopsection D4
boolean bsection R8
as it is correct.
- test case bugs modalg bug23472 has been rewritten according to the new format of bsection command.
- The classes IntTools_Context and IntTools_ShrunkRange have been replaced by BOPInt_Context and BOPInt_ShrunkRange accordingly.
- The new class BRepAlgoAPI_Check has been added according to the bug 0023648.
- Some regressions have been fixed.
- The following test cases have been marked as invalid or rewritten
bugs modalg buc60462_2, 60531_2, 60776_1, bug472_1, bug472_2, bug472_3, bug497_3, bug62
bugs moddata bug26_1, bug26_2,
- The test case bugs modalg buc60533 has been rewritten to use the general fuse algorithm for building the result.
- The new value of the result has been set in the test case bugs modalg 60776_2.
- The following test cases have been rewritten according to the new format of the bsection command
bugs modlag fra62369, pro18892
bugs moddata bug75_1, bug75_2
- Corrected BRepAlgoAPI_Check.
- Removed package BOPTColStd.
- Rewritten test cases caf named_shape F8 F9.
- Removed unnecessary comments.
- Corrected the following test scripts :
boolean bcut_complex(012) O3 O4 O5 O6 O8
boolean bfuse_complex(013) O5 O6 P8
boolean bopcommon_complex(021) D8 D9
boolean bopfuse_complex(022) H1 J6
boolean boptuc_complex(024) D5
bugs modalg(006) bug399 bug497_1
feat featprism(003) C4
- Corrections in the treatment of section edges (putting paves on the curves);
- Corrections in BRepOffset_Tool;
- The following test cases have been rewritten according to the new format of the bsection command
bugs modalg bug6502, bug6554, bug6766_1, bug6766_3
- The new value of the result has been set in the following test cases
bugs modalg bug1255, bug1255_1
- The following test cases have been marked as invalid or rewritten
bugs modalg bug472_2, bug472_3, bug825_2
bugs moddata bug10603, bug152_1, bug152_2, bug3721_1, bug3721_2, bug3721_3
- The following test cases have been rewritten as improvements
bugs modalg bug693, bug693_1, bug817_1
bugs moddata bug3721_5, bug3721_6, bug6862_3, bug6862_4, bug6862_6
- Test cases bugs modlag buc60787_1, buc60787_2, buc60788_2, buc60788_3 have been corrected.
- Fixed some SALOME regressions (modifications in the treatment of the section edges);
- Fixed test case bugs modalg bug23100;
- Test cases bugs modalg bug21754, bug22990 have been corrected according to the new format of the bsection command.
- Test cases bugs modalg bug13116_*, bug23711 have been fixed;
- Test cases bugs modalg bug697_2, bug697_4, bug697_7, bug697_8 have been marked as invalid according to the issue 0022033;
- Test cases bugs modalg bug22109_2, bug22109_3 have been corrected;
- Test case bugs modalg bug18186 has been corrected as it is improvement;
- Test case bugs modalg bug22802 has been deleted as there is no package BOPTColStd.
This commit is contained in:
@@ -95,9 +95,9 @@ uses
|
||||
TopoDS,
|
||||
gp,
|
||||
Geom,
|
||||
Geom2d,
|
||||
BOP,
|
||||
BOPTools,
|
||||
Geom2d,
|
||||
BOPAlgo,
|
||||
BOPDS,
|
||||
BRepBuilderAPI
|
||||
is
|
||||
|
||||
@@ -116,5 +116,9 @@ is
|
||||
class Section;
|
||||
---Purpose: Perform the operation SECTION.
|
||||
---
|
||||
|
||||
class Check;
|
||||
---Purpose: Check shapes on validity for boolean
|
||||
--- operation.
|
||||
|
||||
end BRepAlgoAPI;
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
-- modified by Peter KURNEV Tue Mar 5 14:01:51 2002
|
||||
-- modified by Eugeny MALTCHIKOV Wed Jul 04 11:13:01 2012
|
||||
|
||||
|
||||
deferred class BooleanOperation from BRepAlgoAPI
|
||||
inherits MakeShape from BRepBuilderAPI
|
||||
@@ -37,11 +39,11 @@ uses
|
||||
|
||||
Shape from TopoDS,
|
||||
ListOfShape from TopTools,
|
||||
Operation from BOP,
|
||||
PBuilder from BOP,
|
||||
HistoryCollector from BOP,
|
||||
PDSFiller from BOPTools,
|
||||
DSFiller from BOPTools,
|
||||
Operation from BOPAlgo,
|
||||
BOP from BOPAlgo,
|
||||
PBOP from BOPAlgo,
|
||||
PaveFiller from BOPAlgo,
|
||||
PPaveFiller from BOPAlgo,
|
||||
DataMapOfIntegerListOfShape from TopTools,
|
||||
DataMapOfIntegerShape from TopTools,
|
||||
DataMapOfShapeShape from TopTools
|
||||
@@ -50,23 +52,23 @@ is
|
||||
|
||||
Initialize (S1 :Shape from TopoDS;
|
||||
S2 :Shape from TopoDS;
|
||||
anOperation:Operation from BOP);
|
||||
anOperation:Operation from BOPAlgo);
|
||||
---Purpose: Prepares the operations for S1 and S2.
|
||||
|
||||
Initialize (S1 :Shape from TopoDS;
|
||||
S2 :Shape from TopoDS;
|
||||
aDSF :DSFiller from BOPTools;
|
||||
anOperation:Operation from BOP);
|
||||
aDSF :PaveFiller from BOPAlgo;
|
||||
anOperation:Operation from BOPAlgo);
|
||||
---Purpose: Prepares the operations for S1 and S2.
|
||||
|
||||
SetOperation (me:out;
|
||||
anOp: Operation from BOP);
|
||||
anOp: Operation from BOPAlgo);
|
||||
---Purpose: Sets the type of Boolean operation to perform
|
||||
--- It can be BOP_SECTION
|
||||
--- BOP_COMMON
|
||||
--- BOP_FUSE
|
||||
--- BOP_CUT
|
||||
--- BOP_CUT21
|
||||
--- It can be BOPAlgo_SECTION
|
||||
--- BOPAlgo_COMMON
|
||||
--- BOPAlgo_FUSE
|
||||
--- BOPAlgo_CUT
|
||||
--- BOPAlgo_CUT21
|
||||
---
|
||||
|
||||
|
||||
@@ -89,7 +91,7 @@ is
|
||||
---C++: return const &
|
||||
|
||||
Operation (me)
|
||||
returns Operation from BOP;
|
||||
returns Operation from BOPAlgo;
|
||||
---Purpose: Returns the type of Boolean Operation that has been performed.
|
||||
|
||||
FuseEdges(me) returns Boolean from Standard;
|
||||
@@ -189,15 +191,13 @@ is
|
||||
---C++: return const &
|
||||
|
||||
fields
|
||||
myS1 : Shape from TopoDS is protected;
|
||||
myS2 : Shape from TopoDS is protected;
|
||||
myBuilderCanWork : Boolean from Standard is protected;
|
||||
myOperation : Operation from BOP is protected;
|
||||
myErrorStatus : Integer from Standard is protected;
|
||||
myDSFiller : PDSFiller from BOPTools is protected;
|
||||
myBuilder : PBuilder from BOP is protected;
|
||||
|
||||
myHistory : HistoryCollector from BOP is protected;
|
||||
myS1 : Shape from TopoDS is protected;
|
||||
myS2 : Shape from TopoDS is protected;
|
||||
myBuilderCanWork : Boolean from Standard is protected;
|
||||
myOperation : Operation from BOPAlgo is protected;
|
||||
myErrorStatus : Integer from Standard is protected;
|
||||
myDSFiller : PPaveFiller from BOPAlgo is protected;
|
||||
myBuilder : PBOP from BOPAlgo is protected;
|
||||
|
||||
myEntryType : Integer from Standard;
|
||||
|
||||
|
||||
@@ -18,42 +18,24 @@
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
#include <BRepAlgoAPI_BooleanOperation.ixx>
|
||||
|
||||
#include <BOP_Builder.hxx>
|
||||
#include <BOP_Section.hxx>
|
||||
#include <BOP_ShellShell.hxx>
|
||||
#include <BOP_SolidSolid.hxx>
|
||||
#include <BOP_ShellSolid.hxx>
|
||||
#include <BOP_WireWire.hxx>
|
||||
#include <BOP_WireShell.hxx>
|
||||
#include <BOP_WireSolid.hxx>
|
||||
#include <BOPTools_DSFiller.hxx>
|
||||
#include <BOPTools_Tools3D.hxx>
|
||||
#include <BOP_EmptyBuilder.hxx>
|
||||
|
||||
#include <BOP_WireSolidHistoryCollector.hxx>
|
||||
#include <BOP_ShellSolidHistoryCollector.hxx>
|
||||
#include <BOP_SolidSolidHistoryCollector.hxx>
|
||||
#include <BOP_SectionHistoryCollector.hxx>
|
||||
#include <BRepLib_FuseEdges.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
static Handle(BOP_HistoryCollector) MakeCollector(const TopoDS_Shape& theShape1,
|
||||
const TopoDS_Shape& theShape2,
|
||||
const BOP_Operation theOperation);
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_BOP.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAlgoAPI_BooleanOperation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& aS1,
|
||||
const TopoDS_Shape& aS2,
|
||||
const BOP_Operation anOp)
|
||||
const TopoDS_Shape& aS2,
|
||||
const BOPAlgo_Operation anOp)
|
||||
:
|
||||
myS1(aS1),
|
||||
myS2(aS2),
|
||||
@@ -71,9 +53,9 @@ static Handle(BOP_HistoryCollector) MakeCollector(const TopoDS_Shape& theS
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& aS1,
|
||||
const TopoDS_Shape& aS2,
|
||||
const BOPTools_DSFiller& aDSFiller,
|
||||
const BOP_Operation anOp)
|
||||
const TopoDS_Shape& aS2,
|
||||
const BOPAlgo_PaveFiller& aDSFiller,
|
||||
const BOPAlgo_Operation anOp)
|
||||
:
|
||||
myS1(aS1),
|
||||
myS2(aS2),
|
||||
@@ -86,7 +68,7 @@ static Handle(BOP_HistoryCollector) MakeCollector(const TopoDS_Shape& theS
|
||||
myFuseEdges(Standard_False)
|
||||
{
|
||||
if ((Standard_Address) &aDSFiller!=NULL) {
|
||||
myDSFiller=(BOPTools_PDSFiller)&aDSFiller;
|
||||
myDSFiller=(BOPAlgo_PaveFiller*)&aDSFiller;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -103,12 +85,16 @@ static Handle(BOP_HistoryCollector) MakeCollector(const TopoDS_Shape& theS
|
||||
delete myDSFiller;
|
||||
myDSFiller=NULL;
|
||||
}
|
||||
|
||||
//
|
||||
myModifFaces.Clear();
|
||||
myEdgeMap.Clear();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetOperation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_BooleanOperation::SetOperation (const BOP_Operation anOp)
|
||||
void BRepAlgoAPI_BooleanOperation::SetOperation (const BOPAlgo_Operation anOp)
|
||||
{
|
||||
myOperation=anOp;
|
||||
}
|
||||
@@ -116,7 +102,7 @@ static Handle(BOP_HistoryCollector) MakeCollector(const TopoDS_Shape& theS
|
||||
//function : Operation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BOP_Operation BRepAlgoAPI_BooleanOperation::Operation ()const
|
||||
BOPAlgo_Operation BRepAlgoAPI_BooleanOperation::Operation ()const
|
||||
{
|
||||
return myOperation;
|
||||
}
|
||||
@@ -175,13 +161,15 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
|
||||
return myGenerated;
|
||||
}
|
||||
else {
|
||||
const TopTools_ListOfShape& aLM=myBuilder->Modified(aS);
|
||||
myGenerated = myBuilder->Modified(aS);
|
||||
|
||||
if(myFuseEdges) {
|
||||
return RefinedList(aLM);
|
||||
TopTools_ListOfShape theLS;
|
||||
theLS.Assign(myGenerated);
|
||||
//
|
||||
RefinedList(theLS);
|
||||
}
|
||||
|
||||
return aLM;
|
||||
return myGenerated;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,28 +179,13 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepAlgoAPI_BooleanOperation::IsDeleted(const TopoDS_Shape& aS)
|
||||
{
|
||||
|
||||
// Standard_Boolean bDeleted = Standard_True;
|
||||
// if (myBuilder==NULL) {
|
||||
// return bDeleted;
|
||||
// }
|
||||
// else {
|
||||
// bDeleted=myBuilder->IsDeleted(aS);
|
||||
// return bDeleted;
|
||||
// }
|
||||
if(myHistory.IsNull()) {
|
||||
Standard_Boolean bDeleted = Standard_True;
|
||||
|
||||
if (myBuilder==NULL) {
|
||||
return bDeleted;
|
||||
}
|
||||
else {
|
||||
bDeleted = myBuilder->IsDeleted(aS);
|
||||
return bDeleted;
|
||||
}
|
||||
Standard_Boolean bDeleted = Standard_True;
|
||||
if (myBuilder != NULL) {
|
||||
bDeleted=myBuilder->IsDeleted(aS);
|
||||
}
|
||||
return myHistory->IsDeleted(aS);
|
||||
return bDeleted;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PrepareFiller
|
||||
//purpose :
|
||||
@@ -227,7 +200,7 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
|
||||
return bIsNewFiller;
|
||||
}
|
||||
//
|
||||
if (myOperation==BOP_UNKNOWN) {
|
||||
if (myOperation==BOPAlgo_UNKNOWN) {
|
||||
myErrorStatus=6;
|
||||
return bIsNewFiller;
|
||||
}
|
||||
@@ -235,22 +208,18 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
|
||||
if (myDSFiller==NULL) {
|
||||
bIsNewFiller=!bIsNewFiller;
|
||||
|
||||
myDSFiller=new BOPTools_DSFiller;
|
||||
myDSFiller=new BOPAlgo_PaveFiller;
|
||||
//
|
||||
if (myDSFiller==NULL) {
|
||||
myErrorStatus=4;
|
||||
return bIsNewFiller;
|
||||
}
|
||||
//
|
||||
myDSFiller->SetShapes(myS1, myS2);
|
||||
if (!myDSFiller->IsDone()) {
|
||||
myErrorStatus=3;
|
||||
if (myDSFiller!=NULL) {
|
||||
delete myDSFiller;
|
||||
myDSFiller = NULL;
|
||||
return bIsNewFiller;
|
||||
}
|
||||
}
|
||||
BOPCol_ListOfShape aLS;
|
||||
aLS.Append(myS1);
|
||||
aLS.Append(myS2);
|
||||
//
|
||||
myDSFiller->SetArguments(aLS);
|
||||
}
|
||||
|
||||
return bIsNewFiller;
|
||||
@@ -261,7 +230,8 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_BooleanOperation::Build()
|
||||
{
|
||||
Standard_Boolean bIsDone, bIsNewFiller;
|
||||
Standard_Boolean bIsNewFiller;
|
||||
Standard_Integer iErr;
|
||||
//
|
||||
myBuilderCanWork=Standard_False;
|
||||
NotDone();
|
||||
@@ -283,127 +253,26 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
|
||||
myBuilder=NULL;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aS1 = myDSFiller->Shape1();
|
||||
const TopoDS_Shape& aS2 = myDSFiller->Shape2();
|
||||
const TopoDS_Shape& aS1 = myS1;
|
||||
const TopoDS_Shape& aS2 = myS2;
|
||||
//
|
||||
myShape.Nullify();
|
||||
//
|
||||
// SECTION
|
||||
//
|
||||
if (myOperation==BOP_SECTION) {
|
||||
myBuilder=new BOP_Section;
|
||||
}
|
||||
//
|
||||
// COMMON, FUSE, CUT12, CUT21
|
||||
//
|
||||
else if (myOperation==BOP_COMMON || myOperation==BOP_FUSE ||
|
||||
myOperation==BOP_CUT || myOperation==BOP_CUT21) {
|
||||
//
|
||||
// Check whether one or both of the arguments is(are) empty shape(s)
|
||||
// If yes, create BOP_EmptyBuilder object and build the result fast.
|
||||
{
|
||||
Standard_Boolean bIsEmptyShape1, bIsEmptyShape2;
|
||||
|
||||
bIsEmptyShape1=BOPTools_Tools3D::IsEmptyShape(aS1);
|
||||
bIsEmptyShape2=BOPTools_Tools3D::IsEmptyShape(aS2);
|
||||
//
|
||||
if (bIsEmptyShape1 || bIsEmptyShape2) {
|
||||
myBuilder=new BOP_EmptyBuilder;
|
||||
//
|
||||
if (myBuilder==NULL) {
|
||||
myErrorStatus=7;
|
||||
return ;
|
||||
}
|
||||
//
|
||||
myBuilder->SetShapes(aS1, aS2);
|
||||
myBuilder->SetOperation (myOperation);
|
||||
myBuilder->DoWithFiller (*myDSFiller);
|
||||
|
||||
bIsDone=myBuilder->IsDone();
|
||||
|
||||
if (bIsDone) {
|
||||
myErrorStatus=0;
|
||||
myBuilderCanWork=Standard_True;
|
||||
myShape=myBuilder->Result();
|
||||
Done();
|
||||
}
|
||||
else {
|
||||
myErrorStatus=100+myBuilder->ErrorStatus();
|
||||
NotDone();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
//
|
||||
TopAbs_ShapeEnum aT1, aT2;
|
||||
|
||||
aT1=aS1.ShapeType();
|
||||
aT2=aS2.ShapeType();
|
||||
//
|
||||
// Shell / Shell
|
||||
if (aT1==TopAbs_SHELL && aT2==TopAbs_SHELL) {
|
||||
myBuilder=new BOP_ShellShell;
|
||||
}
|
||||
//
|
||||
// Solid / Solid
|
||||
else if (aT1==TopAbs_SOLID && aT2==TopAbs_SOLID) {
|
||||
myBuilder=new BOP_SolidSolid;
|
||||
}
|
||||
//
|
||||
// Shell / Solid
|
||||
else if ((aT1==TopAbs_SOLID && aT2==TopAbs_SHELL)
|
||||
||
|
||||
(aT2==TopAbs_SOLID && aT1==TopAbs_SHELL)) {
|
||||
myBuilder=new BOP_ShellSolid;
|
||||
}
|
||||
//
|
||||
// Wire / Wire
|
||||
else if (aT1==TopAbs_WIRE && aT2==TopAbs_WIRE){
|
||||
myBuilder=new BOP_WireWire;
|
||||
}
|
||||
//
|
||||
// Wire / Shell
|
||||
else if ((aT1==TopAbs_WIRE && aT2==TopAbs_SHELL)
|
||||
||
|
||||
(aT2==TopAbs_WIRE && aT1==TopAbs_SHELL)) {
|
||||
myBuilder=new BOP_WireShell;
|
||||
}
|
||||
//
|
||||
// Wire / Shell
|
||||
else if ((aT1==TopAbs_WIRE && aT2==TopAbs_SOLID)
|
||||
||
|
||||
(aT2==TopAbs_WIRE && aT1==TopAbs_SOLID)) {
|
||||
myBuilder=new BOP_WireSolid;
|
||||
}
|
||||
else {
|
||||
myErrorStatus=5;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
myBuilder=new BOPAlgo_BOP;
|
||||
myBuilder->AddArgument(aS1);
|
||||
myBuilder->AddTool(aS2);
|
||||
myBuilder->SetOperation(myOperation);
|
||||
//
|
||||
if (myBuilder==NULL) {
|
||||
myErrorStatus=7;
|
||||
return ;
|
||||
}
|
||||
//
|
||||
myBuilder->SetShapes(aS1, aS2);
|
||||
myBuilder->SetOperation (myOperation);
|
||||
|
||||
myHistory = MakeCollector(aS1, aS2, myOperation);
|
||||
myBuilder->SetHistoryCollector(myHistory);
|
||||
|
||||
myBuilder->DoWithFiller (*myDSFiller);
|
||||
|
||||
bIsDone=myBuilder->IsDone();
|
||||
|
||||
if (bIsDone) {
|
||||
myBuilder->PerformWithFiller(*myDSFiller);
|
||||
iErr = myBuilder->ErrorStatus();
|
||||
if (!iErr) {
|
||||
myErrorStatus=0;
|
||||
myBuilderCanWork=Standard_True;
|
||||
myShape=myBuilder->Result();
|
||||
myShape=myBuilder->Shape();
|
||||
Done();
|
||||
}
|
||||
}
|
||||
else {
|
||||
myErrorStatus=100+myBuilder->ErrorStatus();
|
||||
myErrorStatus=100+iErr;
|
||||
NotDone();
|
||||
}
|
||||
}
|
||||
@@ -419,17 +288,43 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::SectionEdges()
|
||||
myGenerated.Clear();
|
||||
return myGenerated;
|
||||
}
|
||||
else {
|
||||
const TopTools_ListOfShape& aLM=myBuilder->SectionEdges();
|
||||
|
||||
if(myFuseEdges) {
|
||||
return RefinedList(aLM);
|
||||
//
|
||||
Standard_Integer aNb, i, j, aNbCurves, nE;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock anIt;
|
||||
//
|
||||
const BOPDS_PDS& pDS = myDSFiller->PDS();
|
||||
BOPDS_VectorOfInterfFF& aFFs=pDS->InterfFF();
|
||||
myGenerated.Clear();
|
||||
//
|
||||
aNb=aFFs.Extent();
|
||||
for (i = 0; i < aNb; i++) {
|
||||
BOPDS_InterfFF& aFFi=aFFs(i);
|
||||
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();
|
||||
//
|
||||
anIt.Initialize(aSectEdges);
|
||||
for(; anIt.More(); anIt.Next()) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = anIt.Value();
|
||||
nE = aPB->Edge();
|
||||
const TopoDS_Shape& aE = pDS->Shape(nE);
|
||||
myGenerated.Append(aE);
|
||||
}
|
||||
}
|
||||
|
||||
return aLM;
|
||||
}
|
||||
//
|
||||
if(myFuseEdges) {
|
||||
TopTools_ListOfShape theLS;
|
||||
theLS.Assign(myGenerated);
|
||||
//
|
||||
RefinedList(theLS);
|
||||
}
|
||||
//
|
||||
return myGenerated;
|
||||
}
|
||||
//
|
||||
|
||||
// ================================================================================================
|
||||
// function: Modified2
|
||||
@@ -437,17 +332,34 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::SectionEdges()
|
||||
// ================================================================================================
|
||||
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified2(const TopoDS_Shape& aS)
|
||||
{
|
||||
if(myHistory.IsNull()) {
|
||||
if (myBuilder==NULL) {
|
||||
myGenerated.Clear();
|
||||
return myGenerated;
|
||||
}
|
||||
|
||||
if(myFuseEdges) {
|
||||
const TopTools_ListOfShape& aL = myHistory->Modified(aS);
|
||||
return RefinedList(aL);
|
||||
//
|
||||
BOPCol_ListOfShape aLS;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
myGenerated.Clear();
|
||||
//
|
||||
const BOPCol_DataMapOfShapeListOfShape& aImages = myBuilder->Images();
|
||||
if (aImages.IsBound(aS)) {
|
||||
aLS = aImages.Find(aS);
|
||||
} else {
|
||||
myGenerated.Append(aS);
|
||||
}
|
||||
|
||||
return myHistory->Modified(aS);
|
||||
//
|
||||
aIt.Initialize(aLS);
|
||||
for (;aIt.More(); aIt.Next()) {
|
||||
myGenerated.Append(aIt.Value());
|
||||
}
|
||||
//
|
||||
if (myFuseEdges) {
|
||||
TopTools_ListOfShape theLS;
|
||||
theLS.Assign(myGenerated);
|
||||
//
|
||||
RefinedList(theLS);
|
||||
}
|
||||
return myGenerated;
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
@@ -456,17 +368,17 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified2(const TopoDS
|
||||
// ================================================================================================
|
||||
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Generated(const TopoDS_Shape& S)
|
||||
{
|
||||
if(myHistory.IsNull()) {
|
||||
if (myBuilder==NULL) {
|
||||
myGenerated.Clear();
|
||||
return myGenerated;
|
||||
}
|
||||
|
||||
//
|
||||
if(myFuseEdges) {
|
||||
const TopTools_ListOfShape& aL = myHistory->Generated(S);
|
||||
const TopTools_ListOfShape& aL = myBuilder->Generated(S);
|
||||
return RefinedList(aL);
|
||||
}
|
||||
|
||||
return myHistory->Generated(S);
|
||||
|
||||
return myBuilder->Generated(S);
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
@@ -475,10 +387,10 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Generated(const TopoDS
|
||||
// ================================================================================================
|
||||
Standard_Boolean BRepAlgoAPI_BooleanOperation::HasModified() const
|
||||
{
|
||||
if(myHistory.IsNull()) {
|
||||
if (myBuilder==NULL) {
|
||||
return Standard_False;
|
||||
}
|
||||
return myHistory->HasModified();
|
||||
return myBuilder->HasModified();
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
@@ -487,10 +399,10 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasModified() const
|
||||
// ================================================================================================
|
||||
Standard_Boolean BRepAlgoAPI_BooleanOperation::HasGenerated() const
|
||||
{
|
||||
if(myHistory.IsNull()) {
|
||||
if (myBuilder==NULL) {
|
||||
return Standard_False;
|
||||
}
|
||||
return myHistory->HasGenerated();
|
||||
return myBuilder->HasGenerated();
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
@@ -499,10 +411,10 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasGenerated() const
|
||||
// ================================================================================================
|
||||
Standard_Boolean BRepAlgoAPI_BooleanOperation::HasDeleted() const
|
||||
{
|
||||
if(myHistory.IsNull()) {
|
||||
if (myBuilder==NULL) {
|
||||
return Standard_False;
|
||||
}
|
||||
return myHistory->HasDeleted();
|
||||
return myBuilder->HasDeleted();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : RefineEdges
|
||||
@@ -511,7 +423,6 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasDeleted() const
|
||||
|
||||
void BRepAlgoAPI_BooleanOperation::RefineEdges ()
|
||||
{
|
||||
|
||||
if(myFuseEdges) return; //Edges have been refined yet
|
||||
|
||||
BRepLib_FuseEdges FE(myShape);
|
||||
@@ -540,7 +451,6 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasDeleted() const
|
||||
FE.ResultEdges(aResultEdges);
|
||||
FE.Faces(myModifFaces);
|
||||
myFuseEdges = Standard_True;
|
||||
|
||||
|
||||
Standard_Integer i;
|
||||
for(i = 1; i <= nle; ++i) {
|
||||
@@ -548,11 +458,10 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasDeleted() const
|
||||
const TopTools_ListOfShape& aListOfOldEdges = aFusedEdges(i);
|
||||
TopTools_ListIteratorOfListOfShape anIter(aListOfOldEdges);
|
||||
for(; anIter.More(); anIter.Next()) {
|
||||
myEdgeMap.Bind(anIter.Value(), aNewE);
|
||||
myEdgeMap.Bind(anIter.Value(), aNewE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -572,21 +481,21 @@ const TopTools_ListOfShape&
|
||||
|
||||
if(anS.ShapeType() == TopAbs_EDGE) {
|
||||
if(myEdgeMap.IsBound(anS)) {
|
||||
const TopoDS_Shape& aNewEdge = myEdgeMap.Find(anS);
|
||||
if(aMap.Add(aNewEdge)) {
|
||||
myGenerated.Append(aNewEdge);
|
||||
}
|
||||
const TopoDS_Shape& aNewEdge = myEdgeMap.Find(anS);
|
||||
if(aMap.Add(aNewEdge)) {
|
||||
myGenerated.Append(aNewEdge);
|
||||
}
|
||||
}
|
||||
else {
|
||||
myGenerated.Append(anS);
|
||||
myGenerated.Append(anS);
|
||||
}
|
||||
}
|
||||
else if (anS.ShapeType() == TopAbs_FACE) {
|
||||
if(myModifFaces.IsBound(anS)) {
|
||||
myGenerated.Append(myModifFaces.Find(anS));
|
||||
myGenerated.Append(myModifFaces.Find(anS));
|
||||
}
|
||||
else {
|
||||
myGenerated.Append(anS);
|
||||
myGenerated.Append(anS);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -597,61 +506,3 @@ const TopTools_ListOfShape&
|
||||
return myGenerated;
|
||||
|
||||
}
|
||||
// -----------------------------------------------------------------------------------------
|
||||
// static function: MakeCollector
|
||||
// purpose:
|
||||
// -----------------------------------------------------------------------------------------
|
||||
Handle(BOP_HistoryCollector) MakeCollector(const TopoDS_Shape& theShape1,
|
||||
const TopoDS_Shape& theShape2,
|
||||
const BOP_Operation theOperation) {
|
||||
|
||||
Handle(BOP_HistoryCollector) aresult;
|
||||
|
||||
if(theOperation == BOP_SECTION) {
|
||||
aresult = new BOP_SectionHistoryCollector(theShape1, theShape2);
|
||||
return aresult;
|
||||
}
|
||||
|
||||
TopAbs_ShapeEnum aT1, aT2;
|
||||
|
||||
aT1 = theShape1.ShapeType();
|
||||
aT2 = theShape2.ShapeType();
|
||||
//
|
||||
// Shell / Shell
|
||||
if (aT1==TopAbs_SHELL && aT2==TopAbs_SHELL) {
|
||||
// aresult = new BOP_ShellShellHistoryCollector(theShape1, theShape2, theOperation, theDSFiller);
|
||||
}
|
||||
//
|
||||
// Solid / Solid
|
||||
else if (aT1==TopAbs_SOLID && aT2==TopAbs_SOLID) {
|
||||
aresult = new BOP_SolidSolidHistoryCollector(theShape1, theShape2, theOperation);
|
||||
}
|
||||
//
|
||||
// Shell / Solid
|
||||
else if ((aT1==TopAbs_SOLID && aT2==TopAbs_SHELL)
|
||||
||
|
||||
(aT2==TopAbs_SOLID && aT1==TopAbs_SHELL)) {
|
||||
aresult = new BOP_ShellSolidHistoryCollector(theShape1, theShape2, theOperation);
|
||||
}
|
||||
//
|
||||
// Wire / Wire
|
||||
else if (aT1==TopAbs_WIRE && aT2==TopAbs_WIRE){
|
||||
// aresult = new BOP_WireWireHistoryCollector(theShape1, theShape2, theOperation, theDSFiller);
|
||||
}
|
||||
//
|
||||
// Wire / Shell
|
||||
else if ((aT1==TopAbs_WIRE && aT2==TopAbs_SHELL)
|
||||
||
|
||||
(aT2==TopAbs_WIRE && aT1==TopAbs_SHELL)) {
|
||||
// aresult = new BOP_WireShellHistoryCollector(theShape1, theShape2, theOperation, theDSFiller);
|
||||
}
|
||||
//
|
||||
// Wire / Shell
|
||||
else if ((aT1==TopAbs_WIRE && aT2==TopAbs_SOLID)
|
||||
||
|
||||
(aT2==TopAbs_WIRE && aT1==TopAbs_SOLID)) {
|
||||
aresult = new BOP_WireSolidHistoryCollector(theShape1, theShape2, theOperation);
|
||||
}
|
||||
return aresult;
|
||||
}
|
||||
|
||||
|
||||
129
src/BRepAlgoAPI/BRepAlgoAPI_Check.cdl
Normal file
129
src/BRepAlgoAPI/BRepAlgoAPI_Check.cdl
Normal file
@@ -0,0 +1,129 @@
|
||||
-- Created on: 2012-12-17
|
||||
-- Created by: Eugeny MALTCHIKOV
|
||||
-- Copyright (c) 2012-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
class Check from BRepAlgoAPI
|
||||
---Purpose:
|
||||
-- The class Check provides a diagnostic tool for checking
|
||||
-- single shape or couple of shapes.
|
||||
-- Single shape is checking on topological validity, small edges
|
||||
-- and self-interference. For couple of shapes added check
|
||||
-- on validity for boolean operation of given type.
|
||||
--
|
||||
-- The class provides two ways of checking shape(-s)
|
||||
-- 1. Constructors
|
||||
-- BRepAlgoAPI_Check aCh(theS);
|
||||
-- Standard_Boolean bV=aCh.IsValid();
|
||||
-- 2. Methods SetData and Perform
|
||||
-- BRepAlgoAPI_Check aCh;
|
||||
-- aCh.SetData(theS1, theS2, BOPAlgo_FUSE, Standard_False);
|
||||
-- aCh.Perform();
|
||||
-- Standard_Boolean bV=aCh.IsValid();
|
||||
|
||||
uses
|
||||
Shape from TopoDS,
|
||||
Operation from BOPAlgo,
|
||||
PArgumentAnalyzer from BOPAlgo,
|
||||
ListOfCheckResult from BOPAlgo
|
||||
|
||||
is
|
||||
Create
|
||||
returns Check from BRepAlgoAPI;
|
||||
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Check();"
|
||||
---Purpose: Empty constructor.
|
||||
|
||||
Create(
|
||||
theS : Shape from TopoDS;
|
||||
bTestSE : Boolean from Standard = Standard_True;
|
||||
bTestSI : Boolean from Standard = Standard_True)
|
||||
returns Check from BRepAlgoAPI;
|
||||
---Purpose: Constructor for checking single shape.
|
||||
-- It calls methods
|
||||
-- Init(theS, TopoDS_Shape(), BOPAlgo_UNKNOWN, bTestSE, bTestSI)
|
||||
-- and Perform().
|
||||
-- Params:
|
||||
-- theS - the shape that should be checked;
|
||||
-- bTestSE - flag that specifies whether check on small edges
|
||||
-- should be performed; by default it is set to TRUE;
|
||||
-- bTestSI - flag that specifies whether check on self-interference
|
||||
-- should be performed; by default it is set to TRUE;
|
||||
|
||||
Create(
|
||||
theS1 : Shape from TopoDS;
|
||||
theS2 : Shape from TopoDS;
|
||||
theOp : Operation from BOPAlgo = BOPAlgo_UNKNOWN;
|
||||
bTestSE : Boolean from Standard = Standard_True;
|
||||
bTestSI : Boolean from Standard = Standard_True)
|
||||
returns Check from BRepAlgoAPI;
|
||||
---Purpose: Constructor for couple of shapes.
|
||||
-- It calls methods
|
||||
-- Init(theS1, theS2, theOp, bTestSE, bTestSI) and Perform().
|
||||
-- Params:
|
||||
-- theS1, theS2 - the initial shapes.
|
||||
-- theOp - the type of Boolean Operation;
|
||||
-- if it is not defined (set to UNKNOWN) for each shape
|
||||
-- performed check as for single shape.
|
||||
-- bTestSE - flag that specifies whether check on small edges
|
||||
-- should be performed; by default it is set to TRUE;
|
||||
-- bTestSI - flag that specifies whether check on self-interference
|
||||
-- should be performed; by default it is set to TRUE;
|
||||
|
||||
Init(me:out;
|
||||
theS1 : Shape from TopoDS;
|
||||
theS2 : Shape from TopoDS;
|
||||
theOp : Operation from BOPAlgo;
|
||||
bTestSE : Boolean from Standard;
|
||||
bTestSI : Boolean from Standard)
|
||||
is protected;
|
||||
---Purpose: Initialyzes data.
|
||||
|
||||
SetData(me:out;
|
||||
theS : Shape from TopoDS;
|
||||
bTestSE : Boolean from Standard = Standard_True;
|
||||
bTestSI : Boolean from Standard = Standard_True);
|
||||
---Purpose: Sets data for check by Init method.
|
||||
-- The method provides alternative way for checking single shape.
|
||||
|
||||
SetData(me:out;
|
||||
theS1 : Shape from TopoDS;
|
||||
theS2 : Shape from TopoDS;
|
||||
theOp : Operation from BOPAlgo = BOPAlgo_UNKNOWN;
|
||||
bTestSE : Boolean from Standard = Standard_True;
|
||||
bTestSI : Boolean from Standard = Standard_True);
|
||||
---Purpose: Sets data for check by Init method.
|
||||
-- The method provides alternative way for checking couple of shapes.
|
||||
|
||||
Perform(me:out);
|
||||
---Purpose: Performs the check.
|
||||
|
||||
IsValid(me:out)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Shows whether shape(s) valid or not.
|
||||
|
||||
Result(me:out)
|
||||
returns ListOfCheckResult from BOPAlgo;
|
||||
---C++: return const&
|
||||
---Purpose: Returns faulty shapes.
|
||||
|
||||
fields
|
||||
myS1, myS2 : Shape from TopoDS is protected;
|
||||
myAnalyzer : PArgumentAnalyzer from BOPAlgo is protected;
|
||||
myResult : ListOfCheckResult from BOPAlgo is protected;
|
||||
|
||||
end BooleanOperation;
|
||||
|
||||
184
src/BRepAlgoAPI/BRepAlgoAPI_Check.cxx
Normal file
184
src/BRepAlgoAPI/BRepAlgoAPI_Check.cxx
Normal file
@@ -0,0 +1,184 @@
|
||||
// Created on: 2012-12-17
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2012-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#include <BRepAlgoAPI_Check.ixx>
|
||||
#include <BOPAlgo_ArgumentAnalyzer.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <BRepCheck_Analyzer.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAlgoAPI_Check
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Check::BRepAlgoAPI_Check()
|
||||
: myAnalyzer(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAlgoAPI_Check
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS,
|
||||
const Standard_Boolean bTestSE,
|
||||
const Standard_Boolean bTestSI)
|
||||
{
|
||||
Init(theS, TopoDS_Shape(), BOPAlgo_UNKNOWN, bTestSE, bTestSI);
|
||||
//
|
||||
Perform();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAlgoAPI_Check
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS1,
|
||||
const TopoDS_Shape& theS2,
|
||||
const BOPAlgo_Operation theOp,
|
||||
const Standard_Boolean bTestSE,
|
||||
const Standard_Boolean bTestSI)
|
||||
{
|
||||
Init(theS1, theS2, theOp, bTestSE, bTestSI);
|
||||
//
|
||||
Perform();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ~BRepAlgoAPI_Check
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Check::~BRepAlgoAPI_Check()
|
||||
{
|
||||
if(myAnalyzer){
|
||||
delete myAnalyzer;
|
||||
myAnalyzer=NULL;
|
||||
}
|
||||
myResult.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetData
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_Check::SetData(const TopoDS_Shape& theS,
|
||||
const Standard_Boolean bTestSE,
|
||||
const Standard_Boolean bTestSI)
|
||||
{
|
||||
Init(theS, TopoDS_Shape(), BOPAlgo_UNKNOWN, bTestSE, bTestSI);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetData
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_Check::SetData(const TopoDS_Shape& theS1,
|
||||
const TopoDS_Shape& theS2,
|
||||
const BOPAlgo_Operation theOp,
|
||||
const Standard_Boolean bTestSE,
|
||||
const Standard_Boolean bTestSI)
|
||||
{
|
||||
Init(theS1, theS2, theOp, bTestSE, bTestSI);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_Check::Init(const TopoDS_Shape& theS1,
|
||||
const TopoDS_Shape& theS2,
|
||||
const BOPAlgo_Operation theOp,
|
||||
const Standard_Boolean bTestSE,
|
||||
const Standard_Boolean bTestSI)
|
||||
{
|
||||
myResult.Clear();
|
||||
myS1 = theS1.IsNull() ? theS1 : BRepBuilderAPI_Copy(theS1).Shape();
|
||||
myS2 = theS2.IsNull() ? theS2 : BRepBuilderAPI_Copy(theS2).Shape();
|
||||
//
|
||||
myAnalyzer = new BOPAlgo_ArgumentAnalyzer();
|
||||
//
|
||||
myAnalyzer->SetShape1(myS1);
|
||||
myAnalyzer->SetShape2(myS2);
|
||||
myAnalyzer->OperationType()=theOp;
|
||||
myAnalyzer->ArgumentTypeMode() = Standard_True;
|
||||
myAnalyzer->SmallEdgeMode() = bTestSE;
|
||||
myAnalyzer->SelfInterMode() = bTestSI;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Result
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const BOPAlgo_ListOfCheckResult& BRepAlgoAPI_Check::Result()
|
||||
{
|
||||
return myResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsValid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepAlgoAPI_Check::IsValid()
|
||||
{
|
||||
return myResult.IsEmpty();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_Check::Perform()
|
||||
{
|
||||
Standard_Boolean isS1, isS2;
|
||||
//incompatibility of shape types, small edges and self-interference
|
||||
myAnalyzer->Perform();
|
||||
if (myAnalyzer->HasFaulty()) {
|
||||
myResult = myAnalyzer->GetCheckResult();
|
||||
}
|
||||
|
||||
//topological validity
|
||||
isS1 = !myS1.IsNull();
|
||||
isS2 = !myS2.IsNull();
|
||||
if (isS1) {
|
||||
BRepCheck_Analyzer anS1(myS1);
|
||||
isS1 = anS1.IsValid();
|
||||
} else {
|
||||
isS1 = Standard_True;
|
||||
}
|
||||
//
|
||||
if (isS2) {
|
||||
BRepCheck_Analyzer anS2(myS2);
|
||||
isS2 = anS2.IsValid();
|
||||
} else {
|
||||
isS2 = Standard_True;
|
||||
}
|
||||
if (!isS1 || !isS2) {
|
||||
BOPAlgo_CheckResult aRes;
|
||||
aRes.SetCheckStatus(BOPAlgo_NotValid);
|
||||
if (!isS1) {
|
||||
aRes.SetShape1(myS1);
|
||||
}
|
||||
if (!isS1) {
|
||||
aRes.SetShape2(myS2);
|
||||
}
|
||||
myResult.Append(aRes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class Common from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
|
||||
|
||||
uses
|
||||
Shape from TopoDS,
|
||||
DSFiller from BOPTools
|
||||
PaveFiller from BOPAlgo
|
||||
|
||||
is
|
||||
Create (S1,S2 : Shape from TopoDS)
|
||||
@@ -40,7 +40,7 @@ is
|
||||
---Purpose: Constructs a common part for shapes aS1 and aS2 .
|
||||
|
||||
Create (S1,S2 : Shape from TopoDS;
|
||||
aDSF:DSFiller from BOPTools)
|
||||
aDSF:PaveFiller from BOPAlgo)
|
||||
returns Common from BRepAlgoAPI;
|
||||
end Common;
|
||||
--- Purpose: Constructs a common part for shapes aS1 and aS2 using aDSFiller
|
||||
|
||||
@@ -18,19 +18,17 @@
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
#include <BRepAlgoAPI_Common.ixx>
|
||||
|
||||
#include <BRepAlgoAPI_BooleanOperation.hxx>
|
||||
#include <BOP_Operation.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAlgoAPI_Common
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1,
|
||||
const TopoDS_Shape& S2)
|
||||
: BRepAlgoAPI_BooleanOperation(S1, S2, BOP_COMMON)
|
||||
BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1,
|
||||
const TopoDS_Shape& S2)
|
||||
: BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_COMMON)
|
||||
{
|
||||
BRepAlgoAPI_BooleanOperation* pBO=
|
||||
(BRepAlgoAPI_BooleanOperation*) (void*) this;
|
||||
@@ -41,9 +39,9 @@ BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1,
|
||||
const TopoDS_Shape& S2,
|
||||
const BOPTools_DSFiller& aDSF)
|
||||
: BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, BOP_COMMON)
|
||||
const TopoDS_Shape& S2,
|
||||
const BOPAlgo_PaveFiller& aDSF)
|
||||
: BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, BOPAlgo_COMMON)
|
||||
{
|
||||
BRepAlgoAPI_BooleanOperation* pBO=
|
||||
(BRepAlgoAPI_BooleanOperation*) (void*) this;
|
||||
|
||||
@@ -31,8 +31,7 @@ class Cut from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
|
||||
|
||||
uses
|
||||
Shape from TopoDS,
|
||||
DSFiller from BOPTools,
|
||||
Operation from BOP
|
||||
PaveFiller from BOPAlgo
|
||||
|
||||
is
|
||||
Create (S1,S2 : Shape from TopoDS)
|
||||
@@ -40,8 +39,9 @@ is
|
||||
---Purpose: Shape aS2 cuts shape aS1. The
|
||||
-- resulting shape is a new shape produced by the cut operation.
|
||||
|
||||
|
||||
Create (S1,S2 : Shape from TopoDS;
|
||||
aDSF : DSFiller from BOPTools;
|
||||
aDSF : PaveFiller from BOPAlgo;
|
||||
bFWD : Boolean from Standard=Standard_True)
|
||||
returns Cut from BRepAlgoAPI;
|
||||
--- Purpose: Constructs a new shape cut from
|
||||
|
||||
@@ -19,19 +19,17 @@
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
|
||||
#include <BRepAlgoAPI_Cut.ixx>
|
||||
|
||||
#include <BRepAlgoAPI_BooleanOperation.hxx>
|
||||
#include <BOP_Operation.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAlgoAPI_Cut
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
|
||||
const TopoDS_Shape& S2)
|
||||
: BRepAlgoAPI_BooleanOperation(S1, S2, BOP_CUT)
|
||||
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
|
||||
const TopoDS_Shape& S2)
|
||||
: BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_CUT)
|
||||
{
|
||||
BRepAlgoAPI_BooleanOperation* pBO=
|
||||
(BRepAlgoAPI_BooleanOperation*) (void*) this;
|
||||
@@ -42,10 +40,10 @@ BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
|
||||
const TopoDS_Shape& S2,
|
||||
const BOPTools_DSFiller& aDSF,
|
||||
const Standard_Boolean bFWD)
|
||||
: BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, (bFWD) ? BOP_CUT : BOP_CUT21)
|
||||
const TopoDS_Shape& S2,
|
||||
const BOPAlgo_PaveFiller& aDSF,
|
||||
const Standard_Boolean bFWD)
|
||||
: BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, (bFWD) ? BOPAlgo_CUT : BOPAlgo_CUT21)
|
||||
{
|
||||
BRepAlgoAPI_BooleanOperation* pBO=
|
||||
(BRepAlgoAPI_BooleanOperation*) (void*) this;
|
||||
|
||||
@@ -32,7 +32,7 @@ class Fuse from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
|
||||
|
||||
uses
|
||||
Shape from TopoDS,
|
||||
DSFiller from BOPTools
|
||||
PaveFiller from BOPAlgo
|
||||
|
||||
is
|
||||
Create (S1,S2 : Shape from TopoDS)
|
||||
@@ -40,7 +40,7 @@ is
|
||||
---Purpose: Constructs a fuse of shapes aS1 and aS2.
|
||||
|
||||
Create (S1,S2 : Shape from TopoDS;
|
||||
aDSF:DSFiller from BOPTools)
|
||||
aDSF:PaveFiller from BOPAlgo)
|
||||
returns Fuse from BRepAlgoAPI;
|
||||
|
||||
---Purpose: Constructs a new shape that is a fuse of shapes aS1 and aS2 using aDSFiller.
|
||||
|
||||
@@ -22,15 +22,14 @@
|
||||
#include <BRepAlgoAPI_Fuse.ixx>
|
||||
|
||||
#include <BRepAlgoAPI_BooleanOperation.hxx>
|
||||
#include <BOP_Operation.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepAlgoAPI_Fuse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
|
||||
const TopoDS_Shape& S2)
|
||||
: BRepAlgoAPI_BooleanOperation(S1, S2, BOP_FUSE)
|
||||
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
|
||||
const TopoDS_Shape& S2)
|
||||
: BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_FUSE)
|
||||
{
|
||||
BRepAlgoAPI_BooleanOperation* pBO=
|
||||
(BRepAlgoAPI_BooleanOperation*) (void*) this;
|
||||
@@ -42,9 +41,9 @@ BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
|
||||
const TopoDS_Shape& S2,
|
||||
const BOPTools_DSFiller& aDSF)
|
||||
: BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, BOP_FUSE)
|
||||
const TopoDS_Shape& S2,
|
||||
const BOPAlgo_PaveFiller& aDSF)
|
||||
: BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, BOPAlgo_FUSE)
|
||||
{
|
||||
BRepAlgoAPI_BooleanOperation* pBO=
|
||||
(BRepAlgoAPI_BooleanOperation*) (void*) this;
|
||||
|
||||
@@ -51,14 +51,15 @@ uses
|
||||
Shape from TopoDS,
|
||||
Surface from Geom,
|
||||
Curve from Geom2d,
|
||||
DSFiller from BOPTools,
|
||||
PaveFiller from BOPAlgo,
|
||||
ListOfShape from TopTools
|
||||
|
||||
is
|
||||
Create (S1,S2 : Shape from TopoDS;
|
||||
aDSF:DSFiller from BOPTools;
|
||||
aDSF:PaveFiller from BOPAlgo;
|
||||
PerformNow : Boolean = Standard_True)
|
||||
returns Section from BRepAlgoAPI;
|
||||
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Section(){}"
|
||||
|
||||
Create(Sh1,Sh2 : Shape from TopoDS;
|
||||
PerformNow : Boolean = Standard_True)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
// modified by Michael KLOKOV Wed Mar 6 15:01:25 2002
|
||||
// modified by Eugeny MALTCHIKOV Wed Jul 04 11:13:01 2012
|
||||
|
||||
#include <BRepAlgoAPI_Section.ixx>
|
||||
|
||||
@@ -27,19 +28,7 @@
|
||||
#include <BRepBuilderAPI_MakeShell.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <BOP_Section.hxx>
|
||||
#include <BOPTools_SSIntersectionAttribute.hxx>
|
||||
|
||||
#include <BOPTools_SplitShapesPool.hxx>
|
||||
#include <BOPTools_InterferencePool.hxx>
|
||||
|
||||
#include <BOPTools_PaveBlock.hxx>
|
||||
#include <BOPTools_PaveFiller.hxx>
|
||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
||||
#include <BOPTools_ListOfPaveBlock.hxx>
|
||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
||||
#include <BOPTools_SSInterference.hxx>
|
||||
#include <BOPTools_Curve.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
@@ -47,7 +36,9 @@
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <BOP_SectionHistoryCollector.hxx>
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_BOP.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
|
||||
static TopoDS_Shape MakeShape(const Handle(Geom_Surface)& S)
|
||||
{
|
||||
@@ -56,19 +47,19 @@ static TopoDS_Shape MakeShape(const Handle(Geom_Surface)& S)
|
||||
else return BRepBuilderAPI_MakeShell(S);
|
||||
}
|
||||
|
||||
static Standard_Boolean HasAncestorFaces(const BOPTools_DSFiller& theDSFiller,
|
||||
const TopoDS_Shape& E,
|
||||
TopoDS_Shape& F1,
|
||||
TopoDS_Shape& F2);
|
||||
static Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
|
||||
const TopoDS_Shape& E,
|
||||
TopoDS_Shape& F1,
|
||||
TopoDS_Shape& F2);
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh1,
|
||||
const TopoDS_Shape& Sh2,
|
||||
const Standard_Boolean PerformNow)
|
||||
: BRepAlgoAPI_BooleanOperation(Sh1, Sh2, BOP_SECTION)
|
||||
const TopoDS_Shape& Sh2,
|
||||
const Standard_Boolean PerformNow)
|
||||
: BRepAlgoAPI_BooleanOperation(Sh1, Sh2, BOPAlgo_SECTION)
|
||||
{
|
||||
InitParameters();
|
||||
myparameterschanged = Standard_True;
|
||||
@@ -77,15 +68,16 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh1,
|
||||
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
|
||||
myshapeisnull = Standard_True;
|
||||
}
|
||||
if (PerformNow)
|
||||
if (PerformNow) {
|
||||
Build();
|
||||
}
|
||||
}
|
||||
|
||||
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& aS1,
|
||||
const TopoDS_Shape& aS2,
|
||||
const BOPTools_DSFiller& aDSF,
|
||||
const Standard_Boolean PerformNow)
|
||||
: BRepAlgoAPI_BooleanOperation(aS1, aS2, aDSF, BOP_SECTION)
|
||||
const TopoDS_Shape& aS2,
|
||||
const BOPAlgo_PaveFiller& aDSF,
|
||||
const Standard_Boolean PerformNow)
|
||||
: BRepAlgoAPI_BooleanOperation(aS1, aS2, aDSF, BOPAlgo_SECTION)
|
||||
{
|
||||
InitParameters();
|
||||
myparameterschanged = Standard_True;
|
||||
@@ -95,7 +87,7 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& aS1,
|
||||
myshapeisnull = Standard_True;
|
||||
}
|
||||
|
||||
if(PerformNow) {
|
||||
if (PerformNow) {
|
||||
Build();
|
||||
}
|
||||
}
|
||||
@@ -106,9 +98,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& aS1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
|
||||
const gp_Pln& Pl,
|
||||
const Standard_Boolean PerformNow)
|
||||
: BRepAlgoAPI_BooleanOperation(Sh, MakeShape(new Geom_Plane(Pl)), BOP_SECTION)
|
||||
const gp_Pln& Pl,
|
||||
const Standard_Boolean PerformNow)
|
||||
: BRepAlgoAPI_BooleanOperation(Sh, MakeShape(new Geom_Plane(Pl)), BOPAlgo_SECTION)
|
||||
{
|
||||
InitParameters();
|
||||
myparameterschanged = Standard_True;
|
||||
@@ -117,8 +109,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
|
||||
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
|
||||
myshapeisnull = Standard_True;
|
||||
}
|
||||
if (PerformNow)
|
||||
if (PerformNow) {
|
||||
Build();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -126,9 +119,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
|
||||
const Handle(Geom_Surface)& Sf,
|
||||
const Standard_Boolean PerformNow)
|
||||
: BRepAlgoAPI_BooleanOperation(Sh, MakeShape(Sf), BOP_SECTION)
|
||||
const Handle(Geom_Surface)& Sf,
|
||||
const Standard_Boolean PerformNow)
|
||||
: BRepAlgoAPI_BooleanOperation(Sh, MakeShape(Sf), BOPAlgo_SECTION)
|
||||
{
|
||||
InitParameters();
|
||||
myparameterschanged = Standard_True;
|
||||
@@ -137,8 +130,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
|
||||
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
|
||||
myshapeisnull = Standard_True;
|
||||
}
|
||||
if (PerformNow)
|
||||
if (PerformNow) {
|
||||
Build();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -146,9 +140,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf,
|
||||
const TopoDS_Shape& Sh,
|
||||
const Standard_Boolean PerformNow)
|
||||
: BRepAlgoAPI_BooleanOperation(MakeShape(Sf), Sh, BOP_SECTION)
|
||||
const TopoDS_Shape& Sh,
|
||||
const Standard_Boolean PerformNow)
|
||||
: BRepAlgoAPI_BooleanOperation(MakeShape(Sf), Sh, BOPAlgo_SECTION)
|
||||
{
|
||||
InitParameters();
|
||||
myparameterschanged = Standard_True;
|
||||
@@ -157,8 +151,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf,
|
||||
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
|
||||
myshapeisnull = Standard_True;
|
||||
}
|
||||
if (PerformNow)
|
||||
if (PerformNow) {
|
||||
Build();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -166,9 +161,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf1,
|
||||
const Handle(Geom_Surface)& Sf2,
|
||||
const Standard_Boolean PerformNow)
|
||||
: BRepAlgoAPI_BooleanOperation(MakeShape(Sf1), MakeShape(Sf2), BOP_SECTION)
|
||||
const Handle(Geom_Surface)& Sf2,
|
||||
const Standard_Boolean PerformNow)
|
||||
: BRepAlgoAPI_BooleanOperation(MakeShape(Sf1), MakeShape(Sf2), BOPAlgo_SECTION)
|
||||
{
|
||||
InitParameters();
|
||||
myparameterschanged = Standard_True;
|
||||
@@ -178,8 +173,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf1,
|
||||
myshapeisnull = Standard_True;
|
||||
}
|
||||
|
||||
if (PerformNow)
|
||||
if (PerformNow) {
|
||||
Build();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -193,7 +189,7 @@ void BRepAlgoAPI_Section::Init1(const TopoDS_Shape& S1)
|
||||
myS1 = S1;
|
||||
|
||||
if(!myS2.IsNull()) {
|
||||
myshapeisnull = Standard_False;
|
||||
myshapeisnull = Standard_False;
|
||||
}
|
||||
myparameterschanged = Standard_True;
|
||||
}
|
||||
@@ -239,7 +235,7 @@ void BRepAlgoAPI_Section::Init2(const TopoDS_Shape& S2)
|
||||
myS2 = S2;
|
||||
|
||||
if(!myS1.IsNull()) {
|
||||
myshapeisnull = Standard_False;
|
||||
myshapeisnull = Standard_False;
|
||||
}
|
||||
myparameterschanged = Standard_True;
|
||||
}
|
||||
@@ -324,9 +320,6 @@ void BRepAlgoAPI_Section::Build()
|
||||
}
|
||||
|
||||
if(myparameterschanged) {
|
||||
|
||||
myBuilderCanWork = Standard_False;
|
||||
|
||||
Standard_Boolean bIsNewFiller = PrepareFiller();
|
||||
//
|
||||
if (myErrorStatus!=1) {
|
||||
@@ -336,30 +329,13 @@ void BRepAlgoAPI_Section::Build()
|
||||
}
|
||||
//
|
||||
if (bIsNewFiller) {
|
||||
//Prepare the DS
|
||||
BOPTools_SSIntersectionAttribute aSectionAttribute(myApprox, myComputePCurve1, myComputePCurve2);
|
||||
myDSFiller->Perform(aSectionAttribute);
|
||||
BOPAlgo_SectionAttribute theSecAttr(myApprox, myComputePCurve1, myComputePCurve2);
|
||||
myDSFiller->SetSectionAttribute(theSecAttr);
|
||||
myDSFiller->Perform();
|
||||
}
|
||||
BOP_Section* aSectionAlgo = new BOP_Section();
|
||||
aSectionAlgo->SetShapes(myS1, myS2);
|
||||
|
||||
myHistory = new BOP_SectionHistoryCollector(myS1, myS2);
|
||||
aSectionAlgo->SetHistoryCollector(myHistory);
|
||||
|
||||
aSectionAlgo->DoWithFiller(*myDSFiller);
|
||||
|
||||
myBuilder = aSectionAlgo;
|
||||
|
||||
if(aSectionAlgo->IsDone()) {
|
||||
myErrorStatus=0;
|
||||
myBuilderCanWork=Standard_True;
|
||||
myShape = aSectionAlgo->Result();
|
||||
Done();
|
||||
}
|
||||
else {
|
||||
myErrorStatus = 100 + aSectionAlgo->ErrorStatus();
|
||||
NotDone();
|
||||
}
|
||||
//
|
||||
BRepAlgoAPI_BooleanOperation::Build();
|
||||
//
|
||||
myparameterschanged = Standard_False;
|
||||
}
|
||||
}
|
||||
@@ -379,7 +355,7 @@ Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn1(const TopoDS_Shape& E,
|
||||
return aResult;
|
||||
}
|
||||
TopoDS_Shape F1, F2;
|
||||
aResult = HasAncestorFaces(*myDSFiller, E, F1, F2);
|
||||
aResult = HasAncestorFaces(myDSFiller, E, F1, F2);
|
||||
|
||||
if(F1.IsNull()) {
|
||||
return Standard_False;
|
||||
@@ -403,7 +379,7 @@ Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn2(const TopoDS_Shape& E,T
|
||||
return aResult;
|
||||
}
|
||||
TopoDS_Shape F1, F2;
|
||||
aResult = HasAncestorFaces(*myDSFiller, E, F1, F2);
|
||||
aResult = HasAncestorFaces(myDSFiller, E, F1, F2);
|
||||
|
||||
if(F2.IsNull()) {
|
||||
return Standard_False;
|
||||
@@ -430,7 +406,7 @@ Handle(Geom2d_Curve) BRepAlgoAPI_Section::PCurveOn1(const TopoDS_Shape& E) const
|
||||
aResult = BRep_Tool::CurveOnSurface(anEdge, aFace, f, l);
|
||||
|
||||
if(!aResult->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) {
|
||||
aResult = new Geom2d_TrimmedCurve(aResult, f, l);
|
||||
aResult = new Geom2d_TrimmedCurve(aResult, f, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -455,7 +431,7 @@ Handle(Geom2d_Curve) BRepAlgoAPI_Section::PCurveOn2(const TopoDS_Shape& E) const
|
||||
aResult = BRep_Tool::CurveOnSurface(anEdge, aFace, f, l);
|
||||
|
||||
if(!aResult->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) {
|
||||
aResult = new Geom2d_TrimmedCurve(aResult, f, l);
|
||||
aResult = new Geom2d_TrimmedCurve(aResult, f, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -479,69 +455,59 @@ void BRepAlgoAPI_Section::InitParameters()
|
||||
// static function : HasAncestorFaces
|
||||
// purpose :
|
||||
// ------------------------------------------------------------------------
|
||||
static Standard_Boolean HasAncestorFaces(const BOPTools_DSFiller& theDSFiller,
|
||||
const TopoDS_Shape& E,
|
||||
TopoDS_Shape& F1,
|
||||
TopoDS_Shape& F2) {
|
||||
static Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
|
||||
const TopoDS_Shape& E,
|
||||
TopoDS_Shape& F1,
|
||||
TopoDS_Shape& F2) {
|
||||
|
||||
BOPTools_PaveFiller* aPaveFiller = (BOPTools_PaveFiller*) &theDSFiller.PaveFiller();
|
||||
const BOPTools_CArray1OfSSInterference& aFFs = aPaveFiller->InterfPool()->SSInterferences();
|
||||
const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
|
||||
Standard_Integer aNb = aFFs.Extent();
|
||||
Standard_Integer i = 0;
|
||||
Standard_Integer aNb, i, j, nE, nF1, nF2, aNbCurves;;
|
||||
//
|
||||
const BOPDS_PDS& pDS = theDSFiller->PDS();
|
||||
BOPDS_VectorOfInterfFF& aFFs=pDS->InterfFF();
|
||||
//
|
||||
aNb=aFFs.Extent();
|
||||
|
||||
for (i = 1; i <= aNb; i++) {
|
||||
BOPTools_SSInterference* aFFi = (BOPTools_SSInterference*) &aFFs(i);
|
||||
const BOPTools_SequenceOfCurves& aSeqOfCurve = aFFi->Curves();
|
||||
|
||||
for(Standard_Integer j = 1; j <= aSeqOfCurve.Length(); j++) {
|
||||
const BOPTools_Curve& aCurve = aSeqOfCurve.Value(j);
|
||||
BOPTools_ListIteratorOfListOfPaveBlock anIt(aCurve.NewPaveBlocks());
|
||||
for (i = 0; i < aNb; i++) {
|
||||
BOPDS_InterfFF& aFFi=aFFs(i);
|
||||
aFFi.Indices(nF1, nF2);
|
||||
//
|
||||
//section edges
|
||||
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 BOPTools_PaveBlock& aPB = anIt.Value();
|
||||
Standard_Integer anIndex = aPB.Edge();
|
||||
|
||||
if(anIndex <= 0)
|
||||
continue;
|
||||
|
||||
if(E.IsSame(aDS.Shape(anIndex))) {
|
||||
for(Standard_Integer fIt = 0; fIt < 2; fIt++) {
|
||||
anIndex = (fIt == 0) ? aFFi->Index1() : aFFi->Index2();
|
||||
|
||||
if(anIndex > 0) {
|
||||
if (fIt == 0)
|
||||
F1 = aDS.Shape(anIndex);
|
||||
else
|
||||
F2 = aDS.Shape(anIndex);
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
const Handle(BOPDS_PaveBlock)& aPB = anIt.Value();
|
||||
nE = aPB->Edge();
|
||||
if(nE < 0) continue;
|
||||
//
|
||||
if(E.IsSame(pDS->Shape(nE))) {
|
||||
F1 = pDS->Shape(nF1);
|
||||
F2 = pDS->Shape(nF2);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOPTools_ListIteratorOfListOfPaveBlock anIt(aFFi->PaveBlocks());
|
||||
|
||||
for(; anIt.More(); anIt.Next()) {
|
||||
const BOPTools_PaveBlock& aPB = anIt.Value();
|
||||
Standard_Integer anIndex = aPB.Edge();
|
||||
|
||||
if(anIndex <= 0)
|
||||
continue;
|
||||
|
||||
if(E.IsSame(aDS.Shape(anIndex))) {
|
||||
for(Standard_Integer fIt = 0; fIt < 2; fIt++) {
|
||||
anIndex = (fIt == 0) ? aFFi->Index1() : aFFi->Index2();
|
||||
|
||||
if(anIndex > 0) {
|
||||
if (fIt == 0)
|
||||
F1 = aDS.Shape(anIndex);
|
||||
else
|
||||
F2 = aDS.Shape(anIndex);
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
//existing pave blocks
|
||||
BOPCol_ListOfInteger aLSE;
|
||||
BOPCol_ListIteratorOfListOfInteger aItLSE;
|
||||
//
|
||||
pDS->SharedEdges(nF1, nF2, aLSE, theDSFiller->Allocator());
|
||||
aItLSE.Initialize(aLSE);
|
||||
for (; aItLSE.More(); aItLSE.Next()) {
|
||||
nE = aItLSE.Value();
|
||||
//
|
||||
if(E.IsSame(pDS->Shape(nE))) {
|
||||
F1 = pDS->Shape(nF1);
|
||||
F2 = pDS->Shape(nF2);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user