mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03: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:
@@ -19,17 +19,17 @@
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
-- Modified David CARBONEL
|
||||
-- Add of Sewing class
|
||||
-- Add of Sewing class
|
||||
|
||||
package BRepAlgo
|
||||
|
||||
---Purpose:
|
||||
-- The BRepAlgo package provides a full range of
|
||||
-- services to perform Old Boolean Operations in Open CASCADE.
|
||||
-- Attention:
|
||||
-- The New Boolean Operation has replaced the Old
|
||||
-- Boolean Operations algorithm in the BrepAlgoAPI
|
||||
-- package in Open CASCADE.
|
||||
-- The BRepAlgo package provides a full range of
|
||||
-- services to perform Old Boolean Operations in Open CASCADE.
|
||||
-- Attention:
|
||||
-- The New Boolean Operation has replaced the Old
|
||||
-- Boolean Operations algorithm in the BrepAlgoAPI
|
||||
-- package in Open CASCADE.
|
||||
|
||||
uses
|
||||
BRep,
|
||||
@@ -58,10 +58,7 @@ uses
|
||||
TopOpeBRepBuild,
|
||||
TopOpeBRep,
|
||||
Adaptor3d,
|
||||
StdFail,
|
||||
BOP,
|
||||
BOPTools,
|
||||
BooleanOperations
|
||||
StdFail
|
||||
|
||||
is
|
||||
enumeration CheckStatus is
|
||||
@@ -93,12 +90,10 @@ is
|
||||
---Purpose:
|
||||
class DSAccess;
|
||||
---Purpose:
|
||||
class TopOpe;
|
||||
---Purpose:
|
||||
class EdgeConnector;
|
||||
---Purpose:
|
||||
class NormalProjection;
|
||||
---Purpose:
|
||||
---Purpose:
|
||||
-- class Sewing; now it is in BRepBuilderAPI
|
||||
|
||||
class DataMapOfShapeBoolean instantiates
|
||||
@@ -126,34 +121,34 @@ is
|
||||
--BRepAlgoAPI f
|
||||
|
||||
IsValid(S: Shape from TopoDS)
|
||||
returns Boolean from Standard
|
||||
raises NullObject from Standard;
|
||||
---Purpose: Checks if the shape is "correct". If not, returns
|
||||
-- <Standard_False>, else returns <Standard_True>.
|
||||
|
||||
returns Boolean from Standard
|
||||
raises NullObject from Standard;
|
||||
---Purpose: Checks if the shape is "correct". If not, returns
|
||||
-- <Standard_False>, else returns <Standard_True>.
|
||||
|
||||
IsValid(theArgs : ListOfShape from TopTools;
|
||||
theResult : Shape from TopoDS;
|
||||
closedSolid : Boolean from Standard = Standard_False;
|
||||
GeomCtrl : Boolean from Standard = Standard_True)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Checks if the Generated and Modified Faces from
|
||||
-- the shapes <arguments> in the shape <result> are
|
||||
-- "correct". The args may be empty, then all faces
|
||||
-- will be checked.
|
||||
-- If <Closed> is True, only closed shape are valid.
|
||||
-- If <GeomCtrl> is False the geometry of new
|
||||
-- vertices and edges are not verified and the
|
||||
-- auto-intersection of new wires are not searched.
|
||||
|
||||
|
||||
theResult : Shape from TopoDS;
|
||||
closedSolid : Boolean from Standard = Standard_False;
|
||||
GeomCtrl : Boolean from Standard = Standard_True)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Checks if the Generated and Modified Faces from
|
||||
-- the shapes <arguments> in the shape <result> are
|
||||
-- "correct". The args may be empty, then all faces
|
||||
-- will be checked.
|
||||
-- If <Closed> is True, only closed shape are valid.
|
||||
-- If <GeomCtrl> is False the geometry of new
|
||||
-- vertices and edges are not verified and the
|
||||
-- auto-intersection of new wires are not searched.
|
||||
|
||||
|
||||
IsTopologicallyValid(S: Shape from TopoDS)
|
||||
returns Boolean from Standard
|
||||
raises NullObject from Standard;
|
||||
---Purpose: Checks if the shape is "correct". If not, returns
|
||||
-- <Standard_False>, else returns <Standard_True>.
|
||||
-- This method differs from the previous one in the
|
||||
-- fact that no geometric contols (intersection of
|
||||
-- wires, pcurve validity) are performed.
|
||||
returns Boolean from Standard
|
||||
raises NullObject from Standard;
|
||||
---Purpose: Checks if the shape is "correct". If not, returns
|
||||
-- <Standard_False>, else returns <Standard_True>.
|
||||
-- This method differs from the previous one in the
|
||||
-- fact that no geometric contols (intersection of
|
||||
-- wires, pcurve validity) are performed.
|
||||
|
||||
--BRepAlgoAPI t
|
||||
|
||||
|
@@ -1,158 +0,0 @@
|
||||
-- Created on: 1997-08-13
|
||||
-- Created by: Prestataire Mary FABIEN
|
||||
-- Copyright (c) 1997-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-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 TopOpe from BRepAlgo
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
|
||||
Wire from TopoDS,
|
||||
Shape from TopoDS,
|
||||
ListOfInteger from TColStd,
|
||||
SetOfInteger from TColStd,
|
||||
MapOfInteger from TColStd,
|
||||
ListOfShape from TopTools,
|
||||
State from TopAbs,
|
||||
EdgeConnector from BRepAlgo,
|
||||
DataMapOfShapeShape from TopTools,
|
||||
|
||||
PDSFiller from BOPTools,
|
||||
PBuilder from BOP,
|
||||
HistoryCollector from BOP
|
||||
|
||||
is
|
||||
|
||||
Create returns TopOpe from BRepAlgo;
|
||||
|
||||
Init(me: in out);
|
||||
---Purpose: Clean the internal data structure, including the
|
||||
-- Shapes of Load().
|
||||
|
||||
|
||||
-- Remplissage de la SD
|
||||
|
||||
Load(me : in out; S : Shape from TopoDS);
|
||||
---Purpose: Load the shape in the DS.
|
||||
--
|
||||
|
||||
Load(me : in out; S1, S2 : in out Shape from TopoDS);
|
||||
---Purpose: Load the shapes in the DS without intersecting them.
|
||||
|
||||
Intersect(me : in out);
|
||||
---Purpose: Intersect two shapes at input and load the DS with
|
||||
-- their intersection. Clear TopOpeBRepBuild_HBuilder if
|
||||
-- necessary
|
||||
|
||||
Intersect(me : in out; S1, S2 : Shape from TopoDS);
|
||||
---Purpose: Intersect faces contained in two given shapes
|
||||
-- load the DS with them. Clear TopOpeBRepBuild_HBuilder
|
||||
-- if necessary
|
||||
|
||||
ToCompleteIntersection(me : in out);
|
||||
|
||||
-- Construction of Sections
|
||||
|
||||
-- GetSectionEdgeSet(me : in out; S1,S2 : Shape from TopoDS)
|
||||
-- ---Purpose: return the compounds of Edge connected with section
|
||||
-- that contain the sections between faces contained in
|
||||
-- S1 and S2.
|
||||
-- return an empty list of Shape if S1 or S2 do not
|
||||
-- contain faces.
|
||||
-- call GetSectionEdgeSet() if it is not done already
|
||||
-- ---C++: return const &
|
||||
-- returns ListOfShape from TopTools;
|
||||
|
||||
GetSectionEdgeSet(me : in out)
|
||||
---Purpose: return all compounds of connected edges
|
||||
-- of section contained in the DS
|
||||
---C++: return const &
|
||||
returns ListOfShape from TopTools;
|
||||
|
||||
|
||||
SuppressEdgeSet(me : in out);
|
||||
---Purpose: Invalidate a line of complete section.
|
||||
-- A group of Edges connected by Vertexes. Can be a Wire.
|
||||
-- Can be a group of connected Edges that do not form a
|
||||
-- standard Wire.
|
||||
|
||||
|
||||
-- Reconstruction des Shapes
|
||||
|
||||
Merge(me : in out; state1 : State from TopAbs;
|
||||
state2 : State from TopAbs)
|
||||
---C++: return const &
|
||||
returns Shape from TopoDS;
|
||||
|
||||
Merge(me : in out; state1 : State from TopAbs)
|
||||
---C++: return const &
|
||||
returns Shape from TopoDS;
|
||||
|
||||
PaveBlocksNotEmpty(me : in out)
|
||||
returns Boolean from Standard;
|
||||
|
||||
-- Access to fields
|
||||
|
||||
Builder(me)
|
||||
---C++: return const &
|
||||
returns PBuilder from BOP;
|
||||
|
||||
DSFiller(me)
|
||||
---C++: return const &
|
||||
returns PDSFiller from BOPTools;
|
||||
|
||||
History(me)
|
||||
---C++: return const &
|
||||
returns HistoryCollector from BOP;
|
||||
|
||||
|
||||
Destroy (me: in out);
|
||||
---C++: alias "Standard_EXPORT virtual ~BRepAlgo_TopOpe(){Destroy();}"
|
||||
|
||||
fields
|
||||
|
||||
myDSFiller : PDSFiller from BOPTools;
|
||||
myBuilder : PBuilder from BOP;
|
||||
myHistory : HistoryCollector from BOP;
|
||||
|
||||
myEC : EdgeConnector from BRepAlgo;
|
||||
myS1 : Shape from TopoDS;
|
||||
myS2 : Shape from TopoDS;
|
||||
myState1,myState2 : State from TopAbs;
|
||||
|
||||
myListOfCompoundOfEdgeConnected : ListOfShape from TopTools;
|
||||
myCurrentList : ListOfShape from TopTools;
|
||||
myRecomputeBuilderIsDone : Boolean from Standard;
|
||||
myGetSectionIsDone : Boolean from Standard;
|
||||
myResultShape : Shape from TopoDS;
|
||||
|
||||
myWire : Wire from TopoDS;
|
||||
myListOfVertex : ListOfShape from TopTools;
|
||||
myModified : ListOfShape from TopTools;
|
||||
myEmptyShape : Shape from TopoDS;
|
||||
myEmptyListOfShape : ListOfShape from TopTools;
|
||||
myEmptyListOfInteger : ListOfInteger from TColStd;
|
||||
|
||||
myCompoundWireMap : DataMapOfShapeShape from TopTools;
|
||||
mySetOfKeepPoint : SetOfInteger from TColStd;
|
||||
|
||||
|
||||
end TopOpe from BRepAlgo;
|
@@ -1,492 +0,0 @@
|
||||
// Created on: 2004-03-02
|
||||
// Created by: Igor FEOKTISTOV
|
||||
// Copyright (c) 2004-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 <BRepAlgo_TopOpe.ixx>
|
||||
#include <BRepAlgo_EdgeConnector.hxx>
|
||||
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
|
||||
#include <TColStd_SetIteratorOfSetOfInteger.hxx>
|
||||
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BOP_Builder.hxx>
|
||||
#include <BOPTools_DSFiller.hxx>
|
||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
||||
#include <BOPTools_InterferencePool.hxx>
|
||||
#include <BOP_SolidSolid.hxx>
|
||||
#include <BOP_SolidSolidHistoryCollector.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TColStd_SetOfInteger.hxx>
|
||||
#include <BOP_ShellSolid.hxx>
|
||||
#include <BOP_ShellSolidHistoryCollector.hxx>
|
||||
#include <BOPTools_CArray1OfSSInterference.hxx>
|
||||
#include <BOPTools_SSInterference.hxx>
|
||||
#include <BOPTools_ListOfPaveBlock.hxx>
|
||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
||||
#include <BOPTools_PaveBlock.hxx>
|
||||
#include <BOPTools_SequenceOfCurves.hxx>
|
||||
#include <BOPTools_Curve.hxx>
|
||||
|
||||
#ifdef DRAW
|
||||
//#include <TestTopOpe.hxx>
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : Create
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepAlgo_TopOpe::BRepAlgo_TopOpe() :
|
||||
myDSFiller(NULL), myBuilder(NULL)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAlgo_TopOpe::Init()
|
||||
{
|
||||
if (myBuilder != NULL) {
|
||||
delete myBuilder;
|
||||
}
|
||||
if (myDSFiller != NULL) {
|
||||
delete myDSFiller;
|
||||
}
|
||||
|
||||
myDSFiller = NULL;
|
||||
myBuilder = NULL;
|
||||
|
||||
myDSFiller = new BOPTools_DSFiller;
|
||||
|
||||
|
||||
myRecomputeBuilderIsDone = Standard_False;
|
||||
myGetSectionIsDone = Standard_False;
|
||||
myListOfCompoundOfEdgeConnected.Clear();
|
||||
myEC = new BRepAlgo_EdgeConnector();
|
||||
|
||||
|
||||
myState1 = TopAbs_UNKNOWN;
|
||||
myState2 = TopAbs_UNKNOWN;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Destroy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgo_TopOpe::Destroy()
|
||||
{
|
||||
if (myBuilder!=NULL) {
|
||||
delete myBuilder;
|
||||
myBuilder=NULL;
|
||||
}
|
||||
if (myDSFiller!=NULL) {
|
||||
delete myDSFiller;
|
||||
myDSFiller=NULL;
|
||||
}
|
||||
}
|
||||
// Filling the DS
|
||||
|
||||
//=======================================================================
|
||||
//function : Load
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAlgo_TopOpe::Load(const TopoDS_Shape& )
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Load
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAlgo_TopOpe::Load(TopoDS_Shape& S1,
|
||||
TopoDS_Shape& S2)
|
||||
{
|
||||
|
||||
// if ( S1.Orientation() == TopAbs_REVERSED ) {
|
||||
// S1.Orientation(TopAbs_FORWARD);
|
||||
// }
|
||||
// if ( S2.Orientation() == TopAbs_REVERSED ) {
|
||||
// S2.Orientation(TopAbs_FORWARD);
|
||||
// }
|
||||
|
||||
|
||||
myDSFiller->SetShapes(S1, S2);
|
||||
myS1 = myDSFiller->Shape1();
|
||||
myS2 = myDSFiller->Shape2();
|
||||
|
||||
myDSFiller->InitFillersAndPools();
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intersect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAlgo_TopOpe::Intersect()
|
||||
{
|
||||
// myRecomputeBuilderIsDone = Standard_False;
|
||||
|
||||
if(!myS1.IsNull() && !myS2.IsNull()) {
|
||||
myDSFiller->Perform();
|
||||
}
|
||||
|
||||
myRecomputeBuilderIsDone = Standard_True;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intersect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAlgo_TopOpe::Intersect
|
||||
(const TopoDS_Shape& S1,
|
||||
const TopoDS_Shape& S2)
|
||||
{
|
||||
myRecomputeBuilderIsDone = Standard_False;
|
||||
|
||||
if(S1.IsNull() || S2.IsNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Standard_Boolean orientFORWARD = Standard_False;
|
||||
TopExp_Explorer exp;
|
||||
if(S1.ShapeType() != TopAbs_FACE) {
|
||||
exp.Init(S1, TopAbs_FACE);
|
||||
if(!exp.More())
|
||||
return;
|
||||
}
|
||||
if(S2.ShapeType() != TopAbs_FACE) {
|
||||
exp.Init(S2, TopAbs_FACE);
|
||||
if(!exp.More())
|
||||
return;
|
||||
}
|
||||
|
||||
const BooleanOperations_ShapesDataStructure& aDS = myDSFiller->DS();
|
||||
TColStd_SetOfInteger anObjSubSet, aToolSubSet;
|
||||
|
||||
TopTools_IndexedMapOfShape aMap;
|
||||
TopExp::MapShapes(S1, aMap);
|
||||
|
||||
Standard_Integer i, index, nbs = aMap.Extent();
|
||||
for(i = 1; i <= nbs; ++i) {
|
||||
const TopoDS_Shape& aS = aMap(i);
|
||||
index = aDS.ShapeIndex(aS, 1);
|
||||
if(index > 0) {
|
||||
anObjSubSet.Add(index);
|
||||
}
|
||||
}
|
||||
|
||||
aMap.Clear();
|
||||
TopExp::MapShapes(S2, aMap);
|
||||
nbs = aMap.Extent();
|
||||
for(i = 1; i <= nbs; ++i) {
|
||||
const TopoDS_Shape& aS = aMap(i);
|
||||
index = aDS.ShapeIndex(aS, 2);
|
||||
if(index > 0) {
|
||||
aToolSubSet.Add(index);
|
||||
}
|
||||
}
|
||||
|
||||
myDSFiller->PartialPerform(anObjSubSet, aToolSubSet);
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ToCompleteIntersection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAlgo_TopOpe::ToCompleteIntersection()
|
||||
{
|
||||
if(!myRecomputeBuilderIsDone) {
|
||||
myDSFiller->ToCompletePerform();
|
||||
myRecomputeBuilderIsDone = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
// Construction des Sections
|
||||
|
||||
//=======================================================================
|
||||
//function : GetSectionEdgeSet
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TopTools_ListOfShape& BRepAlgo_TopOpe::GetSectionEdgeSet()
|
||||
{
|
||||
if(!myRecomputeBuilderIsDone) {
|
||||
ToCompleteIntersection();
|
||||
myRecomputeBuilderIsDone = Standard_True;
|
||||
myGetSectionIsDone = Standard_False;
|
||||
}
|
||||
|
||||
if(myGetSectionIsDone)
|
||||
return myListOfCompoundOfEdgeConnected;
|
||||
|
||||
myGetSectionIsDone = Standard_True;
|
||||
|
||||
myListOfCompoundOfEdgeConnected.Clear();
|
||||
|
||||
// EdgeConnector
|
||||
Handle(BRepAlgo_EdgeConnector) EC = myEC;
|
||||
EC->ClearStartElement();
|
||||
TopTools_MapOfShape ME;
|
||||
ME.Clear();
|
||||
|
||||
Standard_Integer i, j, aNbFFs, aNbS, aNbCurves, nSect;
|
||||
|
||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
||||
const BOPTools_InterferencePool& anInterfPool=myDSFiller->InterfPool();
|
||||
BOPTools_InterferencePool* pInterfPool=
|
||||
(BOPTools_InterferencePool*) &anInterfPool;
|
||||
BOPTools_CArray1OfSSInterference& aFFs=
|
||||
pInterfPool->SSInterferences();
|
||||
//
|
||||
aNbFFs=aFFs.Extent();
|
||||
for (i=1; i<=aNbFFs; ++i) {
|
||||
BOPTools_SSInterference& aFFi=aFFs(i);
|
||||
//
|
||||
//
|
||||
// Old Section Edges
|
||||
const BOPTools_ListOfPaveBlock& aSectList=aFFi.PaveBlocks();
|
||||
aNbS=aSectList.Extent();
|
||||
BOPTools_ListIteratorOfListOfPaveBlock anIt(aSectList);
|
||||
for (; anIt.More();anIt.Next()) {
|
||||
const BOPTools_PaveBlock& aPB=anIt.Value();
|
||||
nSect=aPB.Edge();
|
||||
const TopoDS_Shape& aS=aDS.GetShape(nSect);
|
||||
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(aS);
|
||||
|
||||
if(ME.Contains(aE)) continue;
|
||||
|
||||
ME.Add(aE);
|
||||
EC->AddStart(aE);
|
||||
}
|
||||
//
|
||||
// New Section Edges
|
||||
BOPTools_SequenceOfCurves& aBCurves=aFFi.Curves();
|
||||
aNbCurves=aBCurves.Length();
|
||||
for (j=1; j<=aNbCurves; j++) {
|
||||
BOPTools_Curve& aBC=aBCurves(j);
|
||||
const BOPTools_ListOfPaveBlock& aSectEdges=aBC.NewPaveBlocks();
|
||||
aNbS=aSectEdges.Extent();
|
||||
|
||||
BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSectEdges);
|
||||
for (; aPBIt.More(); aPBIt.Next()) {
|
||||
BOPTools_PaveBlock& aPB=aPBIt.Value();
|
||||
nSect=aPB.Edge();
|
||||
const TopoDS_Shape& aS=aDS.GetShape(nSect);
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(aS);
|
||||
|
||||
if(ME.Contains(aE)) continue;
|
||||
|
||||
ME.Add(aE);
|
||||
EC->AddStart(aE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TopTools_ListOfShape& LW = EC->MakeBlock();
|
||||
|
||||
// the wires are transformed into compounds.
|
||||
myCompoundWireMap.Clear();
|
||||
BRep_Builder BB;
|
||||
TopTools_ListIteratorOfListOfShape ILW(LW);
|
||||
TopExp_Explorer Explor;
|
||||
for(;ILW.More();ILW.Next()) {
|
||||
TopoDS_Compound Compound;
|
||||
//POP
|
||||
BB.MakeCompound(Compound);
|
||||
// BB.MakeCompound(TopoDS::Compound(Compound));
|
||||
Explor.Init(ILW.Value(), TopAbs_EDGE);
|
||||
for(;Explor.More(); Explor.Next()) {
|
||||
BB.Add(Compound, Explor.Current());
|
||||
}
|
||||
myListOfCompoundOfEdgeConnected.Append(Compound);
|
||||
myCompoundWireMap.Bind(Compound,ILW.Value());
|
||||
}
|
||||
|
||||
return myListOfCompoundOfEdgeConnected;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SuppressEdgeSet
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAlgo_TopOpe::SuppressEdgeSet()
|
||||
{
|
||||
myGetSectionIsDone = Standard_False;
|
||||
}
|
||||
|
||||
|
||||
// Reconstruction of Shapes
|
||||
|
||||
//=======================================================================
|
||||
//function : Merge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TopoDS_Shape& BRepAlgo_TopOpe::Merge
|
||||
(const TopAbs_State state1,
|
||||
const TopAbs_State state2)
|
||||
{
|
||||
|
||||
if(!myDSFiller->IsDone()) return myEmptyShape;
|
||||
|
||||
if((state1 != TopAbs_IN) &&
|
||||
(state1 != TopAbs_OUT))
|
||||
return myEmptyShape;
|
||||
if((state2 != TopAbs_IN) &&
|
||||
(state2 != TopAbs_OUT))
|
||||
return myEmptyShape;
|
||||
// if GetSectionEdgeSet has already been called, nothing is done
|
||||
// in GetSectionEdgeSet.
|
||||
if(myState1 != TopAbs_UNKNOWN)
|
||||
if(myState1 != state1 || myState2 != state2)
|
||||
myGetSectionIsDone = Standard_False;
|
||||
myState1 = state1;
|
||||
myState2 = state2;
|
||||
|
||||
BOP_Operation anOp = BOP_UNKNOWN;
|
||||
if(myState1 == TopAbs_IN && myState2 == TopAbs_IN) anOp = BOP_COMMON;
|
||||
if(myState1 == TopAbs_OUT && myState2 == TopAbs_IN) anOp = BOP_CUT;
|
||||
if(myState1 == TopAbs_IN && myState2 == TopAbs_OUT) anOp = BOP_CUT21;
|
||||
if(myState1 == TopAbs_OUT && myState2 == TopAbs_OUT) anOp = BOP_FUSE;
|
||||
|
||||
if (myBuilder != NULL) {
|
||||
delete myBuilder;
|
||||
}
|
||||
|
||||
myBuilder = new BOP_SolidSolid;
|
||||
myBuilder->SetShapes(myS1, myS2);
|
||||
myBuilder->SetOperation (anOp);
|
||||
|
||||
myHistory = new BOP_SolidSolidHistoryCollector(myS1, myS2, anOp);
|
||||
myBuilder->SetHistoryCollector(myHistory);
|
||||
|
||||
myBuilder->DoWithFiller (*myDSFiller);
|
||||
|
||||
myResultShape = myBuilder->Result();
|
||||
|
||||
return myResultShape;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Merge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TopoDS_Shape& BRepAlgo_TopOpe::Merge
|
||||
(const TopAbs_State )
|
||||
{
|
||||
|
||||
myResultShape.Nullify();
|
||||
return myResultShape;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PaveBlocksNotEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepAlgo_TopOpe::PaveBlocksNotEmpty()
|
||||
{
|
||||
Standard_Integer i, aNbFFs, aNbS;
|
||||
|
||||
// const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
||||
const BOPTools_InterferencePool& anInterfPool=myDSFiller->InterfPool();
|
||||
BOPTools_InterferencePool* pInterfPool=
|
||||
(BOPTools_InterferencePool*) &anInterfPool;
|
||||
BOPTools_CArray1OfSSInterference& aFFs=
|
||||
pInterfPool->SSInterferences();
|
||||
//
|
||||
|
||||
//
|
||||
aNbFFs=aFFs.Extent();
|
||||
for (i=1; i<=aNbFFs; ++i) {
|
||||
BOPTools_SSInterference& aFFi=aFFs(i);
|
||||
//
|
||||
// Old Section Edges
|
||||
const BOPTools_ListOfPaveBlock& aSectList=aFFi.PaveBlocks();
|
||||
aNbS=aSectList.Extent();
|
||||
|
||||
if (aNbS > 0) {
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Builder
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const BOP_PBuilder& BRepAlgo_TopOpe::Builder() const
|
||||
{
|
||||
return myBuilder;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DSFiller
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const BOPTools_PDSFiller& BRepAlgo_TopOpe::DSFiller() const
|
||||
{
|
||||
return myDSFiller;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : History
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Handle(BOP_HistoryCollector)& BRepAlgo_TopOpe::History() const
|
||||
{
|
||||
return myHistory;
|
||||
}
|
||||
|
Reference in New Issue
Block a user