mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +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:
parent
a8676008f7
commit
4e57c75ee1
@ -92,8 +92,6 @@ t TKG3d
|
|||||||
t TKGeomBase
|
t TKGeomBase
|
||||||
p AppBlend
|
p AppBlend
|
||||||
p ApproxInt
|
p ApproxInt
|
||||||
p BOP
|
|
||||||
p BOPTColStd
|
|
||||||
p BOPTools
|
p BOPTools
|
||||||
p BRepAlgo
|
p BRepAlgo
|
||||||
p BRepAlgoAPI
|
p BRepAlgoAPI
|
||||||
@ -124,7 +122,6 @@ p BiTgte
|
|||||||
p Bisector
|
p Bisector
|
||||||
p Blend
|
p Blend
|
||||||
p BlendFunc
|
p BlendFunc
|
||||||
p BooleanOperations
|
|
||||||
p ChFi2d
|
p ChFi2d
|
||||||
p ChFi3d
|
p ChFi3d
|
||||||
p ChFiDS
|
p ChFiDS
|
||||||
@ -489,3 +486,7 @@ t TKQADraw
|
|||||||
p QADNaming
|
p QADNaming
|
||||||
p QABugs
|
p QABugs
|
||||||
p Font
|
p Font
|
||||||
|
p BOPAlgo
|
||||||
|
p BOPDS
|
||||||
|
p BOPCol
|
||||||
|
p BOPInt
|
||||||
|
329
src/BOP/BOP.cdl
329
src/BOP/BOP.cdl
@ -1,329 +0,0 @@
|
|||||||
-- Created on: 2001-03-29
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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.
|
|
||||||
|
|
||||||
|
|
||||||
package BOP
|
|
||||||
|
|
||||||
---Purpose: Contains main and auxiliary classes to provide boolean operations
|
|
||||||
-- (BO) Common, Cut, Fuse, Section between a couple BRep shapes.
|
|
||||||
|
|
||||||
uses
|
|
||||||
Geom2dInt,
|
|
||||||
TopoDS,
|
|
||||||
TopAbs,
|
|
||||||
TopTools,
|
|
||||||
TopExp,
|
|
||||||
gp,
|
|
||||||
TColgp,
|
|
||||||
ProjLib,
|
|
||||||
Geom2d,
|
|
||||||
Geom,
|
|
||||||
TColStd,
|
|
||||||
TopTools,
|
|
||||||
TCollection,
|
|
||||||
BRepClass,
|
|
||||||
BRep,
|
|
||||||
BRepClass3d,
|
|
||||||
BooleanOperations,
|
|
||||||
IntTools,
|
|
||||||
BOPTools,
|
|
||||||
BOPTColStd
|
|
||||||
|
|
||||||
is
|
|
||||||
---
|
|
||||||
--- E n u m e r a t i o n s
|
|
||||||
---
|
|
||||||
enumeration Operation is
|
|
||||||
COMMON,
|
|
||||||
FUSE,
|
|
||||||
CUT,
|
|
||||||
CUT21,
|
|
||||||
SECTION,
|
|
||||||
UNKNOWN
|
|
||||||
end Operation;
|
|
||||||
|
|
||||||
enumeration LoopEnum is
|
|
||||||
ANYLOOP,
|
|
||||||
BOUNDARY,
|
|
||||||
BLOCK
|
|
||||||
end LoopEnum;
|
|
||||||
|
|
||||||
enumeration CheckStatus is
|
|
||||||
CheckUnknown,
|
|
||||||
BadType,
|
|
||||||
SelfIntersect,
|
|
||||||
TooSmallEdge,
|
|
||||||
NonRecoverableFace,
|
|
||||||
IncompatibilityOfVertex,
|
|
||||||
IncompatibilityOfEdge,
|
|
||||||
IncompatibilityOfFace
|
|
||||||
end CheckStatus;
|
|
||||||
---
|
|
||||||
--- T h e C l a s s e s
|
|
||||||
---
|
|
||||||
|
|
||||||
deferred class Builder;
|
|
||||||
---Purpose:
|
|
||||||
--- Root class for performing a BO
|
|
||||||
---
|
|
||||||
class WireWire;
|
|
||||||
---Purpose:
|
|
||||||
--- Performs BO (Common,Cut,Fuse) for wires(edges)
|
|
||||||
---
|
|
||||||
class WireShell;
|
|
||||||
---Purpose:
|
|
||||||
--- Performs BO (Common,Cut,Fuse) for wire(edge)/shell(face)
|
|
||||||
---
|
|
||||||
class WireSolid;
|
|
||||||
---Purpose:
|
|
||||||
--- Performs BO (Common,Cut,Fuse) for wire(edge)/solid
|
|
||||||
---
|
|
||||||
class WireShape;
|
|
||||||
---Purpose:
|
|
||||||
--- Root class for Wire/... Biulders
|
|
||||||
---
|
|
||||||
|
|
||||||
class SolidSolid;
|
|
||||||
---Purpose:
|
|
||||||
--- Performs BO (Common,Cut,Fuse) for solids
|
|
||||||
---
|
|
||||||
class ShellShell;
|
|
||||||
---Purpose:
|
|
||||||
--- Performs BO (Common,Cut,Fuse) for shell/shell arguments
|
|
||||||
---
|
|
||||||
class ShellSolid;
|
|
||||||
---Purpose:
|
|
||||||
--- Performs BO (Common,Cut,Fuse) for shell/solid arguments
|
|
||||||
---
|
|
||||||
|
|
||||||
class EmptyBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Performs BO (Common,Cut,Fuse) for shapes
|
|
||||||
--- in cases when one of arguments(or both) is(are) empty
|
|
||||||
---
|
|
||||||
deferred class HistoryCollector;
|
|
||||||
|
|
||||||
class SolidSolidHistoryCollector;
|
|
||||||
|
|
||||||
class ShellSolidHistoryCollector;
|
|
||||||
|
|
||||||
class WireSolidHistoryCollector;
|
|
||||||
|
|
||||||
class SectionHistoryCollector;
|
|
||||||
|
|
||||||
class BuilderTools;
|
|
||||||
---Purpose:
|
|
||||||
--- Handy tools to help building a result
|
|
||||||
---
|
|
||||||
class Section;
|
|
||||||
---Purpose:
|
|
||||||
--- Performs the BO (Section)
|
|
||||||
--- for the shapes where it is valid one
|
|
||||||
---
|
|
||||||
class Refiner;
|
|
||||||
---Purpose:
|
|
||||||
--- Refines the result of the BO if necessary
|
|
||||||
---
|
|
||||||
class ShapeSet;
|
|
||||||
---Purpose:
|
|
||||||
--- Root auxiliary class for set of shapes
|
|
||||||
--- to build new faces from wires,new solids from shells
|
|
||||||
---
|
|
||||||
class WireEdgeSet;
|
|
||||||
---Purpose:
|
|
||||||
--- Class for set of edges and wires to build new faces
|
|
||||||
---
|
|
||||||
class ShellFaceSet;
|
|
||||||
---Purpose:
|
|
||||||
--- Class for set of faces and shells to build new solids
|
|
||||||
---
|
|
||||||
class BlockBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Auxiliary class to storage and operate with data of
|
|
||||||
--- connexity blocks inside
|
|
||||||
---
|
|
||||||
class BlockIterator;
|
|
||||||
---Purpose:
|
|
||||||
--- Auxiliary class to iterate data inside the given
|
|
||||||
--- connexity block
|
|
||||||
---
|
|
||||||
class Loop;
|
|
||||||
---Purpose:
|
|
||||||
--- Auxiliary class containing data about an existing shape
|
|
||||||
--- (Shell,Wire)or a set of shapes (Faces,Edges) which are connex.
|
|
||||||
---
|
|
||||||
class LoopSet;
|
|
||||||
---Purpose:
|
|
||||||
--- Auxiliary class to storage and iterate on Loop(s)
|
|
||||||
---
|
|
||||||
|
|
||||||
deferred class LoopClassifier;
|
|
||||||
---Purpose:
|
|
||||||
--- Root class to classify loops in order to build Areas
|
|
||||||
---
|
|
||||||
deferred class CompositeClassifier;
|
|
||||||
---Purpose:
|
|
||||||
--- Cclassify composite Loops, i.e, loops that can be
|
|
||||||
--- either a Shape, or a block of Elements
|
|
||||||
---
|
|
||||||
class WireEdgeClassifier;
|
|
||||||
---Purpose:
|
|
||||||
--- Classify loops that consist of edges and wires
|
|
||||||
---
|
|
||||||
class ShellFaceClassifier;
|
|
||||||
---Purpose:
|
|
||||||
--- Classify loops that consist of faces and shells
|
|
||||||
---
|
|
||||||
class AreaBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Root class to provide building valid areas from
|
|
||||||
--- corresponding shape sets
|
|
||||||
---
|
|
||||||
class Area2dBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Constructs areas for Faces from a WireEdgeSet
|
|
||||||
---
|
|
||||||
class FaceAreaBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- constructs Loops for Faces from a WireEdgeSet
|
|
||||||
---
|
|
||||||
class FaceBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- construct Faces from a WireEdgeSet
|
|
||||||
---
|
|
||||||
class Area3dBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Constructs areas for Faces from a WireEdgeSet
|
|
||||||
---
|
|
||||||
class SolidAreaBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Constructs areas for Solids from a ShellFaceSet
|
|
||||||
---
|
|
||||||
class SolidBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Constructs Solids from a ShellFaceSet
|
|
||||||
---
|
|
||||||
class EdgeInfo;
|
|
||||||
---Purpose:
|
|
||||||
--- Auxiliary class to store data about edges on a face
|
|
||||||
--- that have common vertex
|
|
||||||
---
|
|
||||||
class FaceInfo;
|
|
||||||
---Purpose:
|
|
||||||
--- Auxiliary class to store data about faces on a shell
|
|
||||||
--- that have common edge
|
|
||||||
---
|
|
||||||
class WireSplitter;
|
|
||||||
---Purpose:
|
|
||||||
--- The algorithm to split invalid (multiconnexed)
|
|
||||||
--- wires on a face onto valid ones
|
|
||||||
---
|
|
||||||
class ShellSplitter;
|
|
||||||
---Purpose:
|
|
||||||
--- The algorithm to split invalid (multiconnexed)
|
|
||||||
--- shells on a solid onto valid ones
|
|
||||||
---
|
|
||||||
class ConnexityBlock;
|
|
||||||
---Purpose:
|
|
||||||
--- Auxiliary class to create and store data about a set
|
|
||||||
--- of connex shapes
|
|
||||||
---
|
|
||||||
class WESCorrector;
|
|
||||||
---Purpose:
|
|
||||||
--- The algorithm to change the WES contents
|
|
||||||
--- The NewWES will contain only wires instead of
|
|
||||||
--- wires and edges.
|
|
||||||
---
|
|
||||||
class SFSCorrector;
|
|
||||||
---Purpose:
|
|
||||||
--- The algorithm to change the SFS contents.
|
|
||||||
--- The NewSFS will contain only shells instead of
|
|
||||||
--- shells and faces.
|
|
||||||
---
|
|
||||||
|
|
||||||
class CorrectTolerances;
|
|
||||||
---Purpose:
|
|
||||||
--- Auxiliary class to provide valid values for result's tolerances'
|
|
||||||
---
|
|
||||||
class Draw;
|
|
||||||
---Purpose:
|
|
||||||
--- Auxiliary class to display intermediate results in Draw's windows
|
|
||||||
--- for the debugging purposes
|
|
||||||
---
|
|
||||||
class SDFWESFiller;
|
|
||||||
---Purpose:
|
|
||||||
--- Fills a wire edges set for a couple of faces that are same domain
|
|
||||||
---
|
|
||||||
|
|
||||||
class CheckResult;
|
|
||||||
class ArgumentAnalyzer;
|
|
||||||
---
|
|
||||||
--- P o i n t e r s
|
|
||||||
---
|
|
||||||
pointer PWireEdgeSet to WireEdgeSet from BOP;
|
|
||||||
pointer PShellFaceSet to ShellFaceSet from BOP;
|
|
||||||
pointer PBuilder to Builder from BOP;
|
|
||||||
|
|
||||||
---
|
|
||||||
--- I n s t a n t i a t i o n s
|
|
||||||
---
|
|
||||||
class ListOfConnexityBlock instantiates
|
|
||||||
List from TCollection(ConnexityBlock from BOP);
|
|
||||||
|
|
||||||
class ListOfLoop instantiates
|
|
||||||
List from TCollection(Loop from BOP);
|
|
||||||
|
|
||||||
class ListOfListOfLoop instantiates
|
|
||||||
List from TCollection(ListOfLoop from BOP);
|
|
||||||
|
|
||||||
class ListOfEdgeInfo instantiates
|
|
||||||
List from TCollection(EdgeInfo from BOP);
|
|
||||||
|
|
||||||
class IndexedDataMapOfVertexListEdgeInfo instantiates
|
|
||||||
IndexedDataMap from TCollection(Shape from TopoDS,
|
|
||||||
ListOfEdgeInfo from BOP,
|
|
||||||
ShapeMapHasher from TopTools);
|
|
||||||
class ListOfFaceInfo instantiates
|
|
||||||
List from TCollection(FaceInfo from BOP);
|
|
||||||
|
|
||||||
class IndexedDataMapOfEdgeListFaceInfo instantiates
|
|
||||||
IndexedDataMap from TCollection(Shape from TopoDS,
|
|
||||||
ListOfFaceInfo from BOP,
|
|
||||||
ShapeMapHasher from TopTools);
|
|
||||||
class SeqOfSeqOfShape instantiates
|
|
||||||
Sequence from TCollection(SequenceOfShape from TopTools);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
class SolidClassifier;
|
|
||||||
|
|
||||||
pointer PSoClassif to SolidClassifier from BRepClass3d;
|
|
||||||
|
|
||||||
class IndexedDataMapOfSolidClassifier instantiates
|
|
||||||
IndexedDataMap from TCollection (Shape from TopoDS,
|
|
||||||
PSoClassif from BOP,
|
|
||||||
ShapeMapHasher from TopTools);
|
|
||||||
|
|
||||||
class ListOfCheckResult instantiates
|
|
||||||
List from TCollection(CheckResult from BOP);
|
|
||||||
--
|
|
||||||
|
|
||||||
|
|
||||||
end BOP;
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
|||||||
-- Created on: 1995-12-21
|
|
||||||
-- Created by: Jean Yves LEBEY
|
|
||||||
-- Copyright (c) 1995-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 Area2dBuilder from BOP inherits AreaBuilder from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
|
|
||||||
-- The algorithm is used to construct Faces from a LoopSet,
|
|
||||||
-- where the Loop is the composite topological object of the boundary,
|
|
||||||
-- here it is a wire(s) or block(s) of edges.
|
|
||||||
-- The LoopSet gives an iteration on Loops.
|
|
||||||
-- For each Loop it indicates if it is on the boundary (wire) or if it
|
|
||||||
-- results from an interference (block of edges).
|
|
||||||
-- The result of the algorithm is an iteration on areas.
|
|
||||||
-- An area is described by a set of Loops.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
LoopSet from BOP,
|
|
||||||
LoopClassifier from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
Create returns Area2dBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty Constructor
|
|
||||||
---
|
|
||||||
Create(LS :out LoopSet from BOP;
|
|
||||||
LC :out LoopClassifier from BOP;
|
|
||||||
ForceClass : Boolean from Standard = Standard_False)
|
|
||||||
returns Area2dBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Creates an object to build faces on
|
|
||||||
--- the (wires,blocks of edge) of <LS>,
|
|
||||||
--- using the classifier <LC>.
|
|
||||||
---
|
|
||||||
InitAreaBuilder(me :out;
|
|
||||||
LS :out LoopSet from BOP;
|
|
||||||
LC :out LoopClassifier from BOP;
|
|
||||||
ForceClass : Boolean = Standard_False)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- Initializes the object to find the areas of
|
|
||||||
--- the shapes described by <LS>,
|
|
||||||
--- using the classifier <LC>.
|
|
||||||
---
|
|
||||||
|
|
||||||
end Area2dBuilder;
|
|
@ -1,234 +0,0 @@
|
|||||||
// Created on: 1995-12-21
|
|
||||||
// Created by: Jean Yves LEBEY
|
|
||||||
// Copyright (c) 1995-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.
|
|
||||||
|
|
||||||
//modified by NIZNHY-PKV Tue Apr 3 15:50:23 2001
|
|
||||||
|
|
||||||
#include <BOP_Area2dBuilder.ixx>
|
|
||||||
|
|
||||||
#include <BOP_Loop.hxx>
|
|
||||||
#include <BOP_ListIteratorOfListOfLoop.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_Area2dBuilder::BOP_Area2dBuilder
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_Area2dBuilder::BOP_Area2dBuilder()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_Area2dBuilder::BOP_Area2dBuilder
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_Area2dBuilder::BOP_Area2dBuilder(BOP_LoopSet& LS,
|
|
||||||
BOP_LoopClassifier& LC,
|
|
||||||
const Standard_Boolean ForceClass)
|
|
||||||
{
|
|
||||||
InitAreaBuilder(LS,LC,ForceClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : InitAreaBuilder
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Area2dBuilder::InitAreaBuilder(BOP_LoopSet& LS,
|
|
||||||
BOP_LoopClassifier& LC,
|
|
||||||
const Standard_Boolean ForceClass)
|
|
||||||
{
|
|
||||||
TopAbs_State state;
|
|
||||||
Standard_Boolean Loopinside;
|
|
||||||
Standard_Boolean loopoutside;
|
|
||||||
|
|
||||||
BOP_ListIteratorOfListOfListOfLoop AreaIter;
|
|
||||||
BOP_ListIteratorOfListOfLoop LoopIter;
|
|
||||||
// boundaryloops : list of boundary loops out of the areas.
|
|
||||||
BOP_ListOfLoop boundaryloops;
|
|
||||||
|
|
||||||
myArea.Clear(); // Clear the list of Area to be built
|
|
||||||
|
|
||||||
for (LS.InitLoop(); LS.MoreLoop(); LS.NextLoop()) {
|
|
||||||
|
|
||||||
// process a new loop : L is the new current Loop
|
|
||||||
const Handle(BOP_Loop)& L = LS.Loop();
|
|
||||||
Standard_Boolean boundaryL = L->IsShape();
|
|
||||||
//
|
|
||||||
//const TopoDS_Shape& aSL=L->Shape();
|
|
||||||
//
|
|
||||||
// L = shape et ForceClass : on traite L comme un block
|
|
||||||
// L = shape et !ForceClass : on traite L comme un pur shape
|
|
||||||
// L = !shape : on traite L comme un block
|
|
||||||
Standard_Boolean traitercommeblock = (!boundaryL) || ForceClass;
|
|
||||||
if ( !traitercommeblock ) {
|
|
||||||
// the loop L is a boundary loop :
|
|
||||||
// - try to insert it in an existing area, such as L is inside all
|
|
||||||
// the block loops. Only block loops of the area are compared.
|
|
||||||
// - if L could not be inserted, store it in list of boundary loops.
|
|
||||||
Loopinside = Standard_False;
|
|
||||||
AreaIter.Initialize(myArea);
|
|
||||||
for (; AreaIter.More(); AreaIter.Next()) {
|
|
||||||
BOP_ListOfLoop& aArea = AreaIter.Value();
|
|
||||||
if ( aArea.IsEmpty() ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
state = CompareLoopWithListOfLoop(LC,L,aArea,BOP_BLOCK );
|
|
||||||
if (state == TopAbs_UNKNOWN){
|
|
||||||
Atomize(state,TopAbs_IN);
|
|
||||||
}
|
|
||||||
Loopinside = ( state == TopAbs_IN);
|
|
||||||
if ( Loopinside ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} // end of Area scan
|
|
||||||
|
|
||||||
if ( Loopinside ) {
|
|
||||||
BOP_ListOfLoop& aArea = AreaIter.Value();
|
|
||||||
ADD_Loop_TO_LISTOFLoop(L, aArea);
|
|
||||||
}
|
|
||||||
else if ( ! Loopinside ) {
|
|
||||||
ADD_Loop_TO_LISTOFLoop(L, boundaryloops);
|
|
||||||
}
|
|
||||||
} // end of boundary loop
|
|
||||||
|
|
||||||
else {
|
|
||||||
// the loop L is a block loop
|
|
||||||
// if L is IN theArea :
|
|
||||||
// - stop area scan, insert L in theArea.
|
|
||||||
// - remove from the area all the loops outside L
|
|
||||||
// - make a new area with them, unless they are all boundary
|
|
||||||
// - if they are all boundary put them back in boundaryLoops
|
|
||||||
// else :
|
|
||||||
// - create a new area with L.
|
|
||||||
// - insert boundary loops that are IN the new area
|
|
||||||
// (and remove them from 'boundaryloops')
|
|
||||||
//
|
|
||||||
Standard_Integer aNbAreas, aNbLoops;
|
|
||||||
Loopinside = Standard_False;
|
|
||||||
//
|
|
||||||
aNbAreas=myArea.Extent();
|
|
||||||
if (aNbAreas) {
|
|
||||||
AreaIter.Initialize(myArea);
|
|
||||||
for (; AreaIter.More(); AreaIter.Next()) {
|
|
||||||
BOP_ListOfLoop& aArea = AreaIter.Value();
|
|
||||||
aNbLoops=aArea.Extent();
|
|
||||||
if (!aNbLoops){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
state = CompareLoopWithListOfLoop(LC, L, aArea, BOP_ANYLOOP);
|
|
||||||
//
|
|
||||||
if (state == TopAbs_UNKNOWN){
|
|
||||||
Atomize(state,TopAbs_IN);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
Loopinside = (state==TopAbs_IN);
|
|
||||||
if ( Loopinside ){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} // end of Area scan
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if ( Loopinside) {
|
|
||||||
BOP_ListOfLoop& aArea = AreaIter.Value();
|
|
||||||
Standard_Boolean allShape = Standard_True;
|
|
||||||
BOP_ListOfLoop removedLoops;
|
|
||||||
LoopIter.Initialize(aArea);
|
|
||||||
while (LoopIter.More()) {
|
|
||||||
const Handle(BOP_Loop)& curL = LoopIter.Value();
|
|
||||||
state = LC.Compare(curL, L);
|
|
||||||
if (state == TopAbs_UNKNOWN) {
|
|
||||||
Atomize(state,TopAbs_IN); // not OUT
|
|
||||||
}
|
|
||||||
//
|
|
||||||
loopoutside = ( state == TopAbs_OUT );
|
|
||||||
//
|
|
||||||
if ( loopoutside ) {
|
|
||||||
// remove the loop from the area
|
|
||||||
ADD_Loop_TO_LISTOFLoop(curL, removedLoops);
|
|
||||||
|
|
||||||
allShape = allShape && curL->IsShape();
|
|
||||||
REM_Loop_FROM_LISTOFLoop(LoopIter, aArea);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LoopIter.Next();
|
|
||||||
}
|
|
||||||
}// while (LoopIter.More()) {
|
|
||||||
//
|
|
||||||
// insert the loop in the area
|
|
||||||
ADD_Loop_TO_LISTOFLoop(L, aArea);
|
|
||||||
if ( ! removedLoops.IsEmpty() ) {
|
|
||||||
if ( allShape ) {
|
|
||||||
ADD_LISTOFLoop_TO_LISTOFLoop (removedLoops,boundaryloops);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// make a new area with the removed loops
|
|
||||||
BOP_ListOfLoop thelistofloop;
|
|
||||||
myArea.Append(thelistofloop);
|
|
||||||
ADD_LISTOFLoop_TO_LISTOFLoop(removedLoops, myArea.Last());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // Loopinside == True
|
|
||||||
|
|
||||||
else {
|
|
||||||
Standard_Integer ashapeinside,ablockinside;
|
|
||||||
BOP_ListOfLoop thelistofloop1;
|
|
||||||
myArea.Append(thelistofloop1);
|
|
||||||
BOP_ListOfLoop& newArea0 = myArea.Last();
|
|
||||||
ADD_Loop_TO_LISTOFLoop(L, newArea0);
|
|
||||||
|
|
||||||
LoopIter.Initialize(boundaryloops);
|
|
||||||
while ( LoopIter.More() ) {
|
|
||||||
ashapeinside = ablockinside = Standard_False;
|
|
||||||
const Handle(BOP_Loop)& lb = LoopIter.Value();
|
|
||||||
state = LC.Compare(lb,L);
|
|
||||||
if (state == TopAbs_UNKNOWN){
|
|
||||||
Atomize(state,TopAbs_IN);
|
|
||||||
}
|
|
||||||
ashapeinside = (state == TopAbs_IN);
|
|
||||||
if (ashapeinside) {
|
|
||||||
state = LC.Compare(L,lb);
|
|
||||||
if (state == TopAbs_UNKNOWN){
|
|
||||||
Atomize(state,TopAbs_IN);
|
|
||||||
}
|
|
||||||
ablockinside = (state == TopAbs_IN);
|
|
||||||
}
|
|
||||||
if ( ashapeinside && ablockinside ) {
|
|
||||||
const Handle(BOP_Loop)& curL = LoopIter.Value();
|
|
||||||
ADD_Loop_TO_LISTOFLoop(curL, newArea0);
|
|
||||||
|
|
||||||
REM_Loop_FROM_LISTOFLoop(LoopIter,boundaryloops);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LoopIter.Next();
|
|
||||||
}
|
|
||||||
} // end of boundaryloops scan
|
|
||||||
} // Loopinside == False
|
|
||||||
} // end of block loop
|
|
||||||
} // end of LoopSet LS scan
|
|
||||||
|
|
||||||
if ( ! boundaryloops.IsEmpty() ) {
|
|
||||||
if ( myArea.IsEmpty() ) {
|
|
||||||
BOP_ListOfLoop newArea3;
|
|
||||||
newArea3.Append(boundaryloops);
|
|
||||||
myArea.Append(newArea3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
InitArea();
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
-- Created on: 2001-06-25
|
|
||||||
-- Created by: Michael KLOKOV
|
|
||||||
-- Copyright (c) 2001-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 Area3dBuilder from BOP inherits AreaBuilder from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
|
|
||||||
-- The algorithm is used to construct Solids from a LoopSet,
|
|
||||||
-- where the Loop is the composite topological object of the boundary,
|
|
||||||
-- here it is a Shell(s) or block(s) of Faces.
|
|
||||||
-- The LoopSet gives an iteration on Loops.
|
|
||||||
-- For each Loop it indicates if it is on the boundary (shell) or if it
|
|
||||||
-- results from an interference (block of faces).
|
|
||||||
-- The result of the algorithm is an iteration on areas.
|
|
||||||
-- An area is described by a set of Loops.
|
|
||||||
|
|
||||||
uses
|
|
||||||
LoopSet from BOP,
|
|
||||||
LoopClassifier from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns Area3dBuilder from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty Constructor
|
|
||||||
---
|
|
||||||
Create(LS:out LoopSet from BOP;
|
|
||||||
LC:out LoopClassifier from BOP;
|
|
||||||
ForceClass: Boolean from Standard = Standard_False)
|
|
||||||
returns Area3dBuilder from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Creates an object to build solids on
|
|
||||||
--- the (shells, blocks of faces) of <LS>,
|
|
||||||
--- using the classifier <LC>.
|
|
||||||
---
|
|
||||||
|
|
||||||
InitAreaBuilder(me: in out;
|
|
||||||
LS:out LoopSet from BOP;
|
|
||||||
LC:out LoopClassifier from BOP;
|
|
||||||
ForceClass: Boolean from Standard)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- Initialize the object to find the areas of
|
|
||||||
--- the shapes described by <LS>,
|
|
||||||
--- using the classifier <LC>.
|
|
||||||
---
|
|
||||||
|
|
||||||
end Area3dBuilder from BOP;
|
|
@ -1,194 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
#include <BOP_Area3dBuilder.ixx>
|
|
||||||
|
|
||||||
#include <BOP_Loop.hxx>
|
|
||||||
|
|
||||||
// ==================================================================================
|
|
||||||
// function: BOP_Area3dBuilder::BOP_Area3dBuilder
|
|
||||||
// purpose:
|
|
||||||
// ==================================================================================
|
|
||||||
BOP_Area3dBuilder::BOP_Area3dBuilder()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==================================================================================
|
|
||||||
// function: BOP_Area3dBuilder::BOP_Area3dBuilder
|
|
||||||
// purpose:
|
|
||||||
// ==================================================================================
|
|
||||||
BOP_Area3dBuilder::BOP_Area3dBuilder(BOP_LoopSet& theLS,
|
|
||||||
BOP_LoopClassifier& theLC,
|
|
||||||
const Standard_Boolean theForceClassFlag)
|
|
||||||
{
|
|
||||||
InitAreaBuilder(theLS, theLC, theForceClassFlag);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==================================================================================
|
|
||||||
// function: InitAreaBuilder
|
|
||||||
// purpose:
|
|
||||||
// ==================================================================================
|
|
||||||
void BOP_Area3dBuilder::InitAreaBuilder(BOP_LoopSet& theLS,
|
|
||||||
BOP_LoopClassifier& theLC,
|
|
||||||
const Standard_Boolean theForceClassFlag)
|
|
||||||
{
|
|
||||||
TopAbs_State state;
|
|
||||||
Standard_Boolean Loopinside;
|
|
||||||
Standard_Boolean loopoutside;
|
|
||||||
|
|
||||||
BOP_ListIteratorOfListOfListOfLoop AreaIter;
|
|
||||||
BOP_ListIteratorOfListOfLoop LoopIter;
|
|
||||||
// boundaryloops : list of boundary loops out of the areas.
|
|
||||||
BOP_ListOfLoop boundaryloops;
|
|
||||||
|
|
||||||
myArea.Clear(); // Clear the list of Area to be built
|
|
||||||
|
|
||||||
for (theLS.InitLoop(); theLS.MoreLoop(); theLS.NextLoop()) {
|
|
||||||
|
|
||||||
// process a new loop : L is the new current Loop
|
|
||||||
const Handle(BOP_Loop)& L = theLS.Loop();
|
|
||||||
Standard_Boolean boundaryL = L->IsShape();
|
|
||||||
|
|
||||||
// L = shape et theForceClassFlag : on traite L comme un block
|
|
||||||
// L = shape et !theForceClassFlag : on traite L comme un pur shape
|
|
||||||
// L = !shape : on traite L comme un block
|
|
||||||
Standard_Boolean traitercommeblock = (!boundaryL) || theForceClassFlag;
|
|
||||||
if ( ! traitercommeblock ) {
|
|
||||||
|
|
||||||
// the loop L is a boundary loop :
|
|
||||||
// - try to insert it in an existing area, such as L is inside all
|
|
||||||
// the block loops. Only block loops of the area are compared.
|
|
||||||
// - if L could not be inserted, store it in list of boundary loops.
|
|
||||||
|
|
||||||
Loopinside = Standard_False;
|
|
||||||
for (AreaIter.Initialize(myArea); AreaIter.More(); AreaIter.Next()) {
|
|
||||||
BOP_ListOfLoop& aArea = AreaIter.Value();
|
|
||||||
if ( aArea.IsEmpty() ) continue;
|
|
||||||
state = CompareLoopWithListOfLoop(theLC,L,aArea,BOP_BLOCK );
|
|
||||||
if (state == TopAbs_UNKNOWN) Atomize(state,TopAbs_IN);
|
|
||||||
Loopinside = ( state == TopAbs_IN);
|
|
||||||
if ( Loopinside ) break;
|
|
||||||
} // end of Area scan
|
|
||||||
|
|
||||||
if ( Loopinside ) {
|
|
||||||
BOP_ListOfLoop& aArea = AreaIter.Value();
|
|
||||||
ADD_Loop_TO_LISTOFLoop(L,aArea);
|
|
||||||
}
|
|
||||||
else if ( ! Loopinside ) {
|
|
||||||
ADD_Loop_TO_LISTOFLoop(L, boundaryloops);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end of boundary loop
|
|
||||||
|
|
||||||
else {
|
|
||||||
// the loop L is a block loop
|
|
||||||
// if L is IN theArea :
|
|
||||||
// - stop area scan, insert L in theArea.
|
|
||||||
// - remove from the area all the loops outside L
|
|
||||||
// - make a new area with them, unless they are all boundary
|
|
||||||
// - if they are all boundary put them back in boundaryLoops
|
|
||||||
// else :
|
|
||||||
// - create a new area with L.
|
|
||||||
// - insert boundary loops that are IN the new area
|
|
||||||
// (and remove them from 'boundaryloops')
|
|
||||||
|
|
||||||
Loopinside = Standard_False;
|
|
||||||
for (AreaIter.Initialize(myArea); AreaIter.More(); AreaIter.Next() ) {
|
|
||||||
BOP_ListOfLoop& aArea = AreaIter.Value();
|
|
||||||
if ( aArea.IsEmpty() ) continue;
|
|
||||||
state = CompareLoopWithListOfLoop(theLC,L,aArea,BOP_ANYLOOP);
|
|
||||||
if (state == TopAbs_UNKNOWN) Atomize(state,TopAbs_IN);
|
|
||||||
Loopinside = (state == TopAbs_IN);
|
|
||||||
if ( Loopinside ) break;
|
|
||||||
} // end of Area scan
|
|
||||||
|
|
||||||
if ( Loopinside) {
|
|
||||||
BOP_ListOfLoop& aArea = AreaIter.Value();
|
|
||||||
Standard_Boolean allShape = Standard_True;
|
|
||||||
BOP_ListOfLoop removedLoops;
|
|
||||||
LoopIter.Initialize(aArea);
|
|
||||||
while (LoopIter.More()) {
|
|
||||||
const Handle(BOP_Loop)& LLI1 = LoopIter.Value();
|
|
||||||
state = theLC.Compare(LLI1,L);
|
|
||||||
if (state == TopAbs_UNKNOWN) Atomize(state,TopAbs_IN); // not OUT
|
|
||||||
loopoutside = ( state == TopAbs_OUT );
|
|
||||||
if ( loopoutside ) {
|
|
||||||
const Handle(BOP_Loop)& curL = LoopIter.Value();
|
|
||||||
// remove the loop from the area
|
|
||||||
ADD_Loop_TO_LISTOFLoop
|
|
||||||
(curL,removedLoops);
|
|
||||||
|
|
||||||
allShape = allShape && curL->IsShape();
|
|
||||||
REM_Loop_FROM_LISTOFLoop
|
|
||||||
(LoopIter, AreaIter.Value());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LoopIter.Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// insert the loop in the area
|
|
||||||
ADD_Loop_TO_LISTOFLoop(L,aArea);
|
|
||||||
if ( ! removedLoops.IsEmpty() ) {
|
|
||||||
if ( allShape ) {
|
|
||||||
ADD_LISTOFLoop_TO_LISTOFLoop(removedLoops, boundaryloops);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// make a new area with the removed loops
|
|
||||||
BOP_ListOfLoop thelistofloop;
|
|
||||||
myArea.Append(thelistofloop);
|
|
||||||
ADD_LISTOFLoop_TO_LISTOFLoop(removedLoops, myArea.Last());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // Loopinside == True
|
|
||||||
|
|
||||||
else {
|
|
||||||
Standard_Integer ashapeinside,ablockinside;
|
|
||||||
BOP_ListOfLoop thelistofloop1;
|
|
||||||
myArea.Append(thelistofloop1);
|
|
||||||
BOP_ListOfLoop& newArea0 = myArea.Last();
|
|
||||||
ADD_Loop_TO_LISTOFLoop(L, newArea0);
|
|
||||||
|
|
||||||
LoopIter.Initialize(boundaryloops);
|
|
||||||
while ( LoopIter.More() ) {
|
|
||||||
ashapeinside = ablockinside = Standard_False;
|
|
||||||
const Handle(BOP_Loop)& LLI2 = LoopIter.Value();
|
|
||||||
state = theLC.Compare(LLI2,L);
|
|
||||||
if (state == TopAbs_UNKNOWN) Atomize(state,TopAbs_IN);
|
|
||||||
ashapeinside = (state == TopAbs_IN);
|
|
||||||
if (ashapeinside) {
|
|
||||||
const Handle(BOP_Loop)& LLI3 = LoopIter.Value();
|
|
||||||
state = theLC.Compare(L,LLI3);
|
|
||||||
if (state == TopAbs_UNKNOWN) Atomize(state,TopAbs_IN);
|
|
||||||
ablockinside = (state == TopAbs_IN);
|
|
||||||
}
|
|
||||||
if ( ashapeinside && ablockinside ) {
|
|
||||||
const Handle(BOP_Loop)& curL = LoopIter.Value();
|
|
||||||
ADD_Loop_TO_LISTOFLoop(curL, newArea0);
|
|
||||||
|
|
||||||
REM_Loop_FROM_LISTOFLoop(LoopIter, boundaryloops);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LoopIter.Next();
|
|
||||||
}
|
|
||||||
} // end of boundaryloops scan
|
|
||||||
} // Loopinside == False
|
|
||||||
} // end of block loop
|
|
||||||
} // end of LoopSet theLS scan
|
|
||||||
|
|
||||||
InitArea();
|
|
||||||
}
|
|
||||||
|
|
@ -1,181 +0,0 @@
|
|||||||
-- Created on: 1995-12-21
|
|
||||||
-- Created by: Jean Yves LEBEY
|
|
||||||
-- Copyright (c) 1995-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 AreaBuilder from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
|
|
||||||
-- The Root class for the algorithms that are used to
|
|
||||||
|
|
||||||
-- Reconstruct complex topological
|
|
||||||
-- objects as Faces or Solids.
|
|
||||||
-- Loop is the composite topological object of
|
|
||||||
-- the boundary. Wire for a Face. Shell for a Solid.
|
|
||||||
-- LoopSet is a tool describing the object to
|
|
||||||
-- build. It gives an iteration on Loops. For each
|
|
||||||
-- Loop it tells if it is on the boundary or if it is
|
|
||||||
-- an interference.
|
|
||||||
-- LoopClassifier is an algorithm used to test
|
|
||||||
-- if a Loop is inside another Loop.
|
|
||||||
-- The result of the reconstruction is an iteration
|
|
||||||
-- on the reconstructed areas. An area is described
|
|
||||||
-- by a set of Loops.
|
|
||||||
-- A AreaBuilder is built with :
|
|
||||||
-- - a LoopSet describing the object to reconstruct.
|
|
||||||
-- - a LoopClassifier providing the classification algorithm.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
State from TopAbs,
|
|
||||||
|
|
||||||
Loop from BOP,
|
|
||||||
ListOfLoop from BOP,
|
|
||||||
ListIteratorOfListOfLoop from BOP,
|
|
||||||
ListOfListOfLoop from BOP,
|
|
||||||
LoopSet from BOP,
|
|
||||||
LoopClassifier from BOP,
|
|
||||||
LoopEnum from BOP,
|
|
||||||
ListIteratorOfListOfListOfLoop from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns AreaBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty Constructor
|
|
||||||
---
|
|
||||||
Create(LS :out LoopSet from BOP;
|
|
||||||
LC :out LoopClassifier from BOP;
|
|
||||||
ForceClass : Boolean = Standard_False)
|
|
||||||
returns AreaBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Creates the objectr to build the areas on
|
|
||||||
--- the shapes described by <LS> using the classifier <LC>.
|
|
||||||
---
|
|
||||||
Delete(me:out) is virtual;
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_AreaBuilder(){Delete() ; }"
|
|
||||||
---Purpose:
|
|
||||||
--- Destructor
|
|
||||||
---
|
|
||||||
InitAreaBuilder(me :out;
|
|
||||||
LS :out LoopSet from BOP;
|
|
||||||
LC :out LoopClassifier;
|
|
||||||
ForceClass : Boolean from Standard = Standard_False)
|
|
||||||
is virtual;
|
|
||||||
---Purpose:
|
|
||||||
--- Sets a AreaBuilder to find the areas on
|
|
||||||
--- the shapes described by <LS> using the classifier <LC>.
|
|
||||||
---
|
|
||||||
CompareLoopWithListOfLoop(me;
|
|
||||||
LC : out LoopClassifier from BOP;
|
|
||||||
L : Loop from BOP;
|
|
||||||
LOL : ListOfLoop from BOP;
|
|
||||||
aWhat : LoopEnum from BOP)
|
|
||||||
returns State from TopAbs
|
|
||||||
is static protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Compare position of the Loop <L> with the Area <LOL>
|
|
||||||
--- using the Loop Classifier <LC>.
|
|
||||||
--- According to <aWhat>, Loops of <LOL> are selected or not
|
|
||||||
--- during <LOL> exploration.
|
|
||||||
---
|
|
||||||
-- Result : TopAbs_OUT if <LOL> is empty
|
|
||||||
--- TopAbs_UNKNOWN if position undefined
|
|
||||||
--- TopAbs_IN if <L> is inside all the selected Loops of <LOL>
|
|
||||||
--- TopAbs_OUT if <L> is outside one of the selected Loops of <LOL>
|
|
||||||
--- TopAbs_ON if <L> is on one of the selected Loops of <LOL>
|
|
||||||
---
|
|
||||||
---
|
|
||||||
|
|
||||||
--- Iteration on Areas
|
|
||||||
--
|
|
||||||
InitArea(me:out)
|
|
||||||
returns Integer from Standard is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Initialize iteration on areas.
|
|
||||||
---
|
|
||||||
MoreArea(me)
|
|
||||||
returns Boolean from Standard is static;
|
|
||||||
|
|
||||||
NextArea(me:out)
|
|
||||||
is static;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Iteration on Loops inside the Area
|
|
||||||
--
|
|
||||||
InitLoop(me:out)
|
|
||||||
returns Integer from Standard is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Initialize iteration on loops of current Area.
|
|
||||||
---
|
|
||||||
MoreLoop(me)
|
|
||||||
returns Boolean from Standard is static;
|
|
||||||
|
|
||||||
NextLoop(me:out)
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Loop(me)
|
|
||||||
returns Loop from BOP is static;
|
|
||||||
---C++: return const&
|
|
||||||
---Purpose:
|
|
||||||
--- Returns the current Loop in the current area.
|
|
||||||
---
|
|
||||||
---
|
|
||||||
---
|
|
||||||
--- Methods that are not for public usage
|
|
||||||
---
|
|
||||||
ADD_Loop_TO_LISTOFLoop (me;
|
|
||||||
L : Loop from BOP;
|
|
||||||
LOL: out ListOfLoop from BOP)
|
|
||||||
is virtual;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal
|
|
||||||
---
|
|
||||||
REM_Loop_FROM_LISTOFLoop(me;
|
|
||||||
ITLOL: out ListIteratorOfListOfLoop from BOP;
|
|
||||||
LOL : out ListOfLoop from BOP)
|
|
||||||
is virtual;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal
|
|
||||||
---
|
|
||||||
ADD_LISTOFLoop_TO_LISTOFLoop(me;
|
|
||||||
LOL1 : out ListOfLoop from BOP;
|
|
||||||
LOL2 : out ListOfLoop from BOP)
|
|
||||||
is virtual;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal
|
|
||||||
---
|
|
||||||
Atomize(me;
|
|
||||||
state : in out State from TopAbs;
|
|
||||||
newstate : State from TopAbs)
|
|
||||||
is static protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal
|
|
||||||
---
|
|
||||||
fields
|
|
||||||
|
|
||||||
myArea : ListOfListOfLoop from BOP is protected;
|
|
||||||
myAreaIterator : ListIteratorOfListOfListOfLoop from BOP is protected;
|
|
||||||
myLoopIterator : ListIteratorOfListOfLoop from BOP is protected;
|
|
||||||
myUNKNOWNRaise : Boolean from Standard is protected;
|
|
||||||
|
|
||||||
end AreaBuilder;
|
|
||||||
|
|
@ -1,408 +0,0 @@
|
|||||||
// Created on: 1995-12-21
|
|
||||||
// Created by: Jean Yves LEBEY
|
|
||||||
// Copyright (c) 1995-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.
|
|
||||||
|
|
||||||
|
|
||||||
// " Voyager, c'est bien utile, ca fait travailler l'imagination.
|
|
||||||
// Tout le reste n'est que deceptions et fatigues. Notre voyage
|
|
||||||
// a nous est entierement imaginaire. Voila sa force. "
|
|
||||||
// Celine
|
|
||||||
// Voyage au bout de la nuit
|
|
||||||
|
|
||||||
#include <BOP_AreaBuilder.ixx>
|
|
||||||
|
|
||||||
#include <Standard_DomainError.hxx>
|
|
||||||
#include <TopAbs.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_AreaBuilder::BOP_AreaBuilder
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_AreaBuilder::BOP_AreaBuilder()
|
|
||||||
:
|
|
||||||
myUNKNOWNRaise(Standard_False)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : TopOpeBRepBuild_AreaBuilder
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_AreaBuilder::BOP_AreaBuilder (BOP_LoopSet& LS,
|
|
||||||
BOP_LoopClassifier& LC,
|
|
||||||
const Standard_Boolean ForceClass)
|
|
||||||
:
|
|
||||||
myUNKNOWNRaise(Standard_False)
|
|
||||||
{
|
|
||||||
InitAreaBuilder(LS, LC, ForceClass);
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Delete
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_AreaBuilder::Delete()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : CompareLoopWithListOfLoop
|
|
||||||
//purpose : Compare position of the Loop <L> with the Area <LOL>
|
|
||||||
// using the Loop Classifier <LC>.
|
|
||||||
// According to <whattotest>, Loops of <LOL> are selected or not
|
|
||||||
// during <LOL> exploration.
|
|
||||||
//result : TopAbs_OUT if <LOL> is empty
|
|
||||||
// TopAbs_UNKNOWN if position undefined
|
|
||||||
// TopAbs_IN if <L> is inside all the selected Loops of <LOL>
|
|
||||||
// TopAbs_OUT if <L> is outside one of the selected Loops of <LOL>
|
|
||||||
// TopAbs_ON if <L> is on one of the selected Loops of <LOL>
|
|
||||||
//=======================================================================
|
|
||||||
TopAbs_State BOP_AreaBuilder::CompareLoopWithListOfLoop (BOP_LoopClassifier &LC,
|
|
||||||
const Handle(BOP_Loop)& L,
|
|
||||||
const BOP_ListOfLoop &LOL,
|
|
||||||
const BOP_LoopEnum what) const
|
|
||||||
{
|
|
||||||
TopAbs_State state = TopAbs_UNKNOWN;
|
|
||||||
Standard_Boolean totest; // L must or not be tested
|
|
||||||
BOP_ListIteratorOfListOfLoop LoopIter;
|
|
||||||
|
|
||||||
if ( LOL.IsEmpty() ) {
|
|
||||||
return TopAbs_OUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoopIter.Initialize(LOL);
|
|
||||||
for (; LoopIter.More(); LoopIter.Next() ) {
|
|
||||||
const Handle(BOP_Loop)& curL = LoopIter.Value();
|
|
||||||
switch ( what ) {
|
|
||||||
case BOP_ANYLOOP :
|
|
||||||
totest = Standard_True;
|
|
||||||
break;
|
|
||||||
case BOP_BOUNDARY :
|
|
||||||
totest = curL->IsShape();
|
|
||||||
break;
|
|
||||||
case BOP_BLOCK :
|
|
||||||
totest = !curL->IsShape();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
totest = Standard_False;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ( totest ) {
|
|
||||||
state = LC.Compare(L,curL);
|
|
||||||
if (state == TopAbs_OUT)
|
|
||||||
// <L> is out of at least one Loop
|
|
||||||
//of <LOL> : stop to explore
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Atomize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_AreaBuilder::Atomize(TopAbs_State& state,
|
|
||||||
const TopAbs_State newstate) const
|
|
||||||
{
|
|
||||||
if (myUNKNOWNRaise) {
|
|
||||||
Standard_DomainError_Raise_if((state == TopAbs_UNKNOWN),
|
|
||||||
"AreaBuilder : Position Unknown");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
state = newstate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : InitAreaBuilder
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_AreaBuilder::InitAreaBuilder(BOP_LoopSet& LS,
|
|
||||||
BOP_LoopClassifier& LC,
|
|
||||||
const Standard_Boolean ForceClass)
|
|
||||||
{
|
|
||||||
TopAbs_State state;
|
|
||||||
Standard_Boolean Loopinside;
|
|
||||||
Standard_Boolean loopoutside;
|
|
||||||
|
|
||||||
BOP_ListIteratorOfListOfListOfLoop AreaIter;
|
|
||||||
BOP_ListIteratorOfListOfLoop LoopIter;
|
|
||||||
// boundaryloops : list of boundary loops out of the areas.
|
|
||||||
BOP_ListOfLoop boundaryloops;
|
|
||||||
|
|
||||||
myArea.Clear(); // Clear the list of Area to be built
|
|
||||||
|
|
||||||
for (LS.InitLoop(); LS.MoreLoop(); LS.NextLoop()) {
|
|
||||||
|
|
||||||
// process a new loop : L is the new current Loop
|
|
||||||
const Handle(BOP_Loop)& L = LS.Loop();
|
|
||||||
Standard_Boolean boundaryL = L->IsShape();
|
|
||||||
|
|
||||||
// L = Shape et ForceClass : on traite L comme un block
|
|
||||||
// L = Shape et !ForceClass : on traite L comme un pur Shape
|
|
||||||
// L = !Shape : on traite L comme un block
|
|
||||||
Standard_Boolean traitercommeblock = (!boundaryL) || ForceClass;
|
|
||||||
if ( ! traitercommeblock ) {
|
|
||||||
|
|
||||||
// the loop L is a boundary loop :
|
|
||||||
// - try to insert it in an existing area, such as L is inside all
|
|
||||||
// the block loops. Only block loops of the area are compared.
|
|
||||||
// - if L could not be inserted, store it in list of boundary loops.
|
|
||||||
|
|
||||||
Loopinside = Standard_False;
|
|
||||||
for (AreaIter.Initialize(myArea); AreaIter.More(); AreaIter.Next()) {
|
|
||||||
BOP_ListOfLoop& aArea = AreaIter.Value();
|
|
||||||
if ( aArea.IsEmpty() ) continue;
|
|
||||||
state = CompareLoopWithListOfLoop(LC,L,aArea,BOP_BLOCK );
|
|
||||||
if (state == TopAbs_UNKNOWN) {
|
|
||||||
Atomize(state,TopAbs_IN);
|
|
||||||
}
|
|
||||||
Loopinside = ( state == TopAbs_IN);
|
|
||||||
if ( Loopinside ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} // end of Area scan
|
|
||||||
|
|
||||||
if ( Loopinside ) {
|
|
||||||
BOP_ListOfLoop& aArea = AreaIter.Value();
|
|
||||||
ADD_Loop_TO_LISTOFLoop(L,aArea);
|
|
||||||
}
|
|
||||||
else if ( ! Loopinside ) {
|
|
||||||
ADD_Loop_TO_LISTOFLoop(L,boundaryloops);
|
|
||||||
}
|
|
||||||
} // end of boundary loop
|
|
||||||
|
|
||||||
else {
|
|
||||||
// the loop L is a block loop
|
|
||||||
// if L is IN theArea :
|
|
||||||
// - stop area scan, insert L in theArea.
|
|
||||||
// - remove from the area all the loops outside L
|
|
||||||
// - make a new area with them, unless they are all boundary
|
|
||||||
// - if they are all boundary put them back in boundaryLoops
|
|
||||||
// else :
|
|
||||||
// - create a new area with L.
|
|
||||||
// - insert boundary loops that are IN the new area
|
|
||||||
// (and remove them from 'boundaryloops')
|
|
||||||
|
|
||||||
Loopinside = Standard_False;
|
|
||||||
|
|
||||||
for (AreaIter.Initialize(myArea); AreaIter.More(); AreaIter.Next() ) {
|
|
||||||
BOP_ListOfLoop& aArea = AreaIter.Value();
|
|
||||||
if ( aArea.IsEmpty() ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
state = CompareLoopWithListOfLoop(LC,L,aArea,BOP_ANYLOOP);
|
|
||||||
if (state == TopAbs_UNKNOWN) Atomize(state,TopAbs_IN);
|
|
||||||
Loopinside = (state == TopAbs_IN);
|
|
||||||
if ( Loopinside ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} // end of Area scan
|
|
||||||
|
|
||||||
if ( Loopinside) {
|
|
||||||
BOP_ListOfLoop& aArea = AreaIter.Value();
|
|
||||||
Standard_Boolean allShape = Standard_True;
|
|
||||||
BOP_ListOfLoop removedLoops;
|
|
||||||
|
|
||||||
LoopIter.Initialize(aArea);
|
|
||||||
while (LoopIter.More()) {
|
|
||||||
state = LC.Compare(LoopIter.Value(),L);
|
|
||||||
if (state == TopAbs_UNKNOWN){
|
|
||||||
Atomize(state,TopAbs_IN); // not OUT
|
|
||||||
}
|
|
||||||
|
|
||||||
loopoutside = ( state == TopAbs_OUT );
|
|
||||||
|
|
||||||
if ( loopoutside ) {
|
|
||||||
const Handle(BOP_Loop)& curL = LoopIter.Value();
|
|
||||||
// remove the loop from the area
|
|
||||||
ADD_Loop_TO_LISTOFLoop (curL,removedLoops);
|
|
||||||
|
|
||||||
allShape = allShape && curL->IsShape();
|
|
||||||
REM_Loop_FROM_LISTOFLoop(LoopIter,AreaIter.Value());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LoopIter.Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// insert the loop in the area
|
|
||||||
ADD_Loop_TO_LISTOFLoop(L,aArea);
|
|
||||||
if ( ! removedLoops.IsEmpty() ) {
|
|
||||||
if ( allShape ) {
|
|
||||||
ADD_LISTOFLoop_TO_LISTOFLoop(removedLoops,boundaryloops);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// make a new area with the removed loops
|
|
||||||
BOP_ListOfLoop thelistofloop;
|
|
||||||
myArea.Append(thelistofloop);
|
|
||||||
ADD_LISTOFLoop_TO_LISTOFLoop (removedLoops,myArea.Last());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // Loopinside == True
|
|
||||||
|
|
||||||
else {
|
|
||||||
Standard_Integer ashapeinside,ablockinside;
|
|
||||||
BOP_ListOfLoop thelistofloop1;
|
|
||||||
myArea.Append(thelistofloop1);
|
|
||||||
BOP_ListOfLoop& newArea0 = myArea.Last();
|
|
||||||
ADD_Loop_TO_LISTOFLoop(L, newArea0);
|
|
||||||
|
|
||||||
LoopIter.Initialize(boundaryloops);
|
|
||||||
while ( LoopIter.More() ) {
|
|
||||||
ashapeinside = ablockinside = Standard_False;
|
|
||||||
state = LC.Compare(LoopIter.Value(),L);
|
|
||||||
if (state == TopAbs_UNKNOWN) {
|
|
||||||
Atomize(state,TopAbs_IN);
|
|
||||||
}
|
|
||||||
|
|
||||||
ashapeinside = (state == TopAbs_IN);
|
|
||||||
if (ashapeinside) {
|
|
||||||
state = LC.Compare(L,LoopIter.Value());
|
|
||||||
if (state == TopAbs_UNKNOWN){
|
|
||||||
Atomize(state,TopAbs_IN);
|
|
||||||
}
|
|
||||||
ablockinside = (state == TopAbs_IN);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ashapeinside && ablockinside ) {
|
|
||||||
const Handle(BOP_Loop)& curL = LoopIter.Value();
|
|
||||||
ADD_Loop_TO_LISTOFLoop(curL, newArea0);
|
|
||||||
|
|
||||||
REM_Loop_FROM_LISTOFLoop(LoopIter,boundaryloops);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LoopIter.Next();
|
|
||||||
}
|
|
||||||
} // end of boundaryloops scan
|
|
||||||
} // Loopinside == False
|
|
||||||
} // end of block loop
|
|
||||||
} // end of LoopSet LS scan
|
|
||||||
|
|
||||||
InitArea();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : InitArea
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_AreaBuilder::InitArea()
|
|
||||||
{
|
|
||||||
myAreaIterator.Initialize(myArea);
|
|
||||||
InitLoop();
|
|
||||||
Standard_Integer n = myArea.Extent();
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : MoreArea
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_AreaBuilder::MoreArea() const
|
|
||||||
{
|
|
||||||
Standard_Boolean b = myAreaIterator.More();
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//Function : NextArea
|
|
||||||
//Purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_AreaBuilder::NextArea()
|
|
||||||
{
|
|
||||||
myAreaIterator.Next();
|
|
||||||
InitLoop();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : InitLoop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_AreaBuilder::InitLoop()
|
|
||||||
{
|
|
||||||
Standard_Integer n = 0;
|
|
||||||
if (myAreaIterator.More()) {
|
|
||||||
const BOP_ListOfLoop& LAL = myAreaIterator.Value();
|
|
||||||
myLoopIterator.Initialize(LAL);
|
|
||||||
n = LAL.Extent();
|
|
||||||
}
|
|
||||||
else { // Create an empty ListIteratorOfListOfLoop
|
|
||||||
myLoopIterator = BOP_ListIteratorOfListOfLoop();
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : MoreLoop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_AreaBuilder::MoreLoop() const
|
|
||||||
{
|
|
||||||
Standard_Boolean b = myLoopIterator.More();
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NextLoop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_AreaBuilder::NextLoop()
|
|
||||||
{
|
|
||||||
myLoopIterator.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Loop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const Handle(BOP_Loop)& BOP_AreaBuilder::Loop() const
|
|
||||||
{
|
|
||||||
const Handle(BOP_Loop)& L = myLoopIterator.Value();
|
|
||||||
return L;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ADD_Loop_TO_LISTOFLoop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_AreaBuilder::ADD_Loop_TO_LISTOFLoop(const Handle(BOP_Loop)& L,
|
|
||||||
BOP_ListOfLoop& LOL) const
|
|
||||||
{
|
|
||||||
LOL.Append(L);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : REM_Loop_FROM_LISTOFLoop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_AreaBuilder::REM_Loop_FROM_LISTOFLoop(BOP_ListIteratorOfListOfLoop& ITA,
|
|
||||||
BOP_ListOfLoop& A) const
|
|
||||||
{
|
|
||||||
A.Remove(ITA);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ADD_LISTOFLoop_TO_LISTOFLoop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_AreaBuilder::ADD_LISTOFLoop_TO_LISTOFLoop(BOP_ListOfLoop& A1,
|
|
||||||
BOP_ListOfLoop& A2) const
|
|
||||||
|
|
||||||
{
|
|
||||||
A2.Append(A1);
|
|
||||||
}
|
|
@ -1,184 +0,0 @@
|
|||||||
-- Created on: 2004-09-03
|
|
||||||
-- Created by: Oleg FEDYAEV
|
|
||||||
-- 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.
|
|
||||||
|
|
||||||
|
|
||||||
class ArgumentAnalyzer from BOP
|
|
||||||
---Purpose: check the validity of argument(s) for Boolean Operations
|
|
||||||
|
|
||||||
uses
|
|
||||||
Shape from TopoDS,
|
|
||||||
Operation from BOP,
|
|
||||||
CheckStatus from BOP,
|
|
||||||
Operation from BOP,
|
|
||||||
ShapeEnum from TopAbs,
|
|
||||||
ListOfCheckResult from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns ArgumentAnalyzer;
|
|
||||||
---Purpose: empty constructor
|
|
||||||
|
|
||||||
SetShape1(me: in out; TheShape: Shape from TopoDS);
|
|
||||||
---Purpose: sets object shape
|
|
||||||
|
|
||||||
SetShape2(me: in out; TheShape: Shape from TopoDS);
|
|
||||||
---Purpose: sets tool shape
|
|
||||||
|
|
||||||
GetShape1(me)
|
|
||||||
returns Shape from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose: returns object shape;
|
|
||||||
|
|
||||||
GetShape2(me)
|
|
||||||
returns Shape from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose: returns tool shape
|
|
||||||
|
|
||||||
--modified by NIZHNY-MKK Fri Sep 3 17:14:55 2004.BEGIN
|
|
||||||
---options
|
|
||||||
OperationType(me: in out)
|
|
||||||
returns Operation from BOP;
|
|
||||||
---C++: return &
|
|
||||||
---Purpose: returns ref
|
|
||||||
|
|
||||||
StopOnFirstFaulty(me: in out)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---C++: return &
|
|
||||||
---Purpose: returns ref
|
|
||||||
|
|
||||||
ArgumentTypeMode(me: in out)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---C++: return &
|
|
||||||
---C++: inline
|
|
||||||
---Purpose: Returns (modifiable) mode
|
|
||||||
-- that means checking types of shapes.
|
|
||||||
|
|
||||||
SelfInterMode(me: in out)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---C++: return &
|
|
||||||
---C++: inline
|
|
||||||
---Purpose: Returns (modifiable) mode that means
|
|
||||||
-- checking of self-intersection of shapes.
|
|
||||||
|
|
||||||
SmallEdgeMode(me: in out)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---C++: return &
|
|
||||||
---C++: inline
|
|
||||||
---Purpose: Returns (modifiable) mode that means
|
|
||||||
-- checking of small edges.
|
|
||||||
|
|
||||||
RebuildFaceMode(me: in out)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---C++: return &
|
|
||||||
---C++: inline
|
|
||||||
---Purpose: Returns (modifiable) mode that means
|
|
||||||
-- checking of possibility to split or rebuild faces.
|
|
||||||
|
|
||||||
TangentMode(me: in out)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---C++: return &
|
|
||||||
---C++: inline
|
|
||||||
---Purpose: Returns (modifiable) mode that means
|
|
||||||
-- checking of tangency between subshapes.
|
|
||||||
|
|
||||||
MergeVertexMode(me: in out)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---C++: return &
|
|
||||||
---C++: inline
|
|
||||||
---Purpose: Returns (modifiable) mode that means
|
|
||||||
-- checking of problem of merging vertices.
|
|
||||||
|
|
||||||
MergeEdgeMode(me: in out)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---C++: return &
|
|
||||||
---C++: inline
|
|
||||||
---Purpose: Returns (modifiable) mode that means
|
|
||||||
-- checking of problem of merging edges.
|
|
||||||
|
|
||||||
-- MergeFaceMode(me: in out)
|
|
||||||
-- returns Boolean from Standard;
|
|
||||||
-- ---C++: return &
|
|
||||||
-- ---C++: inline
|
|
||||||
-- ---Purpose: Returns (modifiable) mode that means
|
|
||||||
-- -- checking of problem of merging faces.
|
|
||||||
|
|
||||||
--modified by NIZHNY-MKK Fri Sep 3 17:15:02 2004.END
|
|
||||||
|
|
||||||
---
|
|
||||||
Perform(me: out);
|
|
||||||
---Purpose: performs analysis
|
|
||||||
|
|
||||||
HasFaulty(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose: result of test
|
|
||||||
|
|
||||||
GetCheckResult(me)
|
|
||||||
returns ListOfCheckResult from BOP;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose: returns a result of test
|
|
||||||
|
|
||||||
--- protected
|
|
||||||
TestTypes(me: out)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
TestSelfInterferences(me: out)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
TestSmallEdge(me: out)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
TestRebuildFace(me: out)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
TestTangent(me: out)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
TestMergeSubShapes(me: out; theType: ShapeEnum from TopAbs)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
TestMergeVertex(me: out)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
TestMergeEdge(me: out)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
-- TestMergeFace(me: out)
|
|
||||||
-- is protected;
|
|
||||||
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myShape1 : Shape from TopoDS;
|
|
||||||
myShape2 : Shape from TopoDS;
|
|
||||||
myStopOnFirst : Boolean from Standard;
|
|
||||||
--modified by NIZHNY-MKK Fri Sep 3 17:08:38 2004.BEGIN
|
|
||||||
myOperation : Operation from BOP;
|
|
||||||
myArgumentTypeMode : Boolean from Standard;
|
|
||||||
mySelfInterMode : Boolean from Standard;
|
|
||||||
mySmallEdgeMode : Boolean from Standard;
|
|
||||||
myRebuildFaceMode: Boolean from Standard;
|
|
||||||
myTangentMode : Boolean from Standard;
|
|
||||||
myMergeVertexMode: Boolean from Standard;
|
|
||||||
myMergeEdgeMode : Boolean from Standard;
|
|
||||||
-- myMergeFaceMode : Boolean from Standard;
|
|
||||||
|
|
||||||
--modified by NIZHNY-MKK Fri Sep 3 17:08:41 2004.END
|
|
||||||
myResult : ListOfCheckResult from BOP;
|
|
||||||
|
|
||||||
end ArgumentAnalyzer;
|
|
@ -1,939 +0,0 @@
|
|||||||
// Created on: 2004-09-02
|
|
||||||
// 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 <BOP_ArgumentAnalyzer.ixx>
|
|
||||||
#include <BOP_CheckResult.hxx>
|
|
||||||
#include <BOP_ShellSolid.hxx>
|
|
||||||
#include <BOP_WireSolid.hxx>
|
|
||||||
#include <BOP_WireShell.hxx>
|
|
||||||
#include <BOP_WireEdgeSet.hxx>
|
|
||||||
#include <BOP_FaceBuilder.hxx>
|
|
||||||
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
#include <BRep_Builder.hxx>
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
#include <BRepExtrema_DistShapeShape.hxx>
|
|
||||||
#include <gp_Pnt.hxx>
|
|
||||||
#include <TopoDS_Iterator.hxx>
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Vertex.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
#include <TopoDS_Wire.hxx>
|
|
||||||
#include <TopoDS_Shell.hxx>
|
|
||||||
#include <TopoDS_Solid.hxx>
|
|
||||||
#include <TopTools_ListOfShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
#include <TopTools_SequenceOfShape.hxx>
|
|
||||||
#include <TopTools_MapOfShape.hxx>
|
|
||||||
|
|
||||||
#include <TColStd_Array2OfBoolean.hxx>
|
|
||||||
|
|
||||||
#include <IntTools_Context.hxx>
|
|
||||||
#include <IntTools_Range.hxx>
|
|
||||||
#include <IntTools_ShrunkRange.hxx>
|
|
||||||
#include <IntTools_EdgeEdge.hxx>
|
|
||||||
#include <IntTools_CommonPrt.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_DSFiller.hxx>
|
|
||||||
#include <BOPTools_Tools3D.hxx>
|
|
||||||
#include <BOPTools_Checker.hxx>
|
|
||||||
#include <BOPTools_CheckResult.hxx>
|
|
||||||
#include <BOPTools_ListOfCheckResults.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfCheckResults.hxx>
|
|
||||||
|
|
||||||
#include <Standard_ErrorHandler.hxx>
|
|
||||||
#include <Standard_Failure.hxx>
|
|
||||||
|
|
||||||
static Standard_Boolean TestShapeType(const TopoDS_Shape & TheShape);
|
|
||||||
|
|
||||||
static Standard_Boolean CheckEdge(const TopoDS_Edge& theEdge);
|
|
||||||
|
|
||||||
static Standard_Boolean TestSubShapeType(const TopAbs_ShapeEnum theT1,
|
|
||||||
const TopAbs_ShapeEnum theT2,
|
|
||||||
const BOP_Operation theOP);
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: Constructor
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
BOP_ArgumentAnalyzer::BOP_ArgumentAnalyzer() :
|
|
||||||
myStopOnFirst(Standard_False),
|
|
||||||
myOperation(BOP_UNKNOWN),
|
|
||||||
myArgumentTypeMode(Standard_False),
|
|
||||||
mySelfInterMode(Standard_False),
|
|
||||||
mySmallEdgeMode(Standard_False),
|
|
||||||
myRebuildFaceMode(Standard_False),
|
|
||||||
myTangentMode(Standard_False),
|
|
||||||
myMergeVertexMode(Standard_False),
|
|
||||||
myMergeEdgeMode(Standard_False)
|
|
||||||
// myMergeFaceMode(Standard_False)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: SetShape1
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
void BOP_ArgumentAnalyzer::SetShape1(const TopoDS_Shape & TheShape)
|
|
||||||
{
|
|
||||||
myShape1 = TheShape;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: SetShape2
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
void BOP_ArgumentAnalyzer::SetShape2(const TopoDS_Shape & TheShape)
|
|
||||||
{
|
|
||||||
myShape2 = TheShape;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: GetShape1
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
const TopoDS_Shape & BOP_ArgumentAnalyzer::GetShape1() const
|
|
||||||
{
|
|
||||||
return myShape1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: GetShape2
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
const TopoDS_Shape & BOP_ArgumentAnalyzer::GetShape2() const
|
|
||||||
{
|
|
||||||
return myShape2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: OperationType
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
BOP_Operation& BOP_ArgumentAnalyzer::OperationType()
|
|
||||||
{
|
|
||||||
return myOperation;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: StopOnFirstFaulty
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
Standard_Boolean & BOP_ArgumentAnalyzer::StopOnFirstFaulty()
|
|
||||||
{
|
|
||||||
return myStopOnFirst;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: Perform
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
void BOP_ArgumentAnalyzer::Perform()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
OCC_CATCH_SIGNALS
|
|
||||||
myResult.Clear();
|
|
||||||
|
|
||||||
if(myArgumentTypeMode) {
|
|
||||||
TestTypes();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mySelfInterMode) {
|
|
||||||
TestSelfInterferences();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mySmallEdgeMode) {
|
|
||||||
if(!(!myResult.IsEmpty() && myStopOnFirst))
|
|
||||||
TestSmallEdge();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(myRebuildFaceMode) {
|
|
||||||
if(!(!myResult.IsEmpty() && myStopOnFirst))
|
|
||||||
TestRebuildFace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(myTangentMode) {
|
|
||||||
if(!(!myResult.IsEmpty() && myStopOnFirst))
|
|
||||||
TestTangent();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(myMergeVertexMode) {
|
|
||||||
if(!(!myResult.IsEmpty() && myStopOnFirst))
|
|
||||||
TestMergeVertex();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(myMergeEdgeMode) {
|
|
||||||
if(!(!myResult.IsEmpty() && myStopOnFirst))
|
|
||||||
TestMergeEdge();
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(myMergeFaceMode) {
|
|
||||||
// TestMergeFace();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
catch(Standard_Failure) {
|
|
||||||
BOP_CheckResult aResult;
|
|
||||||
aResult.SetCheckStatus(BOP_CheckUnknown);
|
|
||||||
myResult.Append(aResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: HasFaulty
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
Standard_Boolean BOP_ArgumentAnalyzer::HasFaulty() const
|
|
||||||
{
|
|
||||||
return ( !myResult.IsEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: GetCheckResult
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
const BOP_ListOfCheckResult& BOP_ArgumentAnalyzer::GetCheckResult() const
|
|
||||||
{
|
|
||||||
return myResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: TestTypes
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
void BOP_ArgumentAnalyzer::TestTypes()
|
|
||||||
{
|
|
||||||
Standard_Boolean isS1 = myShape1.IsNull(), isS2 = myShape2.IsNull();
|
|
||||||
|
|
||||||
if(isS1 && isS2) {
|
|
||||||
BOP_CheckResult aResult;
|
|
||||||
aResult.SetCheckStatus(BOP_BadType);
|
|
||||||
myResult.Append(aResult);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean testS1 = TestShapeType(myShape1);
|
|
||||||
Standard_Boolean testS2 = TestShapeType(myShape2);
|
|
||||||
|
|
||||||
// single shape check (begin)
|
|
||||||
if((isS1 && !isS2) || (!isS1 && isS2)) {
|
|
||||||
// Standard_Boolean testS = (isS1) ? testS1 : testS2;
|
|
||||||
Standard_Boolean testS = (isS1) ? testS2 : testS1;
|
|
||||||
|
|
||||||
if(!testS) {
|
|
||||||
const TopoDS_Shape & aS = (isS1) ? myShape1 : myShape2;
|
|
||||||
BOP_CheckResult aResult;
|
|
||||||
aResult.SetShape1(aS);
|
|
||||||
aResult.SetCheckStatus(BOP_BadType);
|
|
||||||
myResult.Append(aResult);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // single shape is set (end)
|
|
||||||
// two shapes check (begin)
|
|
||||||
else {
|
|
||||||
// test compounds and compsolids
|
|
||||||
if(!testS1 || !testS2) {
|
|
||||||
BOP_CheckResult aResult;
|
|
||||||
if(!testS1 && !testS2) {
|
|
||||||
aResult.SetShape1(myShape1);
|
|
||||||
aResult.SetShape2(myShape2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const TopoDS_Shape & aS = (!testS1) ? myShape1 : myShape2;
|
|
||||||
if(!testS1)
|
|
||||||
aResult.SetShape1(aS);
|
|
||||||
else
|
|
||||||
aResult.SetShape2(aS);
|
|
||||||
}
|
|
||||||
aResult.SetCheckStatus(BOP_BadType);
|
|
||||||
myResult.Append(aResult);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// test faces, wires, edges
|
|
||||||
TopAbs_ShapeEnum aT1 = myShape1.ShapeType(), aT2 = myShape2.ShapeType();
|
|
||||||
|
|
||||||
if(aT1 != TopAbs_COMPOUND && aT2 != TopAbs_COMPOUND) {
|
|
||||||
Standard_Boolean aTestRes = TestSubShapeType(aT1,aT2,myOperation);
|
|
||||||
if(!aTestRes) {
|
|
||||||
BOP_CheckResult aResult;
|
|
||||||
aResult.SetShape1(myShape1);
|
|
||||||
aResult.SetShape2(myShape2);
|
|
||||||
aResult.SetCheckStatus(BOP_BadType);
|
|
||||||
myResult.Append(aResult);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Standard_Boolean aTestRes = Standard_True;
|
|
||||||
if(aT1 == TopAbs_COMPOUND && aT2 != TopAbs_COMPOUND) {
|
|
||||||
TopoDS_Iterator itS1(myShape1);
|
|
||||||
while(itS1.More()) {
|
|
||||||
aT1 = itS1.Value().ShapeType();
|
|
||||||
aTestRes = TestSubShapeType(aT1,aT2,myOperation);
|
|
||||||
if(!aTestRes)
|
|
||||||
break;
|
|
||||||
itS1.Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(aT1 != TopAbs_COMPOUND && aT2 == TopAbs_COMPOUND) {
|
|
||||||
TopoDS_Iterator itS2(myShape2);
|
|
||||||
while(itS2.More()) {
|
|
||||||
aT2 = itS2.Value().ShapeType();
|
|
||||||
aTestRes = TestSubShapeType(aT1,aT2,myOperation);
|
|
||||||
if(!aTestRes)
|
|
||||||
break;
|
|
||||||
itS2.Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopoDS_Iterator itS1(myShape1);
|
|
||||||
while(itS1.More()) {
|
|
||||||
aT1 = itS1.Value().ShapeType();
|
|
||||||
TopoDS_Iterator itS2(myShape2);
|
|
||||||
while(itS2.More()) {
|
|
||||||
aT2 = itS2.Value().ShapeType();
|
|
||||||
aTestRes = TestSubShapeType(aT1,aT2,myOperation);
|
|
||||||
if(!aTestRes)
|
|
||||||
break;
|
|
||||||
itS2.Next();
|
|
||||||
}
|
|
||||||
if(!aTestRes)
|
|
||||||
break;
|
|
||||||
itS1.Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!aTestRes) {
|
|
||||||
BOP_CheckResult aResult;
|
|
||||||
aResult.SetShape1(myShape1);
|
|
||||||
aResult.SetShape2(myShape2);
|
|
||||||
aResult.SetCheckStatus(BOP_BadType);
|
|
||||||
myResult.Append(aResult);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // both shapes are set (end)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: TestSelfInterferences
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
void BOP_ArgumentAnalyzer::TestSelfInterferences()
|
|
||||||
{
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
|
|
||||||
for(i = 0; i < 2; i++) {
|
|
||||||
TopoDS_Shape aS = (i == 0) ? myShape1 : myShape2;
|
|
||||||
|
|
||||||
if(aS.IsNull())
|
|
||||||
continue;
|
|
||||||
BOPTools_Checker aChecker(aS);
|
|
||||||
aChecker.Perform();
|
|
||||||
|
|
||||||
if (aChecker.HasFaulty()) {
|
|
||||||
const BOPTools_ListOfCheckResults& aResultList = aChecker.GetCheckResult();
|
|
||||||
BOPTools_ListIteratorOfListOfCheckResults anIt(aResultList);
|
|
||||||
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
const BOPTools_CheckResult& aCheckResult = anIt.Value();
|
|
||||||
|
|
||||||
if((aCheckResult.GetCheckStatus() == BOPTools_CHKUNKNOWN) ||
|
|
||||||
(aCheckResult.GetCheckStatus() == BOPTools_BADSHRANKRANGE) ||
|
|
||||||
(aCheckResult.GetCheckStatus() == BOPTools_NULLSRANKRANGE)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
BOP_CheckResult aResult;
|
|
||||||
if(i == 0)
|
|
||||||
aResult.SetShape1(myShape1);
|
|
||||||
else
|
|
||||||
aResult.SetShape2(myShape2);
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt2(aCheckResult.GetShapes());
|
|
||||||
|
|
||||||
for(; anIt2.More(); anIt2.Next()) {
|
|
||||||
if(i == 0)
|
|
||||||
aResult.AddFaultyShape1(anIt2.Value());
|
|
||||||
else
|
|
||||||
aResult.AddFaultyShape2(anIt2.Value());
|
|
||||||
}
|
|
||||||
aResult.SetCheckStatus(BOP_SelfIntersect);
|
|
||||||
myResult.Append(aResult);
|
|
||||||
|
|
||||||
if(myStopOnFirst) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: TestSmallEdge
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
void BOP_ArgumentAnalyzer::TestSmallEdge()
|
|
||||||
{
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
BRepExtrema_DistShapeShape aDist;
|
|
||||||
|
|
||||||
for(i = 0; i < 2; i++) {
|
|
||||||
TopoDS_Shape aS = (i == 0) ? myShape1 : myShape2;
|
|
||||||
|
|
||||||
if(aS.IsNull())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
TopExp_Explorer anExp(aS, TopAbs_EDGE);
|
|
||||||
|
|
||||||
for(; anExp.More(); anExp.Next()) {
|
|
||||||
TopoDS_Edge anEdge = TopoDS::Edge(anExp.Current());
|
|
||||||
|
|
||||||
if(!CheckEdge(anEdge)) {
|
|
||||||
Standard_Boolean bKeepResult = Standard_True;
|
|
||||||
|
|
||||||
if(myOperation == BOP_SECTION) {
|
|
||||||
TopoDS_Shape anOtherS = (i == 0) ? myShape2 : myShape1;
|
|
||||||
|
|
||||||
if(!anOtherS.IsNull()) {
|
|
||||||
// BRepExtrema_DistShapeShape aDist;
|
|
||||||
aDist.LoadS2(anOtherS);
|
|
||||||
|
|
||||||
Standard_Boolean bVertexIsOnShape = Standard_False;
|
|
||||||
Standard_Integer ii = 0;
|
|
||||||
TopExp_Explorer anExpV(anEdge, TopAbs_VERTEX);
|
|
||||||
|
|
||||||
for(; anExpV.More(); anExpV.Next()) {
|
|
||||||
TopoDS_Shape aV = anExpV.Current();
|
|
||||||
|
|
||||||
aDist.LoadS1(aV);
|
|
||||||
aDist.Perform();
|
|
||||||
|
|
||||||
if(aDist.IsDone()) {
|
|
||||||
|
|
||||||
for(ii = 1; ii <= aDist.NbSolution(); ii++) {
|
|
||||||
Standard_Real aTolerance = BRep_Tool::Tolerance(TopoDS::Vertex(aV));
|
|
||||||
TopoDS_Shape aSupportShape = aDist.SupportOnShape2(ii);
|
|
||||||
|
|
||||||
switch(aSupportShape.ShapeType()) {
|
|
||||||
case TopAbs_VERTEX: {
|
|
||||||
aTolerance += BRep_Tool::Tolerance(TopoDS::Vertex(aSupportShape));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TopAbs_EDGE: {
|
|
||||||
aTolerance += BRep_Tool::Tolerance(TopoDS::Edge(aSupportShape));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TopAbs_FACE: {
|
|
||||||
aTolerance += BRep_Tool::Tolerance(TopoDS::Face(aSupportShape));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(aDist.Value() < aTolerance) {
|
|
||||||
bVertexIsOnShape = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!bVertexIsOnShape) {
|
|
||||||
bKeepResult = Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bKeepResult) {
|
|
||||||
BOP_CheckResult aResult;
|
|
||||||
|
|
||||||
if(i == 0) {
|
|
||||||
aResult.SetShape1(myShape1);
|
|
||||||
aResult.AddFaultyShape1(anEdge);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aResult.SetShape2(myShape2);
|
|
||||||
aResult.AddFaultyShape2(anEdge);
|
|
||||||
}
|
|
||||||
|
|
||||||
aResult.SetCheckStatus(BOP_TooSmallEdge);
|
|
||||||
myResult.Append(aResult);
|
|
||||||
|
|
||||||
if(myStopOnFirst) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: TestRebuildFace
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
void BOP_ArgumentAnalyzer::TestRebuildFace()
|
|
||||||
{
|
|
||||||
if((myOperation == BOP_SECTION) ||
|
|
||||||
(myOperation == BOP_UNKNOWN))
|
|
||||||
return;
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
|
|
||||||
for(i = 0; i < 2; i++) {
|
|
||||||
TopoDS_Shape aS = (i == 0) ? myShape1 : myShape2;
|
|
||||||
|
|
||||||
if(aS.IsNull())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
TopExp_Explorer anExp(aS, TopAbs_FACE);
|
|
||||||
|
|
||||||
for(; anExp.More(); anExp.Next()) {
|
|
||||||
TopoDS_Face aFace = TopoDS::Face(anExp.Current());
|
|
||||||
|
|
||||||
BOP_WireEdgeSet aWES (aFace);
|
|
||||||
TopExp_Explorer anExpE(aFace, TopAbs_EDGE);
|
|
||||||
Standard_Integer nbstartedges = 0;
|
|
||||||
|
|
||||||
for(; anExpE.More(); anExpE.Next()) {
|
|
||||||
aWES.AddStartElement(anExpE.Current());
|
|
||||||
nbstartedges++;
|
|
||||||
}
|
|
||||||
BOP_FaceBuilder aFB;
|
|
||||||
aFB.Do(aWES);
|
|
||||||
const TopTools_ListOfShape& aLF = aFB.NewFaces();
|
|
||||||
Standard_Boolean bBadFace = Standard_False;
|
|
||||||
|
|
||||||
if(aLF.Extent() != 1) {
|
|
||||||
bBadFace = Standard_True;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Standard_Integer nbedgeused = 0;
|
|
||||||
anExpE.Init(aLF.First(), TopAbs_EDGE);
|
|
||||||
|
|
||||||
for(; anExpE.More(); anExpE.Next(), nbedgeused++);
|
|
||||||
|
|
||||||
if(nbstartedges != nbedgeused) {
|
|
||||||
bBadFace = Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bBadFace) {
|
|
||||||
BOP_CheckResult aResult;
|
|
||||||
|
|
||||||
if(i == 0) {
|
|
||||||
aResult.SetShape1(myShape1);
|
|
||||||
aResult.AddFaultyShape1(aFace);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aResult.SetShape2(myShape2);
|
|
||||||
aResult.AddFaultyShape2(aFace);
|
|
||||||
}
|
|
||||||
|
|
||||||
aResult.SetCheckStatus(BOP_NonRecoverableFace);
|
|
||||||
myResult.Append(aResult);
|
|
||||||
|
|
||||||
if(myStopOnFirst) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: TestTangent
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
void BOP_ArgumentAnalyzer::TestTangent()
|
|
||||||
{
|
|
||||||
// not implemented
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: TestMergeSubShapes
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
void BOP_ArgumentAnalyzer::TestMergeSubShapes(const TopAbs_ShapeEnum theType)
|
|
||||||
{
|
|
||||||
if(myShape1.IsNull() || myShape2.IsNull())
|
|
||||||
return;
|
|
||||||
|
|
||||||
BOP_CheckStatus aStatus = BOP_CheckUnknown;
|
|
||||||
|
|
||||||
switch(theType) {
|
|
||||||
case TopAbs_VERTEX: {
|
|
||||||
aStatus = BOP_IncompatibilityOfVertex;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TopAbs_EDGE: {
|
|
||||||
aStatus = BOP_IncompatibilityOfEdge;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TopAbs_FACE: {
|
|
||||||
aStatus = BOP_IncompatibilityOfFace;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
TopExp_Explorer anExp1(myShape1, theType);
|
|
||||||
TopExp_Explorer anExp2(myShape2, theType);
|
|
||||||
TopTools_SequenceOfShape aSeq1, aSeq2;
|
|
||||||
TopTools_MapOfShape aMap1, aMap2;
|
|
||||||
|
|
||||||
for(; anExp1.More(); anExp1.Next()) {
|
|
||||||
TopoDS_Shape aS1 = anExp1.Current();
|
|
||||||
|
|
||||||
if(aMap1.Contains(aS1))
|
|
||||||
continue;
|
|
||||||
aSeq1.Append(aS1);
|
|
||||||
aMap1.Add(aS1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(; anExp2.More(); anExp2.Next()) {
|
|
||||||
TopoDS_Shape aS2 = anExp2.Current();
|
|
||||||
if(aMap2.Contains(aS2))
|
|
||||||
continue;
|
|
||||||
aSeq2.Append(aS2);
|
|
||||||
aMap2.Add(aS2);
|
|
||||||
}
|
|
||||||
|
|
||||||
TColStd_Array2OfBoolean anArrayOfFlag(1, aSeq1.Length(), 1, aSeq2.Length());
|
|
||||||
Standard_Integer i = 0, j = 0;
|
|
||||||
for(i = 1; i <= aSeq1.Length(); i++)
|
|
||||||
for(j = 1; j <= aSeq2.Length(); j++)
|
|
||||||
anArrayOfFlag.SetValue(i, j, Standard_False);
|
|
||||||
|
|
||||||
for(i = 1; i <= aSeq1.Length(); i++) {
|
|
||||||
TopoDS_Shape aS1 = aSeq1.Value(i);
|
|
||||||
TopTools_ListOfShape aListOfS2;
|
|
||||||
Standard_Integer nbs = 0;
|
|
||||||
|
|
||||||
for(j = 1; j <= aSeq2.Length(); j++) {
|
|
||||||
TopoDS_Shape aS2 = aSeq2.Value(j);
|
|
||||||
Standard_Boolean bIsEqual = Standard_False;
|
|
||||||
|
|
||||||
if(theType == TopAbs_VERTEX) {
|
|
||||||
|
|
||||||
TopoDS_Vertex aV1 = TopoDS::Vertex(aS1);
|
|
||||||
TopoDS_Vertex aV2 = TopoDS::Vertex(aS2);
|
|
||||||
gp_Pnt aP1 = BRep_Tool::Pnt(aV1);
|
|
||||||
gp_Pnt aP2 = BRep_Tool::Pnt(aV2);
|
|
||||||
Standard_Real aDist = aP1.Distance(aP2);
|
|
||||||
|
|
||||||
if(aDist <= (BRep_Tool::Tolerance(aV1) + BRep_Tool::Tolerance(aV2))) {
|
|
||||||
bIsEqual = Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(theType == TopAbs_EDGE) {
|
|
||||||
Standard_Integer aDiscretize = 30;
|
|
||||||
Standard_Real aDeflection = 0.01;
|
|
||||||
TopoDS_Edge aE1 = TopoDS::Edge(aS1);
|
|
||||||
TopoDS_Edge aE2 = TopoDS::Edge(aS2);
|
|
||||||
|
|
||||||
IntTools_EdgeEdge aEE;
|
|
||||||
aEE.SetEdge1 (aE1);
|
|
||||||
aEE.SetEdge2 (aE2);
|
|
||||||
aEE.SetTolerance1 (BRep_Tool::Tolerance(aE1));
|
|
||||||
aEE.SetTolerance2 (BRep_Tool::Tolerance(aE2));
|
|
||||||
aEE.SetDiscretize (aDiscretize);
|
|
||||||
aEE.SetDeflection (aDeflection);
|
|
||||||
|
|
||||||
Standard_Real f = 0., l = 0.;
|
|
||||||
BRep_Tool::Range(aE1, f, l);
|
|
||||||
aEE.SetRange1(f, l);
|
|
||||||
|
|
||||||
BRep_Tool::Range(aE2, f, l);
|
|
||||||
aEE.SetRange2(f, l);
|
|
||||||
|
|
||||||
aEE.Perform();
|
|
||||||
|
|
||||||
if (aEE.IsDone()) {
|
|
||||||
const IntTools_SequenceOfCommonPrts& aCPrts = aEE.CommonParts();
|
|
||||||
Standard_Integer ii = 0;
|
|
||||||
|
|
||||||
for (ii = 1; ii <= aCPrts.Length(); ii++) {
|
|
||||||
const IntTools_CommonPrt& aCPart = aCPrts(ii);
|
|
||||||
|
|
||||||
if (aCPart.Type() == TopAbs_EDGE) {
|
|
||||||
bIsEqual = Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(theType == TopAbs_FACE) {
|
|
||||||
// not yet implemented!
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bIsEqual) {
|
|
||||||
anArrayOfFlag.SetValue(i, j, Standard_True );
|
|
||||||
aListOfS2.Append(aS2);
|
|
||||||
nbs++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nbs > 1) {
|
|
||||||
BOP_CheckResult aResult;
|
|
||||||
|
|
||||||
aResult.SetShape1(myShape1);
|
|
||||||
aResult.SetShape2(myShape2);
|
|
||||||
aResult.AddFaultyShape1(aS1);
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aListOfS2);
|
|
||||||
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
aResult.AddFaultyShape2(anIt.Value());
|
|
||||||
}
|
|
||||||
|
|
||||||
aResult.SetCheckStatus(aStatus);
|
|
||||||
myResult.Append(aResult);
|
|
||||||
|
|
||||||
if(myStopOnFirst) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 1; i <= aSeq2.Length(); i++) {
|
|
||||||
TopoDS_Shape aS2 = aSeq2.Value(i);
|
|
||||||
TopTools_ListOfShape aListOfS1;
|
|
||||||
Standard_Integer nbs = 0;
|
|
||||||
|
|
||||||
for(j = 1; j <= aSeq1.Length(); j++) {
|
|
||||||
TopoDS_Shape aS1 = aSeq1.Value(j);
|
|
||||||
|
|
||||||
if(anArrayOfFlag.Value(j, i)) {
|
|
||||||
aListOfS1.Append(aS1);
|
|
||||||
nbs++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nbs > 1) {
|
|
||||||
BOP_CheckResult aResult;
|
|
||||||
|
|
||||||
aResult.SetShape1(myShape1);
|
|
||||||
aResult.SetShape2(myShape2);
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aListOfS1);
|
|
||||||
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
aResult.AddFaultyShape1(anIt.Value());
|
|
||||||
}
|
|
||||||
aResult.AddFaultyShape2(aS2);
|
|
||||||
|
|
||||||
aResult.SetCheckStatus(aStatus);
|
|
||||||
myResult.Append(aResult);
|
|
||||||
|
|
||||||
if(myStopOnFirst) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: TestMergeVertex
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
void BOP_ArgumentAnalyzer::TestMergeVertex()
|
|
||||||
{
|
|
||||||
TestMergeSubShapes(TopAbs_VERTEX);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: TestMergeEdge
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
void BOP_ArgumentAnalyzer::TestMergeEdge()
|
|
||||||
{
|
|
||||||
TestMergeSubShapes(TopAbs_EDGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================================
|
|
||||||
// function: TestMergeFace
|
|
||||||
// purpose:
|
|
||||||
// ================================================================================
|
|
||||||
// void BOP_ArgumentAnalyzer::TestMergeFace()
|
|
||||||
// {
|
|
||||||
// not implemented
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// static function: TestShapeType
|
|
||||||
// purpose:
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
Standard_Boolean TestShapeType(const TopoDS_Shape & TheShape)
|
|
||||||
{
|
|
||||||
if(TheShape.IsNull())
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
TopAbs_ShapeEnum aT = TheShape.ShapeType();
|
|
||||||
|
|
||||||
if(aT == TopAbs_COMPOUND && BOPTools_Tools3D::IsEmptyShape(TheShape))
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
TopoDS_Iterator anIt;
|
|
||||||
TopoDS_Shape aSTmp, aShape;
|
|
||||||
Standard_Integer aNbShapes, TreatRes = 0;
|
|
||||||
|
|
||||||
if(aT==TopAbs_COMPOUND || aT==TopAbs_COMPSOLID) {
|
|
||||||
aNbShapes=0;
|
|
||||||
anIt.Initialize(TheShape);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
if(!aNbShapes) {
|
|
||||||
aSTmp=anIt.Value();
|
|
||||||
}
|
|
||||||
aNbShapes++;
|
|
||||||
if(aNbShapes>1) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(aT == TopAbs_COMPOUND) {
|
|
||||||
if (aNbShapes==1) {
|
|
||||||
TreatRes = BOPTools_DSFiller::TreatCompound(TheShape, aSTmp);
|
|
||||||
if(TreatRes != 0)
|
|
||||||
return Standard_False;
|
|
||||||
aShape=aSTmp;
|
|
||||||
aT = aShape.ShapeType();
|
|
||||||
}
|
|
||||||
else if (aNbShapes>1) {
|
|
||||||
TreatRes = BOPTools_DSFiller::TreatCompound(TheShape, aSTmp);
|
|
||||||
if(TreatRes != 0)
|
|
||||||
return Standard_False;
|
|
||||||
aShape=aSTmp;
|
|
||||||
aT=aShape.ShapeType();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(aT==TopAbs_COMPOUND || aT==TopAbs_COMPSOLID) {
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// static function: CheckEdge
|
|
||||||
// purpose:
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
Standard_Boolean CheckEdge(const TopoDS_Edge& theEdge)
|
|
||||||
{
|
|
||||||
Handle(IntTools_Context) aContext;
|
|
||||||
TopoDS_Vertex aV1, aV2;
|
|
||||||
//
|
|
||||||
//modified by NIZNHY-PKV Tue Jan 31 15:07:13 2012f
|
|
||||||
aContext=new IntTools_Context;
|
|
||||||
////modified by NIZNHY-PKV Tue Jan 31 15:07:16 2012t
|
|
||||||
TopExp::Vertices(theEdge, aV1, aV2);
|
|
||||||
|
|
||||||
|
|
||||||
if(aV1.IsNull() || aV2.IsNull() || BRep_Tool::Degenerated(theEdge))
|
|
||||||
return Standard_True;
|
|
||||||
Standard_Real aFirst = 0., aLast = 0.;
|
|
||||||
BRep_Tool::Range(theEdge, aFirst, aLast);
|
|
||||||
IntTools_Range aRange(aFirst, aLast);
|
|
||||||
IntTools_ShrunkRange aSR(theEdge, aV1, aV2, aRange, aContext);
|
|
||||||
|
|
||||||
if (!aSR.IsDone() || aSR.ErrorStatus() == 6) {
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// static function: TestSubShapeType
|
|
||||||
// purpose:
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
Standard_Boolean TestSubShapeType(const TopAbs_ShapeEnum theT1,
|
|
||||||
const TopAbs_ShapeEnum theT2,
|
|
||||||
const BOP_Operation theOP)
|
|
||||||
{
|
|
||||||
TopAbs_ShapeEnum aT1 = theT1, aT2 = theT2;
|
|
||||||
|
|
||||||
if(aT1==TopAbs_FACE) {
|
|
||||||
if(aT2==TopAbs_SOLID || aT2==TopAbs_SHELL || aT2==TopAbs_FACE ||
|
|
||||||
aT2==TopAbs_WIRE || aT2==TopAbs_EDGE) {
|
|
||||||
aT1=TopAbs_SHELL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(aT2==TopAbs_FACE) {
|
|
||||||
if(aT1==TopAbs_SOLID || aT1==TopAbs_SHELL ||
|
|
||||||
aT1==TopAbs_WIRE || aT1==TopAbs_EDGE) {
|
|
||||||
aT2=TopAbs_SHELL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(aT1==TopAbs_EDGE) {
|
|
||||||
if(aT2==TopAbs_SOLID || aT2==TopAbs_SHELL ||
|
|
||||||
aT2==TopAbs_WIRE || aT2==TopAbs_EDGE) {
|
|
||||||
aT1=TopAbs_WIRE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(aT2==TopAbs_EDGE) {
|
|
||||||
if(aT1==TopAbs_SOLID || aT1==TopAbs_SHELL || aT1==TopAbs_WIRE) {
|
|
||||||
aT2=TopAbs_WIRE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// test operations
|
|
||||||
if(theOP!=BOP_UNKNOWN) {
|
|
||||||
Standard_Boolean opOk;
|
|
||||||
if(aT1==TopAbs_SHELL && aT2==TopAbs_SHELL)
|
|
||||||
opOk = Standard_True;
|
|
||||||
else if(aT1==TopAbs_SOLID && aT2==TopAbs_SOLID)
|
|
||||||
opOk = Standard_True;
|
|
||||||
else if((aT1==TopAbs_SOLID && aT2==TopAbs_SHELL) ||
|
|
||||||
(aT2==TopAbs_SOLID && aT1==TopAbs_SHELL))
|
|
||||||
opOk = Standard_True;
|
|
||||||
else if(aT1==TopAbs_WIRE && aT2==TopAbs_WIRE)
|
|
||||||
opOk = Standard_True;
|
|
||||||
else if((aT1==TopAbs_WIRE && aT2==TopAbs_SHELL) ||
|
|
||||||
(aT2==TopAbs_WIRE && aT1==TopAbs_SHELL))
|
|
||||||
opOk = Standard_True;
|
|
||||||
else if((aT1==TopAbs_WIRE && aT2==TopAbs_SOLID) ||
|
|
||||||
(aT2==TopAbs_WIRE && aT1==TopAbs_SOLID))
|
|
||||||
opOk = Standard_True;
|
|
||||||
else
|
|
||||||
opOk = Standard_False;
|
|
||||||
|
|
||||||
if(!opOk) {
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((aT1==TopAbs_SHELL && aT2==TopAbs_SOLID) ||
|
|
||||||
(aT2==TopAbs_SHELL && aT1==TopAbs_SOLID)) {
|
|
||||||
if(!BOP_ShellSolid::CheckArgTypes(aT1,aT2,theOP)) {
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if((aT1==TopAbs_WIRE && aT2==TopAbs_SOLID) ||
|
|
||||||
(aT2==TopAbs_WIRE && aT1==TopAbs_SOLID)) {
|
|
||||||
if(!BOP_WireSolid::CheckArgTypes(aT1,aT2,theOP)) {
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if((aT1==TopAbs_WIRE && aT2==TopAbs_SHELL) ||
|
|
||||||
(aT2==TopAbs_WIRE && aT1==TopAbs_SHELL)) {
|
|
||||||
if(!BOP_WireShell::CheckArgTypes(aT1,aT2,theOP)) {
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
@ -1,142 +0,0 @@
|
|||||||
-- Created on: 1993-02-25
|
|
||||||
-- Created by: Jean Yves LEBEY
|
|
||||||
-- Copyright (c) 1993-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 BlockBuilder from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- auxiliary class to storage and operate with data of
|
|
||||||
--- connexity blocks inside the given ShapeSet
|
|
||||||
---
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
Shape from TopoDS,
|
|
||||||
|
|
||||||
ShapeSet from BOP,
|
|
||||||
BlockIterator from BOP,
|
|
||||||
|
|
||||||
SequenceOfInteger from TColStd,
|
|
||||||
DataMapOfIntegerInteger from TColStd,
|
|
||||||
IndexedMapOfOrientedShape from TopTools
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns BlockBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty Constructor
|
|
||||||
---
|
|
||||||
Create(SS : in out ShapeSet)
|
|
||||||
returns BlockBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Create an object for given ShapeSet
|
|
||||||
---
|
|
||||||
MakeBlock(me : in out;
|
|
||||||
SS : in out ShapeSet)
|
|
||||||
is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Compute the set of connexity blocks of elements
|
|
||||||
--- for of the ShapeSet SS
|
|
||||||
--
|
|
||||||
--
|
|
||||||
-- I t e r a t i o n o n b l o c k s made by MakeBlock
|
|
||||||
--
|
|
||||||
InitBlock(me : in out)
|
|
||||||
is static;
|
|
||||||
|
|
||||||
MoreBlock(me)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is static;
|
|
||||||
|
|
||||||
NextBlock(me : in out)
|
|
||||||
is static;
|
|
||||||
--
|
|
||||||
-- I t e r a t i o n o n on shapes inside the current block
|
|
||||||
--
|
|
||||||
BlockIterator(me)
|
|
||||||
returns BlockIterator from BOP
|
|
||||||
is static;
|
|
||||||
--- Purpose:
|
|
||||||
--- Returns the BlockIterator for the current block .
|
|
||||||
---
|
|
||||||
Element(me; BI : BlockIterator from BOP)
|
|
||||||
returns Shape from TopoDS
|
|
||||||
is static;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Returns the current element of <BI>.
|
|
||||||
---
|
|
||||||
Element(me; I : Integer from Standard)
|
|
||||||
returns Shape from TopoDS
|
|
||||||
is static;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Returns the current element with index <I> .
|
|
||||||
---
|
|
||||||
Element(me; S : Shape from TopoDS)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Returns the index of the current element .
|
|
||||||
---
|
|
||||||
ElementIsValid(me; BI : BlockIterator)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal
|
|
||||||
---
|
|
||||||
ElementIsValid(me; I : Integer from Standard)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal
|
|
||||||
---
|
|
||||||
AddElement(me : in out; S : Shape from TopoDS)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal
|
|
||||||
---
|
|
||||||
SetValid(me : in out;
|
|
||||||
BI : BlockIterator from BOP ;
|
|
||||||
IsValid : Boolean from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Internal
|
|
||||||
---
|
|
||||||
SetValid(me : in out;
|
|
||||||
I : Integer from Standard;
|
|
||||||
IsValid : Boolean from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Internal
|
|
||||||
---
|
|
||||||
CurrentBlockIsRegular(me : in out)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Returns TRUE if all elements inside the current block
|
|
||||||
--- are biconnexial
|
|
||||||
---
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myOrientedShapeMapIsValid : DataMapOfIntegerInteger from TColStd;
|
|
||||||
myOrientedShapeMap : IndexedMapOfOrientedShape from TopTools;
|
|
||||||
myBlocks : SequenceOfInteger from TColStd;
|
|
||||||
myBlockIndex : Integer from Standard;
|
|
||||||
myIsDone : Boolean from Standard;
|
|
||||||
myBlocksIsRegular : SequenceOfInteger from TColStd;
|
|
||||||
|
|
||||||
end BlockBuilder;
|
|
@ -1,319 +0,0 @@
|
|||||||
// Created on: 1993-03-11
|
|
||||||
// Created by: Jean Yves LEBEY
|
|
||||||
// Copyright (c) 1993-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.
|
|
||||||
|
|
||||||
|
|
||||||
#include <BOP_BlockBuilder.ixx>
|
|
||||||
|
|
||||||
#include <Standard_Failure.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_BlockBuilder::BOP_BlockBuilder
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_BlockBuilder::BOP_BlockBuilder()
|
|
||||||
:
|
|
||||||
myIsDone(Standard_False)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_BlockBuilder::BOP_BlockBuilder
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_BlockBuilder::BOP_BlockBuilder (BOP_ShapeSet& SS)
|
|
||||||
:myIsDone(Standard_False)
|
|
||||||
{
|
|
||||||
MakeBlock(SS);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : MakeBlock
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_BlockBuilder::MakeBlock(BOP_ShapeSet& SS)
|
|
||||||
{
|
|
||||||
// Compute the set of connexity blocks of elements of element set SS
|
|
||||||
//
|
|
||||||
// Logic :
|
|
||||||
// - A block is a set of connex elements of SS
|
|
||||||
// - We assume that any element of SS appears in only 1 connexity block.
|
|
||||||
//
|
|
||||||
// Implementation :
|
|
||||||
// - All the elements of all the blocks are stored in map myOrientedShapeMap(M).
|
|
||||||
// - A connexity block is a segment [f,l] of element indices of M.
|
|
||||||
// - myBlocks is a sequence of integer; each integer is the index of the
|
|
||||||
// first element (in M) of a connexity block.
|
|
||||||
// - Bounds [f,l] of a connexity block are :
|
|
||||||
// f = myBlocks(i)
|
|
||||||
// l = myBlocks(i+1) - 1
|
|
||||||
|
|
||||||
myOrientedShapeMap.Clear();
|
|
||||||
myOrientedShapeMapIsValid.Clear();
|
|
||||||
myBlocks.Clear();
|
|
||||||
myBlocksIsRegular.Clear();
|
|
||||||
//
|
|
||||||
Standard_Boolean IsRegular, CurNei, Mextent, Eindex,
|
|
||||||
EnewinM, searchneighbours, condregu;
|
|
||||||
Standard_Integer iiregu;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
SS.InitStartElements();
|
|
||||||
for (; SS.MoreStartElements(); SS.NextStartElement()) {
|
|
||||||
const TopoDS_Shape& E = SS.StartElement();
|
|
||||||
Mextent = myOrientedShapeMap.Extent();
|
|
||||||
Eindex = AddElement(E);
|
|
||||||
|
|
||||||
// E = current element of the element set SS
|
|
||||||
// Mextent = index of last element stored in map M, before E is added.
|
|
||||||
// Eindex = index of E added to M : Eindex > Mextent => E is new in M
|
|
||||||
|
|
||||||
EnewinM = (Eindex > Mextent);
|
|
||||||
if (EnewinM) {
|
|
||||||
//
|
|
||||||
// make a new block starting at element Eindex
|
|
||||||
myBlocks.Append(Eindex);
|
|
||||||
IsRegular = Standard_True; CurNei = 0;
|
|
||||||
// put in current block all the elements connex to E :
|
|
||||||
// while an element E has been added to M
|
|
||||||
// - compute neighbours of E : N(E)
|
|
||||||
// - add each element N of N(E) to M
|
|
||||||
|
|
||||||
Mextent = myOrientedShapeMap.Extent();
|
|
||||||
searchneighbours = (Eindex <= Mextent);
|
|
||||||
while (searchneighbours) {
|
|
||||||
|
|
||||||
// E = element of M on which neighbours must be searched
|
|
||||||
// first step : Eindex = index of starting element of SS
|
|
||||||
// next steps : Eindex = index of neighbours of starting element of SS
|
|
||||||
const TopoDS_Shape& anE = myOrientedShapeMap(Eindex);
|
|
||||||
CurNei = SS.MaxNumberSubShape(anE);
|
|
||||||
|
|
||||||
condregu = (CurNei > 2) ? Standard_False : Standard_True;
|
|
||||||
|
|
||||||
IsRegular = IsRegular && condregu;
|
|
||||||
//
|
|
||||||
// compute neighbours of E : add them to M to increase M.Extent().
|
|
||||||
SS.InitNeighbours(anE);
|
|
||||||
|
|
||||||
for (; SS.MoreNeighbours(); SS.NextNeighbour()) {
|
|
||||||
const TopoDS_Shape& N = SS.Neighbour();
|
|
||||||
AddElement(N);
|
|
||||||
}
|
|
||||||
|
|
||||||
Eindex++;
|
|
||||||
Mextent = myOrientedShapeMap.Extent();
|
|
||||||
searchneighbours = (Eindex <= Mextent);
|
|
||||||
|
|
||||||
} // while (searchneighbours)
|
|
||||||
|
|
||||||
iiregu = IsRegular ? 1 : 0;
|
|
||||||
myBlocksIsRegular.Append(iiregu);
|
|
||||||
} // if (EnewinM)
|
|
||||||
} // for ()
|
|
||||||
//
|
|
||||||
// To value the l bound of the last connexity block created above,
|
|
||||||
// we create an artificial block of value = myOrientedShapeMap.Extent() + 1
|
|
||||||
// The real number of connexity blocks is myBlocks.Length() - 1
|
|
||||||
Mextent = myOrientedShapeMap.Extent();
|
|
||||||
myBlocks.Append(Mextent + 1);
|
|
||||||
|
|
||||||
myIsDone = Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : InitBlock
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_BlockBuilder::InitBlock()
|
|
||||||
{
|
|
||||||
myBlockIndex = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : MoreBlock
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_BlockBuilder::MoreBlock() const
|
|
||||||
{
|
|
||||||
// the length of myBlocks is 1 + number of connexity blocks
|
|
||||||
Standard_Integer l = myBlocks.Length();
|
|
||||||
Standard_Boolean b = (myBlockIndex < l);
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NextBlock
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_BlockBuilder::NextBlock()
|
|
||||||
{
|
|
||||||
myBlockIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BlockIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_BlockIterator BOP_BlockBuilder::BlockIterator() const
|
|
||||||
{
|
|
||||||
Standard_Integer lower, upper;
|
|
||||||
|
|
||||||
lower = myBlocks(myBlockIndex);
|
|
||||||
upper = myBlocks(myBlockIndex+1)-1;
|
|
||||||
|
|
||||||
return BOP_BlockIterator(lower,upper);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Element
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const TopoDS_Shape& BOP_BlockBuilder::Element (const BOP_BlockIterator& BI) const
|
|
||||||
{
|
|
||||||
Standard_Boolean isbound = BI.More();
|
|
||||||
if (!isbound) {
|
|
||||||
Standard_Failure::Raise("OutOfRange");
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer index = BI.Value();
|
|
||||||
const TopoDS_Shape& E = myOrientedShapeMap(index);
|
|
||||||
return E;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Element
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const TopoDS_Shape& BOP_BlockBuilder::Element (const Standard_Integer index) const
|
|
||||||
{
|
|
||||||
Standard_Boolean isbound = myOrientedShapeMapIsValid.IsBound(index);
|
|
||||||
if (!isbound) {
|
|
||||||
Standard_Failure::Raise("OutOfRange");
|
|
||||||
}
|
|
||||||
const TopoDS_Shape& E = myOrientedShapeMap(index);
|
|
||||||
return E;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Element
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_BlockBuilder::Element (const TopoDS_Shape& E) const
|
|
||||||
{
|
|
||||||
Standard_Boolean isbound = myOrientedShapeMap.Contains(E);
|
|
||||||
if (!isbound) {
|
|
||||||
Standard_Failure::Raise("OutOfRange");
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer I = myOrientedShapeMap.FindIndex(E);
|
|
||||||
return I;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ElementIsValid
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_BlockBuilder::ElementIsValid (const BOP_BlockIterator& BI) const
|
|
||||||
{
|
|
||||||
Standard_Boolean isvalid, isbound = BI.More();
|
|
||||||
if (!isbound) {
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
Standard_Integer Sindex, isb;
|
|
||||||
|
|
||||||
Sindex = BI.Value();
|
|
||||||
isb = myOrientedShapeMapIsValid.Find(Sindex);
|
|
||||||
isvalid = (isb == 1)? Standard_True: Standard_False;
|
|
||||||
|
|
||||||
return isvalid;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : ElementIsValid
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_BlockBuilder::ElementIsValid (const Standard_Integer Sindex) const
|
|
||||||
{
|
|
||||||
Standard_Boolean isvalid, isbound = myOrientedShapeMapIsValid.IsBound(Sindex);
|
|
||||||
if (!isbound) return Standard_False;
|
|
||||||
|
|
||||||
Standard_Integer isb = myOrientedShapeMapIsValid.Find(Sindex);
|
|
||||||
isvalid = (isb == 1)? Standard_True: Standard_False;
|
|
||||||
|
|
||||||
return isvalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddElement
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_BlockBuilder::AddElement(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
Standard_Integer Sindex = myOrientedShapeMap.Add(S);
|
|
||||||
myOrientedShapeMapIsValid.Bind(Sindex, 1);
|
|
||||||
|
|
||||||
return Sindex;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetValid
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_BlockBuilder::SetValid(const BOP_BlockIterator& BI,
|
|
||||||
const Standard_Boolean isvalid)
|
|
||||||
{
|
|
||||||
Standard_Boolean isbound = BI.More();
|
|
||||||
if (!isbound) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Standard_Integer Sindex, i;
|
|
||||||
Sindex = BI.Value();
|
|
||||||
i = (isvalid) ? 1 : 0;
|
|
||||||
myOrientedShapeMapIsValid.Bind(Sindex,i);
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetValid
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_BlockBuilder::SetValid(const Standard_Integer Sindex,
|
|
||||||
const Standard_Boolean isvalid)
|
|
||||||
{
|
|
||||||
Standard_Boolean isbound = myOrientedShapeMapIsValid.IsBound(Sindex);
|
|
||||||
if (!isbound) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer i = (isvalid) ? 1 : 0;
|
|
||||||
myOrientedShapeMapIsValid.Bind(Sindex,i);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : CurrentBlockIsRegular
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_BlockBuilder::CurrentBlockIsRegular()
|
|
||||||
{
|
|
||||||
Standard_Boolean b = Standard_False;
|
|
||||||
Standard_Integer i = myBlocksIsRegular.Value(myBlockIndex);
|
|
||||||
|
|
||||||
if(i == 1) {
|
|
||||||
b = Standard_True;
|
|
||||||
}
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,86 +0,0 @@
|
|||||||
-- Created on: 1993-02-25
|
|
||||||
-- Created by: Jean Yves LEBEY
|
|
||||||
-- Copyright (c) 1993-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 BlockIterator from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
|
|
||||||
-- Auxiliary class to provide
|
|
||||||
-- simple iteration on indexes that
|
|
||||||
-- belongs to the integer range [Lower,Upper]
|
|
||||||
-- with increment =1
|
|
||||||
|
|
||||||
raises
|
|
||||||
|
|
||||||
NoMoreObject from Standard
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns BlockIterator from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty Constructor
|
|
||||||
---
|
|
||||||
Create(Lower,Upper : Integer from Standard)
|
|
||||||
returns BlockIterator from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Creates an object with initial range
|
|
||||||
--- of [Lower,Upper]
|
|
||||||
---
|
|
||||||
|
|
||||||
Initialize(me : in out)
|
|
||||||
is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Initialize an object with initial range
|
|
||||||
--- of [Lower,Upper]
|
|
||||||
---
|
|
||||||
More(me)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Support of Iteration
|
|
||||||
---
|
|
||||||
Next(me : in out)
|
|
||||||
raises NoMoreObject
|
|
||||||
is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Support of Iteration
|
|
||||||
---
|
|
||||||
Value(me)
|
|
||||||
returns Integer from Standard
|
|
||||||
is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Support of Iteration
|
|
||||||
---
|
|
||||||
Extent(me)
|
|
||||||
returns Integer from Standard
|
|
||||||
is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Returns the extension=myUpper - myLower + 1;
|
|
||||||
---
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myLower : Integer from Standard;
|
|
||||||
myUpper : Integer from Standard;
|
|
||||||
myValue : Integer from Standard;
|
|
||||||
|
|
||||||
end BlockIterator;
|
|
@ -1,92 +0,0 @@
|
|||||||
// Created on: 1993-03-23
|
|
||||||
// Created by: Jean Yves LEBEY
|
|
||||||
// Copyright (c) 1993-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.
|
|
||||||
|
|
||||||
|
|
||||||
#include <BOP_BlockIterator.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_BlockIterator::BOP_BlockIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_BlockIterator::BOP_BlockIterator()
|
|
||||||
:
|
|
||||||
myLower(0),
|
|
||||||
myUpper(0),
|
|
||||||
myValue(1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_BlockIterator::BOP_BlockIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_BlockIterator::BOP_BlockIterator(const Standard_Integer Lower,
|
|
||||||
const Standard_Integer Upper)
|
|
||||||
:
|
|
||||||
myLower(Lower),
|
|
||||||
myUpper(Upper),
|
|
||||||
myValue(Lower)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_BlockIterator::Initialize()
|
|
||||||
{
|
|
||||||
myValue = myLower;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_BlockIterator::More() const
|
|
||||||
{
|
|
||||||
Standard_Boolean b = (myValue <= myUpper);
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_BlockIterator::Next()
|
|
||||||
{
|
|
||||||
myValue++;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_BlockIterator::Value() const
|
|
||||||
{
|
|
||||||
return myValue;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Extent
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_BlockIterator::Extent() const
|
|
||||||
{
|
|
||||||
if (myLower != 0) {
|
|
||||||
Standard_Integer n = myUpper - myLower + 1;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,217 +0,0 @@
|
|||||||
-- Created on: 2001-03-29
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
deferred class Builder from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
|
|
||||||
-- The Root class to perform a Boolean Operations (BO)
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
Shape from TopoDS,
|
|
||||||
Operation from BOP,
|
|
||||||
HistoryCollector from BOP,
|
|
||||||
ShapeEnum from TopAbs,
|
|
||||||
DSFiller from BOPTools,
|
|
||||||
PDSFiller from BOPTools,
|
|
||||||
|
|
||||||
IndexedDataMapOfShapeListOfShape from TopTools,
|
|
||||||
ListOfShape from TopTools,
|
|
||||||
IndexedMapOfShape from TopTools
|
|
||||||
|
|
||||||
--raises
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Initialize
|
|
||||||
returns Builder from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
SetShapes (me:out;
|
|
||||||
aS1: Shape from TopoDS;
|
|
||||||
aS2: Shape from TopoDS);
|
|
||||||
---Purpose:
|
|
||||||
-- Set shapes (arguments) to perform BO
|
|
||||||
---
|
|
||||||
SetOperation (me:out;
|
|
||||||
anOp:Operation from BOP);
|
|
||||||
---Purpose:
|
|
||||||
-- Set type of the BO to perform
|
|
||||||
--
|
|
||||||
SetManifoldFlag (me:out;
|
|
||||||
aFlag:Boolean from Standard);
|
|
||||||
---Purpose: Set the flag to allow the result
|
|
||||||
-- be manifold or non-manifold (not used)
|
|
||||||
--
|
|
||||||
Shape1 (me)
|
|
||||||
returns Shape from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
-- Selector
|
|
||||||
--
|
|
||||||
Shape2 (me)
|
|
||||||
returns Shape from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
-- Selector
|
|
||||||
--
|
|
||||||
Operation (me)
|
|
||||||
returns Operation from BOP;
|
|
||||||
---Purpose:
|
|
||||||
-- Selector
|
|
||||||
--
|
|
||||||
ManifoldFlag(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
-- Selector
|
|
||||||
--
|
|
||||||
IsDone(me)
|
|
||||||
returns Boolean from Standard ;
|
|
||||||
---Purpose:
|
|
||||||
-- Selector
|
|
||||||
--
|
|
||||||
ErrorStatus (me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose:
|
|
||||||
-- Selector
|
|
||||||
--
|
|
||||||
Result(me)
|
|
||||||
returns Shape from TopoDS ;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
-- Returns the result of the BO
|
|
||||||
--
|
|
||||||
Do (me:out)
|
|
||||||
is virtual;
|
|
||||||
---Purpose:
|
|
||||||
-- Does the BO from the beggining to the end,
|
|
||||||
-- i.e. create new DataStructure, DSFiller,
|
|
||||||
-- compute all interferences, compute states,
|
|
||||||
-- build result etc
|
|
||||||
--
|
|
||||||
DoWithFiller (me:out;
|
|
||||||
aDSF: DSFiller from BOPTools)
|
|
||||||
is virtual;
|
|
||||||
---Purpose:
|
|
||||||
-- Does the BO using existing Filler to the end
|
|
||||||
--
|
|
||||||
BuildResult (me:out)
|
|
||||||
is virtual;
|
|
||||||
---Purpose:
|
|
||||||
-- Constructs the final result of the BO
|
|
||||||
--
|
|
||||||
Destroy (me: in out)
|
|
||||||
is virtual;
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_Builder(){Destroy();}"
|
|
||||||
---Purpose:
|
|
||||||
-- Destructor
|
|
||||||
--
|
|
||||||
SortTypes (myclass;
|
|
||||||
aType1:out ShapeEnum from TopAbs;
|
|
||||||
aType2:out ShapeEnum from TopAbs);
|
|
||||||
---Purpose:
|
|
||||||
-- Sort types of shapes as integers in increasing order
|
|
||||||
--
|
|
||||||
Modified (me;
|
|
||||||
aS : Shape from TopoDS)
|
|
||||||
returns ListOfShape from TopTools;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
-- Returns the list of shapes modified from the shape aS
|
|
||||||
--
|
|
||||||
IsDeleted(me;
|
|
||||||
aS : Shape from TopoDS)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
-- Returns TRUE if the result does not contain the shape aS
|
|
||||||
--
|
|
||||||
FillModified(me:out)
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
-- Fill the list of shapes modified from the shape aS.
|
|
||||||
-- For Internal usage
|
|
||||||
--
|
|
||||||
FillModified(me:out;
|
|
||||||
aS : Shape from TopoDS;
|
|
||||||
aL : ListOfShape from TopTools)
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
-- Fill the list of shapes modified from the shape aS.
|
|
||||||
-- For Internal usage
|
|
||||||
--
|
|
||||||
FillModified(me:out;
|
|
||||||
aE : Shape from TopoDS;
|
|
||||||
aSp: Shape from TopoDS)
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
-- Fill the list of shapes modified from the shape aS
|
|
||||||
-- For Internal usage
|
|
||||||
--
|
|
||||||
SectionEdges (me)
|
|
||||||
returns ListOfShape from TopTools;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
-- Returns the list of shapes that are parts of BO "Section"
|
|
||||||
-- for given arguments.
|
|
||||||
-- For Internal usage
|
|
||||||
--
|
|
||||||
|
|
||||||
SetHistoryCollector(me: in out; theHistory: HistoryCollector from BOP)
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
GetHistoryCollector(me)
|
|
||||||
returns HistoryCollector from BOP;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myShape1 : Shape from TopoDS
|
|
||||||
is protected;
|
|
||||||
myShape2 : Shape from TopoDS
|
|
||||||
is protected;
|
|
||||||
myOperation : Operation from BOP
|
|
||||||
is protected;
|
|
||||||
myManifoldFlag : Boolean from Standard
|
|
||||||
is protected;
|
|
||||||
myIsDone : Boolean from Standard
|
|
||||||
is protected;
|
|
||||||
myErrorStatus : Integer from Standard
|
|
||||||
is protected;
|
|
||||||
myResult : Shape from TopoDS
|
|
||||||
is protected;
|
|
||||||
myDraw : Integer from Standard
|
|
||||||
is protected;
|
|
||||||
myDSFiller : PDSFiller from BOPTools
|
|
||||||
is protected;
|
|
||||||
myResultMap : IndexedMapOfShape from TopTools
|
|
||||||
is protected;
|
|
||||||
myModifiedMap : IndexedDataMapOfShapeListOfShape from TopTools
|
|
||||||
is protected;
|
|
||||||
myEmptyList : ListOfShape from TopTools
|
|
||||||
is protected;
|
|
||||||
mySectionEdges : ListOfShape from TopTools
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
myHistory: HistoryCollector from BOP
|
|
||||||
is protected;
|
|
||||||
end Builder;
|
|
||||||
|
|
@ -1,390 +0,0 @@
|
|||||||
// Created on: 2001-03-29
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2001-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 <BOP_Builder.ixx>
|
|
||||||
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_SplitShapesPool.hxx>
|
|
||||||
#include <BOPTools_CommonBlockPool.hxx>
|
|
||||||
#include <BOPTools_ListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_ListOfCommonBlock.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
|
|
||||||
#include <BOPTools_CommonBlock.hxx>
|
|
||||||
#include <BOPTools_PaveBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_Builder::BOP_Builder
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_Builder::BOP_Builder()
|
|
||||||
: myOperation(BOP_UNKNOWN),
|
|
||||||
myManifoldFlag(Standard_False),
|
|
||||||
myIsDone(Standard_False),
|
|
||||||
myErrorStatus(1),
|
|
||||||
myDraw(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Destroy
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Builder::Destroy()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetShapes
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Builder::SetShapes (const TopoDS_Shape& aS1,
|
|
||||||
const TopoDS_Shape& aS2)
|
|
||||||
{
|
|
||||||
myShape1=aS1;
|
|
||||||
myShape2=aS2;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetOperation
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Builder::SetOperation (const BOP_Operation anOp)
|
|
||||||
{
|
|
||||||
myOperation=anOp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetManifoldFlag
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Builder::SetManifoldFlag (const Standard_Boolean aFlag)
|
|
||||||
{
|
|
||||||
myManifoldFlag=aFlag;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Shape1
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
const TopoDS_Shape& BOP_Builder::Shape1()const
|
|
||||||
{
|
|
||||||
return myShape1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: Shape2
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
const TopoDS_Shape& BOP_Builder::Shape2()const
|
|
||||||
{
|
|
||||||
return myShape2;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Operation
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_Operation BOP_Builder::Operation () const
|
|
||||||
{
|
|
||||||
return myOperation;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: ManifoldFlag
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_Builder::ManifoldFlag () const
|
|
||||||
{
|
|
||||||
return myManifoldFlag;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: IsDone
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_Builder::IsDone() const
|
|
||||||
{
|
|
||||||
return myIsDone;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: ErrorStatus
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_Builder::ErrorStatus() const
|
|
||||||
{
|
|
||||||
return myErrorStatus;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Result
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
const TopoDS_Shape& BOP_Builder::Result()const
|
|
||||||
{
|
|
||||||
return myResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: Do
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Builder::Do()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoDoWithFiller
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Builder::DoWithFiller(const BOPTools_DSFiller& )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BuildResult
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Builder::BuildResult()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//=======================================================================
|
|
||||||
// function: FillModified
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Builder::FillModified()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Prepare myResultMap
|
|
||||||
myResultMap.Clear();
|
|
||||||
TopExp::MapShapes(myResult, TopAbs_FACE, myResultMap);
|
|
||||||
TopExp::MapShapes(myResult, TopAbs_EDGE, myResultMap);
|
|
||||||
//
|
|
||||||
// Fill Modified for Edges
|
|
||||||
Standard_Integer i, aNbSources, aNbPaveBlocks, nSp, nFace;
|
|
||||||
//
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
const BOPTools_SplitShapesPool& aSplitShapesPool= myDSFiller->SplitShapesPool();
|
|
||||||
const BOPTools_CommonBlockPool& aCommonBlockPool= myDSFiller->CommonBlockPool();
|
|
||||||
//
|
|
||||||
aNbSources=aDS.NumberOfSourceShapes();
|
|
||||||
for (i=1; i<=aNbSources; i++) {
|
|
||||||
|
|
||||||
if (aDS.GetShapeType(i) != TopAbs_EDGE){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
const TopoDS_Shape& aE=aDS.Shape(i);
|
|
||||||
//
|
|
||||||
const BOPTools_ListOfPaveBlock& aSplitEdges=aSplitShapesPool(aDS.RefEdge(i));
|
|
||||||
const BOPTools_ListOfCommonBlock& aCBlocks =aCommonBlockPool(aDS.RefEdge(i));
|
|
||||||
//
|
|
||||||
aNbPaveBlocks=aSplitEdges.Extent();
|
|
||||||
if (!aNbPaveBlocks) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
TopTools_IndexedMapOfShape aM;
|
|
||||||
|
|
||||||
BOPTools_ListIteratorOfListOfCommonBlock aCBIt(aCBlocks);
|
|
||||||
for (; aCBIt.More(); aCBIt.Next()) {
|
|
||||||
BOPTools_CommonBlock& aCB=aCBIt.Value();
|
|
||||||
//
|
|
||||||
nFace=aCB.Face();
|
|
||||||
//
|
|
||||||
if (nFace) {
|
|
||||||
BOPTools_PaveBlock& aPB=aCB.PaveBlock1(i);
|
|
||||||
nSp=aPB.Edge();
|
|
||||||
const TopoDS_Shape& aSp=aDS.Shape(nSp);
|
|
||||||
//
|
|
||||||
if (aM.Contains(aSp)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
aM.Add(aSp);
|
|
||||||
//
|
|
||||||
if (myResultMap.Contains(aSp)) {
|
|
||||||
FillModified(aE, aSp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
else {
|
|
||||||
const BOPTools_PaveBlock& aPB=aCB.PaveBlock1();
|
|
||||||
nSp=aPB.Edge();
|
|
||||||
const TopoDS_Shape& aSp=aDS.Shape(nSp);
|
|
||||||
//
|
|
||||||
if (aM.Contains(aSp)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
aM.Add(aSp);
|
|
||||||
//
|
|
||||||
if (myResultMap.Contains(aSp)) {
|
|
||||||
FillModified(aE, aSp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // for (; aCBIt.More(); aCBIt.Next())
|
|
||||||
|
|
||||||
|
|
||||||
BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges);
|
|
||||||
for (; aPBIt.More(); aPBIt.Next()) {
|
|
||||||
const BOPTools_PaveBlock& aPB=aPBIt.Value();
|
|
||||||
nSp=aPB.Edge();
|
|
||||||
const TopoDS_Shape& aSp=aDS.Shape(nSp);
|
|
||||||
//
|
|
||||||
if (aM.Contains(aSp)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
aM.Add(aSp);
|
|
||||||
//
|
|
||||||
if (myResultMap.Contains(aSp)) {
|
|
||||||
FillModified(aE, aSp);
|
|
||||||
}
|
|
||||||
}// for (; aPBIt.More(); aPBIt.Next())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: FillModified
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Builder::FillModified(const TopoDS_Shape& aE,
|
|
||||||
const TopoDS_Shape& aSp)
|
|
||||||
{
|
|
||||||
if (myModifiedMap.Contains(aE)) {
|
|
||||||
TopTools_ListOfShape& aLM=myModifiedMap.ChangeFromKey(aE);
|
|
||||||
aLM.Append(aSp);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape aLM;
|
|
||||||
aLM.Append(aSp);
|
|
||||||
myModifiedMap.Add(aE, aLM);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: FillModified
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Builder::FillModified(const TopoDS_Shape& aS,
|
|
||||||
const TopTools_ListOfShape& aLFx)
|
|
||||||
{
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aLFx);
|
|
||||||
//
|
|
||||||
if (myModifiedMap.Contains(aS)) {
|
|
||||||
TopTools_ListOfShape& aLM=myModifiedMap.ChangeFromKey(aS);
|
|
||||||
anIt.Initialize(aLFx);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& aFx=anIt.Value();
|
|
||||||
aLM.Append(aFx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape aLM;
|
|
||||||
anIt.Initialize(aLFx);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& aFx=anIt.Value();
|
|
||||||
aLM.Append(aFx);
|
|
||||||
}
|
|
||||||
myModifiedMap.Add(aS, aLM);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Modified
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
const TopTools_ListOfShape& BOP_Builder::Modified(const TopoDS_Shape& aS)const
|
|
||||||
{
|
|
||||||
if (myModifiedMap.Contains(aS)) {
|
|
||||||
const TopTools_ListOfShape& aLM=myModifiedMap.FindFromKey(aS);
|
|
||||||
return aLM;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return myEmptyList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: IsDeleted
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_Builder::IsDeleted(const TopoDS_Shape& aS)const
|
|
||||||
{
|
|
||||||
Standard_Boolean bFlag=Standard_False;
|
|
||||||
//
|
|
||||||
if (myResultMap.Contains(aS)) {
|
|
||||||
return bFlag;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
const TopTools_ListOfShape& aLM=Modified(aS);
|
|
||||||
if (aLM.Extent()) {
|
|
||||||
return bFlag;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
return !bFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : SortTypes
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Builder::SortTypes(TopAbs_ShapeEnum& aType1,
|
|
||||||
TopAbs_ShapeEnum& aType2)
|
|
||||||
{
|
|
||||||
Standard_Integer iT1, iT2;
|
|
||||||
|
|
||||||
if (aType1==aType2)
|
|
||||||
return;
|
|
||||||
|
|
||||||
iT1=(Standard_Integer) aType1;
|
|
||||||
iT2=(Standard_Integer) aType2;
|
|
||||||
|
|
||||||
if (iT1 < iT2) {
|
|
||||||
aType1=(TopAbs_ShapeEnum) iT2;
|
|
||||||
aType2=(TopAbs_ShapeEnum) iT1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: SectionEdges
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
const TopTools_ListOfShape& BOP_Builder::SectionEdges()const
|
|
||||||
{
|
|
||||||
return mySectionEdges;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetHistoryCollector
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Builder::SetHistoryCollector(const Handle(BOP_HistoryCollector)& theHistory)
|
|
||||||
{
|
|
||||||
myHistory = theHistory;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: GetHistoryCollector
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Handle(BOP_HistoryCollector) BOP_Builder::GetHistoryCollector() const
|
|
||||||
{
|
|
||||||
return myHistory;
|
|
||||||
}
|
|
@ -1,105 +0,0 @@
|
|||||||
-- Created on: 2001-11-02
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 BuilderTools from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
-- Some handy tools used by classes
|
|
||||||
-- BOP_ShellShell,
|
|
||||||
-- BOP_ShellSolid,
|
|
||||||
-- BOP_SolidSolid
|
|
||||||
-- to build a result
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
IndexedMapOfInteger from TColStd,
|
|
||||||
|
|
||||||
State from TopAbs,
|
|
||||||
ShapeEnum from TopAbs,
|
|
||||||
|
|
||||||
Face from TopoDS,
|
|
||||||
Edge from TopoDS,
|
|
||||||
|
|
||||||
ListOfShape from TopTools,
|
|
||||||
|
|
||||||
StateOfShape from BooleanOperations,
|
|
||||||
|
|
||||||
IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd,
|
|
||||||
|
|
||||||
CArray1OfSSInterference from BOPTools,
|
|
||||||
|
|
||||||
Operation from BOP,
|
|
||||||
ListOfConnexityBlock from BOP
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
StateToCompare(myclass;
|
|
||||||
iRank :Integer from Standard;
|
|
||||||
anOp :Operation from BOP)
|
|
||||||
returns StateOfShape from BooleanOperations;
|
|
||||||
|
|
||||||
ToReverseSection(myclass;
|
|
||||||
iRank :Integer from Standard;
|
|
||||||
anOp :Operation from BOP)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
ToReverseFace(myclass;
|
|
||||||
iRank :Integer from Standard;
|
|
||||||
anOp :Operation from BOP)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
OrientSectionEdgeOnF1(myclass;
|
|
||||||
aF1 :Face from TopoDS;
|
|
||||||
aF2 :Face from TopoDS;
|
|
||||||
iRank :Integer from Standard;
|
|
||||||
anOp :Operation from BOP;
|
|
||||||
aE :out Edge from TopoDS);
|
|
||||||
|
|
||||||
IsSameDomainFaceWithF1(myclass;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
nF2 :Integer from Standard;
|
|
||||||
aFFM:IndexedMapOfInteger from TColStd;
|
|
||||||
aFFs:out CArray1OfSSInterference from BOPTools)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
IsPartIN2DToKeep(myclass;
|
|
||||||
aSt :State from TopAbs;
|
|
||||||
iRank :Integer from Standard;
|
|
||||||
anOp :Operation from BOP)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
IsPartOn2dToKeep(myclass;
|
|
||||||
aSt :State from TopAbs;
|
|
||||||
iRank :Integer from Standard;
|
|
||||||
anOp :Operation from BOP)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
DoMap(myclass;
|
|
||||||
aFFs :out CArray1OfSSInterference from BOPTools;
|
|
||||||
aFFMap:out IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd);
|
|
||||||
|
|
||||||
MakeConnexityBlocks(myclass;
|
|
||||||
aLE : ListOfShape from TopTools;
|
|
||||||
aType : ShapeEnum from TopAbs;
|
|
||||||
aLConBlks : out ListOfConnexityBlock from BOP);
|
|
||||||
|
|
||||||
end BuilderTools;
|
|
@ -1,427 +0,0 @@
|
|||||||
// Created on: 2001-11-02
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2001-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 <BOP_BuilderTools.ixx>
|
|
||||||
|
|
||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
|
||||||
|
|
||||||
#include <gp_Dir.hxx>
|
|
||||||
|
|
||||||
#include <BRepAdaptor_Surface.hxx>
|
|
||||||
#include <GeomAbs_SurfaceType.hxx>
|
|
||||||
|
|
||||||
#include <TopAbs_State.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
|
|
||||||
#include <TopTools_ListOfShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfOrientedShape.hxx>
|
|
||||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
|
|
||||||
#include <BooleanOperations_StateOfShape.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_Tools3D.hxx>
|
|
||||||
#include <BOPTools_SSInterference.hxx>
|
|
||||||
|
|
||||||
#include <BOP_ConnexityBlock.hxx>
|
|
||||||
#include <BOP_ListOfConnexityBlock.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: StateToCompare
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BooleanOperations_StateOfShape
|
|
||||||
BOP_BuilderTools::StateToCompare(const Standard_Integer iRank,
|
|
||||||
const BOP_Operation anOp)
|
|
||||||
{
|
|
||||||
BooleanOperations_StateOfShape aSt=BooleanOperations_UNKNOWN;
|
|
||||||
|
|
||||||
if (iRank==1) {
|
|
||||||
if (anOp==BOP_COMMON) {
|
|
||||||
aSt=BooleanOperations_IN;
|
|
||||||
}
|
|
||||||
if (anOp==BOP_FUSE) {
|
|
||||||
aSt=BooleanOperations_OUT;
|
|
||||||
}
|
|
||||||
if (anOp==BOP_CUT) {
|
|
||||||
aSt=BooleanOperations_OUT;
|
|
||||||
}
|
|
||||||
if (anOp==BOP_CUT21) {
|
|
||||||
aSt=BooleanOperations_IN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iRank==2) {
|
|
||||||
if (anOp==BOP_COMMON) {
|
|
||||||
aSt=BooleanOperations_IN;
|
|
||||||
}
|
|
||||||
if (anOp==BOP_FUSE) {
|
|
||||||
aSt=BooleanOperations_OUT;
|
|
||||||
}
|
|
||||||
if (anOp==BOP_CUT) {
|
|
||||||
aSt=BooleanOperations_IN;
|
|
||||||
}
|
|
||||||
if (anOp==BOP_CUT21) {
|
|
||||||
aSt=BooleanOperations_OUT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return aSt;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: ToReverseSection
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_BuilderTools::ToReverseSection(const Standard_Integer iRank,
|
|
||||||
const BOP_Operation anOp)
|
|
||||||
{
|
|
||||||
Standard_Boolean bFlag=Standard_False;
|
|
||||||
|
|
||||||
if (iRank==1) {
|
|
||||||
if (anOp==BOP_FUSE || anOp==BOP_CUT) {
|
|
||||||
bFlag=Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iRank==2) {
|
|
||||||
if (anOp==BOP_FUSE || anOp==BOP_CUT21) {
|
|
||||||
bFlag=Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bFlag;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: ToReverseFace
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_BuilderTools::ToReverseFace(const Standard_Integer iRank,
|
|
||||||
const BOP_Operation anOp)
|
|
||||||
{
|
|
||||||
Standard_Boolean bFlag=Standard_False;
|
|
||||||
|
|
||||||
if (iRank==1) {
|
|
||||||
if (anOp==BOP_CUT21) {
|
|
||||||
bFlag=Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iRank==2) {
|
|
||||||
if (anOp==BOP_CUT) {
|
|
||||||
bFlag=Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: OrientSectionEdgeOnF1
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_BuilderTools::OrientSectionEdgeOnF1(const TopoDS_Face& aF1,
|
|
||||||
const TopoDS_Face& aF2,
|
|
||||||
const Standard_Integer iRankF1,
|
|
||||||
const BOP_Operation anOperation,
|
|
||||||
TopoDS_Edge& aE)
|
|
||||||
{
|
|
||||||
TopAbs_Orientation anOr;
|
|
||||||
Standard_Boolean bToReverseSection;
|
|
||||||
|
|
||||||
anOr=BOPTools_Tools3D::EdgeOrientation(aE, aF1, aF2);
|
|
||||||
aE.Orientation(anOr);
|
|
||||||
bToReverseSection=BOP_BuilderTools::ToReverseSection(iRankF1, anOperation);
|
|
||||||
if (bToReverseSection) {
|
|
||||||
aE.Reverse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: IsSameDomainFaceWithF1
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean
|
|
||||||
BOP_BuilderTools::IsSameDomainFaceWithF1(const Standard_Integer nF1,
|
|
||||||
const Standard_Integer nF2,
|
|
||||||
const TColStd_IndexedMapOfInteger& aFFIndicesMap,
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs)
|
|
||||||
{
|
|
||||||
Standard_Boolean bIsSDF, bYes;
|
|
||||||
Standard_Integer j, aNbj, iFFx, nFx;
|
|
||||||
|
|
||||||
bYes=Standard_False;
|
|
||||||
aNbj=aFFIndicesMap.Extent();
|
|
||||||
|
|
||||||
for (j=1; j<=aNbj; j++) {
|
|
||||||
iFFx=aFFIndicesMap(j);
|
|
||||||
BOPTools_SSInterference& aFFx=aFFs(iFFx);
|
|
||||||
bIsSDF=aFFx.IsTangentFaces();
|
|
||||||
if (bIsSDF) {
|
|
||||||
nFx=aFFx.OppositeIndex(nF1);
|
|
||||||
if (nFx==nF2) {
|
|
||||||
return !bYes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bYes;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: IsPartIN2DToKeep
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean
|
|
||||||
BOP_BuilderTools::IsPartIN2DToKeep(const TopAbs_State aST1,
|
|
||||||
const Standard_Integer iRankF1,
|
|
||||||
const BOP_Operation anOp)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
Standard_Boolean bRetFlag= (aST1==TopAbs_OUT);
|
|
||||||
//
|
|
||||||
// Same oriented
|
|
||||||
if (bRetFlag) {
|
|
||||||
if (anOp==BOP_CUT && iRankF1==2) {
|
|
||||||
return !bRetFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anOp==BOP_CUT21 && iRankF1==1) {
|
|
||||||
return !bRetFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anOp==BOP_COMMON && iRankF1==2) {
|
|
||||||
return !bRetFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anOp==BOP_COMMON && iRankF1==1) {
|
|
||||||
return !bRetFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bRetFlag;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Different oriented
|
|
||||||
else if (!bRetFlag) {
|
|
||||||
if (anOp==BOP_FUSE) {
|
|
||||||
return bRetFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anOp==BOP_CUT && iRankF1==1) {
|
|
||||||
return bRetFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anOp==BOP_CUT21 && iRankF1==2) {
|
|
||||||
return bRetFlag;
|
|
||||||
}
|
|
||||||
return !bRetFlag;
|
|
||||||
}
|
|
||||||
return !bRetFlag;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: IsPartOn2dToKeep
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean
|
|
||||||
BOP_BuilderTools::IsPartOn2dToKeep(const TopAbs_State aST1,
|
|
||||||
const Standard_Integer iRankF1,
|
|
||||||
const BOP_Operation anOp)
|
|
||||||
{
|
|
||||||
Standard_Boolean bRetFlag=Standard_False;
|
|
||||||
//
|
|
||||||
// 1 OUT
|
|
||||||
if (aST1==TopAbs_OUT) {
|
|
||||||
if (anOp==BOP_FUSE) {
|
|
||||||
bRetFlag=Standard_True;
|
|
||||||
}
|
|
||||||
if (iRankF1==1) {
|
|
||||||
if (anOp==BOP_CUT) {
|
|
||||||
bRetFlag=Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (iRankF1==2) {
|
|
||||||
if (anOp==BOP_CUT21) {
|
|
||||||
bRetFlag=Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// 2 IN
|
|
||||||
if (aST1==TopAbs_IN) {
|
|
||||||
if (anOp==BOP_COMMON) {
|
|
||||||
bRetFlag=Standard_True;
|
|
||||||
}
|
|
||||||
if (iRankF1==2) {
|
|
||||||
if (anOp==BOP_CUT) {
|
|
||||||
bRetFlag=Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (iRankF1==1) {
|
|
||||||
if (anOp==BOP_CUT21) {
|
|
||||||
bRetFlag=Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bRetFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoMap
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_BuilderTools::DoMap
|
|
||||||
(BOPTools_CArray1OfSSInterference& aFFs,
|
|
||||||
BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aFFMap)
|
|
||||||
{
|
|
||||||
Standard_Integer i, aNb, nF1, nF2;
|
|
||||||
//
|
|
||||||
// Intersection Map for Faces
|
|
||||||
|
|
||||||
aFFMap.Clear();
|
|
||||||
TColStd_IndexedMapOfInteger aFFIndices;
|
|
||||||
|
|
||||||
aNb=aFFs.Extent();
|
|
||||||
for (i=1; i<=aNb; i++) {
|
|
||||||
BOPTools_SSInterference& aFF=aFFs(i);
|
|
||||||
// Faces
|
|
||||||
nF1=aFF.Index1();
|
|
||||||
nF2=aFF.Index2();
|
|
||||||
// nF1
|
|
||||||
if (!aFFMap.Contains(nF1)) {
|
|
||||||
aFFIndices.Clear();
|
|
||||||
aFFIndices.Add(i);
|
|
||||||
aFFMap.Add(nF1, aFFIndices);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TColStd_IndexedMapOfInteger& aMF=aFFMap.ChangeFromKey(nF1);
|
|
||||||
aMF.Add(i);
|
|
||||||
}
|
|
||||||
// nF2
|
|
||||||
if (!aFFMap.Contains(nF2)) {
|
|
||||||
aFFIndices.Clear();
|
|
||||||
aFFIndices.Add(i);
|
|
||||||
aFFMap.Add(nF2, aFFIndices);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TColStd_IndexedMapOfInteger& aMF=aFFMap.ChangeFromKey(nF2);
|
|
||||||
aMF.Add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//
|
|
||||||
static
|
|
||||||
void Pathx(const TopoDS_Shape& aVx,
|
|
||||||
const TopoDS_Shape& aEx,
|
|
||||||
const TopAbs_ShapeEnum aType2,
|
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape& aVEMap,
|
|
||||||
TopTools_IndexedMapOfOrientedShape& aProcessedEdges,
|
|
||||||
TopTools_IndexedMapOfOrientedShape& aCBMap);
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: MakeConnexityBlocks
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_BuilderTools::MakeConnexityBlocks(const TopTools_ListOfShape& aLEIn,
|
|
||||||
const TopAbs_ShapeEnum aType,
|
|
||||||
BOP_ListOfConnexityBlock& aLConBlks)
|
|
||||||
{
|
|
||||||
Standard_Integer i, aNbV, aNbE;
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aVEMap;
|
|
||||||
TopTools_IndexedMapOfOrientedShape aProcessedEdges, aCBMap;
|
|
||||||
TopAbs_ShapeEnum aType2;
|
|
||||||
//
|
|
||||||
if (aType==TopAbs_EDGE) {
|
|
||||||
aType2=TopAbs_VERTEX;
|
|
||||||
}
|
|
||||||
else if (aType==TopAbs_FACE) {
|
|
||||||
aType2=TopAbs_EDGE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aLEIn);
|
|
||||||
//
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& aE=anIt.Value();
|
|
||||||
TopExp::MapShapesAndAncestors(aE, aType2, aType, aVEMap);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aNbV=aVEMap.Extent();
|
|
||||||
for (i=1; i<=aNbV; i++) {
|
|
||||||
aCBMap.Clear();
|
|
||||||
|
|
||||||
const TopoDS_Shape& aV=aVEMap.FindKey(i);
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& aLE=aVEMap(i);
|
|
||||||
anIt.Initialize(aLE);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& aE=anIt.Value();
|
|
||||||
if (!aProcessedEdges.Contains(aE)) {
|
|
||||||
aProcessedEdges.Add(aE);
|
|
||||||
aCBMap.Add(aE);
|
|
||||||
Pathx (aV, aE, aType2, aVEMap, aProcessedEdges, aCBMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
aNbE=aCBMap.Extent();
|
|
||||||
if (aNbE) {
|
|
||||||
BOP_ConnexityBlock aConnexityBlock;
|
|
||||||
aConnexityBlock.SetShapes(aCBMap);
|
|
||||||
aLConBlks.Append(aConnexityBlock);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: Pathx
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void Pathx(const TopoDS_Shape& aVx,
|
|
||||||
const TopoDS_Shape& aEx,
|
|
||||||
const TopAbs_ShapeEnum aType2,
|
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape& aVEMap,
|
|
||||||
TopTools_IndexedMapOfOrientedShape& aProcessedEdges,
|
|
||||||
TopTools_IndexedMapOfOrientedShape& aCBMap)
|
|
||||||
{
|
|
||||||
TopExp_Explorer anExp(aEx, aType2);
|
|
||||||
for (; anExp.More(); anExp.Next()){
|
|
||||||
const TopoDS_Shape& aV=anExp.Current();
|
|
||||||
|
|
||||||
if (aV.IsSame(aVx)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& aLE=aVEMap.FindFromKey(aV);
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aLE);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& aE=anIt.Value();
|
|
||||||
if (!aProcessedEdges.Contains(aE)) {
|
|
||||||
aProcessedEdges.Add(aE);
|
|
||||||
aCBMap.Add(aE);
|
|
||||||
|
|
||||||
Pathx (aV, aE, aType2, aVEMap, aProcessedEdges, aCBMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,103 +0,0 @@
|
|||||||
-- Created on: 1996-01-05
|
|
||||||
-- Created by: Jean Yves LEBEY
|
|
||||||
-- Copyright (c) 1996-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.
|
|
||||||
|
|
||||||
|
|
||||||
deferred class CompositeClassifier from BOP inherits LoopClassifier from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
-- The Root class for algorithms
|
|
||||||
-- to classify composite Loops, i.e, Loops that
|
|
||||||
-- can be either a Shape, or a block of Elements.
|
|
||||||
--
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
ShapeEnum from TopAbs,
|
|
||||||
Shape from TopoDS,
|
|
||||||
State from TopAbs,
|
|
||||||
|
|
||||||
Loop from BOP,
|
|
||||||
BlockBuilder from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Initialize(BB : BlockBuilder from BOP);
|
|
||||||
---Purpose:
|
|
||||||
--- Initializing the object with BlockBuilder;
|
|
||||||
---
|
|
||||||
Compare(me :out;
|
|
||||||
L1 : Loop from BOP;
|
|
||||||
L2 : Loop from BOP)
|
|
||||||
returns State from TopAbs
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- Classify loop <L1> with <L2>
|
|
||||||
---
|
|
||||||
CompareShapes(me :out;
|
|
||||||
B1 : Shape from TopoDS;
|
|
||||||
B2 : Shape from TopoDS)
|
|
||||||
---Purpose:
|
|
||||||
--- Classify shape <B1> with shape <B2>
|
|
||||||
---
|
|
||||||
returns State from TopAbs
|
|
||||||
is deferred;
|
|
||||||
|
|
||||||
CompareElementToShape(me :out;
|
|
||||||
E : Shape from TopoDS;
|
|
||||||
B : Shape from TopoDS)
|
|
||||||
returns State from TopAbs
|
|
||||||
is deferred;
|
|
||||||
---Purpose:
|
|
||||||
--- Classify element <E> with shape <B>
|
|
||||||
---
|
|
||||||
ResetShape(me :out;
|
|
||||||
B : Shape from TopoDS)
|
|
||||||
is deferred;
|
|
||||||
---Purpose:
|
|
||||||
--- Prepare classification involving shape <B>
|
|
||||||
--- Calls ResetElement on first element of <B>
|
|
||||||
---
|
|
||||||
|
|
||||||
ResetElement(me :out;
|
|
||||||
E : Shape from TopoDS)
|
|
||||||
is deferred;
|
|
||||||
---Purpose:
|
|
||||||
--- Prepare classification involving element <E>.
|
|
||||||
---
|
|
||||||
CompareElement(me :out;
|
|
||||||
E : Shape from TopoDS)
|
|
||||||
is deferred;
|
|
||||||
---Purpose:
|
|
||||||
--- Add element <E> in the set of elements used in classification.
|
|
||||||
---
|
|
||||||
State(me :out)
|
|
||||||
returns State from TopAbs
|
|
||||||
is deferred;
|
|
||||||
---Purpose:
|
|
||||||
--- Returns state of classification of 2D point, defined by
|
|
||||||
--- ResetElement, with the current set of elements,
|
|
||||||
--- defined by Compare.
|
|
||||||
---
|
|
||||||
fields
|
|
||||||
|
|
||||||
myBlockBuilder : Address
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
end CompositeClassifier;
|
|
@ -1,111 +0,0 @@
|
|||||||
// Created on: 1996-01-05
|
|
||||||
// Created by: Jean Yves LEBEY
|
|
||||||
// Copyright (c) 1996-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.
|
|
||||||
|
|
||||||
|
|
||||||
#include <BOP_CompositeClassifier.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_CompositeClassifier::BOP_CompositeClassifier
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_CompositeClassifier::BOP_CompositeClassifier (const BOP_BlockBuilder& BB)
|
|
||||||
:
|
|
||||||
myBlockBuilder((void*)&BB)
|
|
||||||
{}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Compare
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
TopAbs_State BOP_CompositeClassifier::Compare(const Handle(BOP_Loop)& L1,
|
|
||||||
const Handle(BOP_Loop)& L2)
|
|
||||||
{
|
|
||||||
TopAbs_State state = TopAbs_UNKNOWN;
|
|
||||||
|
|
||||||
Standard_Boolean isshape1, isshape2, yena1 ;
|
|
||||||
|
|
||||||
isshape1 = L1->IsShape();
|
|
||||||
isshape2 = L2->IsShape();
|
|
||||||
|
|
||||||
if ( isshape2 && isshape1 ) {
|
|
||||||
// L1 is Shape , L2 is Shape
|
|
||||||
const TopoDS_Shape& s1 = L1->Shape();
|
|
||||||
const TopoDS_Shape& s2 = L2->Shape();
|
|
||||||
state = CompareShapes(s1,s2);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ( isshape2 && !isshape1 ) {
|
|
||||||
// L1 is Block , L2 is Shape
|
|
||||||
BOP_BlockIterator Bit1 = L1->BlockIterator();
|
|
||||||
Bit1.Initialize();
|
|
||||||
yena1 = Bit1.More();
|
|
||||||
while (yena1) {
|
|
||||||
const TopoDS_Shape& s1 =
|
|
||||||
((BOP_BlockBuilder*)myBlockBuilder)->Element(Bit1);
|
|
||||||
const TopoDS_Shape& s2 = L2->Shape();
|
|
||||||
|
|
||||||
state = CompareElementToShape(s1,s2);
|
|
||||||
yena1 = Standard_False;
|
|
||||||
if (state == TopAbs_UNKNOWN) {
|
|
||||||
if (Bit1.More()) Bit1.Next();
|
|
||||||
yena1 = Bit1.More();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( !isshape2 && isshape1 ) {
|
|
||||||
// L1 is Shape , L2 is Block
|
|
||||||
const TopoDS_Shape& s1 = L1->Shape();
|
|
||||||
|
|
||||||
ResetShape(s1);
|
|
||||||
BOP_BlockIterator Bit2 = L2->BlockIterator();
|
|
||||||
for (Bit2.Initialize(); Bit2.More(); Bit2.Next()) {
|
|
||||||
const TopoDS_Shape& s2 =
|
|
||||||
((BOP_BlockBuilder*)myBlockBuilder)->Element(Bit2);
|
|
||||||
CompareElement(s2);
|
|
||||||
}
|
|
||||||
state = State();
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ( !isshape2 && !isshape1 ) {
|
|
||||||
// L1 is Block , L2 is Block
|
|
||||||
BOP_BlockIterator Bit1 = L1->BlockIterator();
|
|
||||||
Bit1.Initialize();
|
|
||||||
yena1 = Bit1.More();
|
|
||||||
while (yena1) {
|
|
||||||
const TopoDS_Shape& s1 =
|
|
||||||
((BOP_BlockBuilder*)myBlockBuilder)->Element(Bit1);
|
|
||||||
|
|
||||||
ResetElement(s1);
|
|
||||||
BOP_BlockIterator Bit2 = L2->BlockIterator();
|
|
||||||
for (Bit2.Initialize(); Bit2.More(); Bit2.Next()) {
|
|
||||||
const TopoDS_Shape& s2 =
|
|
||||||
((BOP_BlockBuilder*)myBlockBuilder)->Element(Bit2);
|
|
||||||
CompareElement(s2);
|
|
||||||
}
|
|
||||||
|
|
||||||
state = State();
|
|
||||||
yena1 = Standard_False;
|
|
||||||
if (state == TopAbs_UNKNOWN) {
|
|
||||||
if (Bit1.More()) Bit1.Next();
|
|
||||||
yena1 = Bit1.More();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
-- Created on: 2001-04-13
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 ConnexityBlock from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- Auxiliary class to store data about set
|
|
||||||
--- of connex shapes
|
|
||||||
---
|
|
||||||
|
|
||||||
uses
|
|
||||||
ListOfShape from TopTools,
|
|
||||||
IndexedMapOfOrientedShape from TopTools
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns ConnexityBlock from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
SetShapes (me:out;
|
|
||||||
anEdges: ListOfShape from TopTools);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetShapes (me:out;
|
|
||||||
nEdges: IndexedMapOfOrientedShape from TopTools);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetRegularity(me:out;
|
|
||||||
aFlag:Boolean from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
Shapes (me)
|
|
||||||
returns ListOfShape from TopTools;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
IsRegular(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
--- Returns TRUE if all elements in the block are
|
|
||||||
--- biconnexity
|
|
||||||
---
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myRegularity : Boolean from Standard;
|
|
||||||
myShapes : ListOfShape from TopTools;
|
|
||||||
|
|
||||||
end ConnexityBlock;
|
|
@ -1,89 +0,0 @@
|
|||||||
// Created on: 2001-04-13
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2001-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 <BOP_ConnexityBlock.ixx>
|
|
||||||
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_ConnexityBlock::BOP_ConnexityBlock
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_ConnexityBlock::BOP_ConnexityBlock()
|
|
||||||
:
|
|
||||||
myRegularity(Standard_False)
|
|
||||||
{}
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetRegularity
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ConnexityBlock::SetRegularity (const Standard_Boolean aFlag)
|
|
||||||
{
|
|
||||||
myRegularity=aFlag;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: IsRegular
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_ConnexityBlock::IsRegular ()const
|
|
||||||
{
|
|
||||||
return myRegularity;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetShapes
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ConnexityBlock::SetShapes(const TopTools_ListOfShape& anEdges)
|
|
||||||
{
|
|
||||||
myShapes.Clear();
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(anEdges);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& anE=anIt.Value();
|
|
||||||
myShapes.Append(anE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetShapes
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ConnexityBlock::SetShapes(const TopTools_IndexedMapOfOrientedShape& anEdges)
|
|
||||||
{
|
|
||||||
myShapes.Clear();
|
|
||||||
Standard_Integer i, aNb;
|
|
||||||
|
|
||||||
aNb=anEdges.Extent();
|
|
||||||
for (i=1; i<=aNb; i++) {
|
|
||||||
const TopoDS_Shape& anE=anEdges(i);
|
|
||||||
myShapes.Append(anE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: Shapes
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
const TopTools_ListOfShape& BOP_ConnexityBlock::Shapes()const
|
|
||||||
{
|
|
||||||
return myShapes;
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
-- Created on: 2001-04-17
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 CorrectTolerances from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- The Set of static functions to provide valid values of
|
|
||||||
--- tolerances for shapes.
|
|
||||||
--- Tolerances becomes valid in terms of the checkshape.
|
|
||||||
|
|
||||||
uses
|
|
||||||
Shape from TopoDS
|
|
||||||
|
|
||||||
is
|
|
||||||
CorrectTolerances (myclass;
|
|
||||||
aS: Shape from TopoDS;
|
|
||||||
aTolMax: Real from Standard =0.0001);
|
|
||||||
---Purpose:
|
|
||||||
--- Provides valid values of tolerances for the shape <aS>
|
|
||||||
--- <aTolMax> is max value of the tolerance that can be
|
|
||||||
--- accepted for correction. If real value of the tolerance
|
|
||||||
--- will be greater than <aTolMax>, the correction does not
|
|
||||||
--- perform.
|
|
||||||
---
|
|
||||||
CorrectCurveOnSurface (myclass;
|
|
||||||
aS: Shape from TopoDS;
|
|
||||||
aTolMax: Real from Standard =0.0001);
|
|
||||||
---Purpose:
|
|
||||||
--- Provides valid values of tolerances for the shape <aS>
|
|
||||||
--- in terms of BRepCheck_InvalidCurveOnSurface.
|
|
||||||
---
|
|
||||||
CorrectPointOnCurve (myclass;
|
|
||||||
aS: Shape from TopoDS;
|
|
||||||
aTolMax: Real from Standard =0.0001);
|
|
||||||
---Purpose:
|
|
||||||
--- Provides valid values of tolerances for the shape <aS>
|
|
||||||
--- in terms of BRepCheck_InvalidPointOnCurve.
|
|
||||||
---
|
|
||||||
|
|
||||||
end CorrectTolerances;
|
|
@ -1,593 +0,0 @@
|
|||||||
// Created on: 2001-04-17
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2001-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 <BOP_CorrectTolerances.ixx>
|
|
||||||
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
#include <TopoDS_Vertex.hxx>
|
|
||||||
#include <TopoDS_Face.hxx>
|
|
||||||
|
|
||||||
#include <TopLoc_Location.hxx>
|
|
||||||
|
|
||||||
#include <BRep_TVertex.hxx>
|
|
||||||
#include <BRep_TEdge.hxx>
|
|
||||||
#include <BRep_TFace.hxx>
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
#include <BRep_GCurve.hxx>
|
|
||||||
#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
|
|
||||||
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
|
|
||||||
#include <BRep_CurveRepresentation.hxx>
|
|
||||||
#include <BRep_PointRepresentation.hxx>
|
|
||||||
|
|
||||||
#include <Geom_Curve.hxx>
|
|
||||||
#include <Geom_Surface.hxx>
|
|
||||||
#include <Geom_Plane.hxx>
|
|
||||||
#include <Geom_TrimmedCurve.hxx>
|
|
||||||
|
|
||||||
#include <GeomAdaptor_Curve.hxx>
|
|
||||||
#include <GeomAdaptor_HCurve.hxx>
|
|
||||||
#include <GeomAdaptor_HSurface.hxx>
|
|
||||||
|
|
||||||
#include <Geom2d_Curve.hxx>
|
|
||||||
|
|
||||||
#include <Geom2dAdaptor_HCurve.hxx>
|
|
||||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
|
||||||
#include <Geom2dAdaptor.hxx>
|
|
||||||
#include <GeomProjLib.hxx>
|
|
||||||
|
|
||||||
#include <ProjLib_ProjectedCurve.hxx>
|
|
||||||
#include <Extrema_LocateExtPC.hxx>
|
|
||||||
|
|
||||||
#include <gp_Pnt.hxx>
|
|
||||||
|
|
||||||
#include <Adaptor3d_HCurve.hxx>
|
|
||||||
#include <Adaptor3d_CurveOnSurface.hxx>
|
|
||||||
#include <Adaptor3d_HCurveOnSurface.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
void CheckEdge (const TopoDS_Edge& E,
|
|
||||||
const Standard_Real aMaxTol);
|
|
||||||
static
|
|
||||||
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
|
||||||
const TopoDS_Face& S,
|
|
||||||
const Standard_Real aMaxTol);
|
|
||||||
static
|
|
||||||
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
|
|
||||||
const Adaptor3d_Curve& Other,
|
|
||||||
const Standard_Real Tol,
|
|
||||||
const Standard_Boolean SameParameter,
|
|
||||||
Standard_Real& aNewTolerance);
|
|
||||||
|
|
||||||
//
|
|
||||||
static
|
|
||||||
void CorrectVertexTolerance(const TopoDS_Edge& aE);
|
|
||||||
//
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// Function : CorrectTolerances
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_CorrectTolerances::CorrectTolerances(const TopoDS_Shape& aShape,
|
|
||||||
const Standard_Real aMaxTol)
|
|
||||||
{
|
|
||||||
BOP_CorrectTolerances::CorrectPointOnCurve(aShape, aMaxTol);
|
|
||||||
BOP_CorrectTolerances::CorrectCurveOnSurface(aShape, aMaxTol);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// Function : CorrectPointOnCurve
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_CorrectTolerances::CorrectPointOnCurve(const TopoDS_Shape& S,
|
|
||||||
const Standard_Real aMaxTol)
|
|
||||||
{
|
|
||||||
Standard_Integer i, aNb;
|
|
||||||
TopTools_IndexedMapOfShape Edges;
|
|
||||||
TopExp::MapShapes (S, TopAbs_EDGE, Edges);
|
|
||||||
aNb=Edges.Extent();
|
|
||||||
for (i=1; i<=aNb; i++) {
|
|
||||||
const TopoDS_Edge& E= TopoDS::Edge(Edges(i));
|
|
||||||
CheckEdge(E, aMaxTol);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// Function : CorrectCurveOnSurface
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_CorrectTolerances::CorrectCurveOnSurface(const TopoDS_Shape& S,
|
|
||||||
const Standard_Real aMaxTol)
|
|
||||||
{
|
|
||||||
Standard_Integer i, aNbFaces, j, aNbEdges;
|
|
||||||
TopTools_IndexedMapOfShape Faces;
|
|
||||||
TopExp::MapShapes (S, TopAbs_FACE, Faces);
|
|
||||||
|
|
||||||
aNbFaces=Faces.Extent();
|
|
||||||
for (i=1; i<=aNbFaces; i++) {
|
|
||||||
const TopoDS_Face& F= TopoDS::Face(Faces(i));
|
|
||||||
TopTools_IndexedMapOfShape Edges;
|
|
||||||
TopExp::MapShapes (F, TopAbs_EDGE, Edges);
|
|
||||||
aNbEdges=Edges.Extent();
|
|
||||||
for (j=1; j<=aNbEdges; j++) {
|
|
||||||
const TopoDS_Edge& E= TopoDS::Edge(Edges(j));
|
|
||||||
CorrectEdgeTolerance (E, F, aMaxTol);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// Function : CorrectEdgeTolerance
|
|
||||||
// purpose : Correct tolerances for Edge
|
|
||||||
//=======================================================================
|
|
||||||
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
|
||||||
const TopoDS_Face& S,
|
|
||||||
const Standard_Real aMaxTol)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// 1. Minimum of conditions to Perform
|
|
||||||
Handle (BRep_CurveRepresentation) myCref;
|
|
||||||
Handle (Adaptor3d_HCurve) myHCurve;
|
|
||||||
|
|
||||||
myCref.Nullify();
|
|
||||||
|
|
||||||
Handle(BRep_TEdge)& TEx = *((Handle(BRep_TEdge)*)&myShape.TShape());
|
|
||||||
BRep_ListIteratorOfListOfCurveRepresentation itcrx(TEx->Curves());
|
|
||||||
Standard_Boolean Degenerated, SameParameterx, SameRangex;
|
|
||||||
|
|
||||||
Standard_Integer unique = 0;
|
|
||||||
|
|
||||||
Degenerated = TEx->Degenerated();
|
|
||||||
SameParameterx = TEx->SameParameter();
|
|
||||||
SameRangex = TEx->SameRange();
|
|
||||||
|
|
||||||
if (!SameRangex && SameParameterx) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(Geom_Curve) C3d;
|
|
||||||
while (itcrx.More()) {
|
|
||||||
const Handle(BRep_CurveRepresentation)& cr = itcrx.Value();
|
|
||||||
if (cr->IsCurve3D()) {
|
|
||||||
unique++;
|
|
||||||
if (myCref.IsNull() && !cr->Curve3D().IsNull()) {
|
|
||||||
myCref = cr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
itcrx.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unique==0) {
|
|
||||||
return;//...No3DCurve
|
|
||||||
}
|
|
||||||
if (unique>1) {
|
|
||||||
return;//...Multiple3DCurve;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myCref.IsNull() && !Degenerated) {
|
|
||||||
itcrx.Initialize(TEx->Curves());
|
|
||||||
while (itcrx.More()) {
|
|
||||||
const Handle(BRep_CurveRepresentation)& cr = itcrx.Value();
|
|
||||||
if (cr->IsCurveOnSurface()) {
|
|
||||||
myCref = cr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
itcrx.Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (!myCref.IsNull() && Degenerated){
|
|
||||||
return ;//...InvalidDegeneratedFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!myCref.IsNull()) {
|
|
||||||
const Handle(BRep_GCurve)& GCref = *((Handle(BRep_GCurve)*)&myCref);
|
|
||||||
Standard_Real First,Last;
|
|
||||||
GCref->Range(First,Last);
|
|
||||||
if (Last<=First) {
|
|
||||||
myCref.Nullify();
|
|
||||||
return ;//InvalidRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
if (myCref->IsCurve3D()) {
|
|
||||||
Handle(Geom_Curve) C3dx = Handle(Geom_Curve)::DownCast
|
|
||||||
(myCref->Curve3D()->Transformed (myCref->Location().Transformation()));
|
|
||||||
GeomAdaptor_Curve GAC3d(C3dx, First, Last);
|
|
||||||
myHCurve = new GeomAdaptor_HCurve(GAC3d);
|
|
||||||
}
|
|
||||||
else { // curve on surface
|
|
||||||
Handle(Geom_Surface) Sref = myCref->Surface();
|
|
||||||
Sref = Handle(Geom_Surface)::DownCast(Sref->Transformed(myCref->Location().Transformation()));
|
|
||||||
const Handle(Geom2d_Curve)& PCref = myCref->PCurve();
|
|
||||||
Handle(GeomAdaptor_HSurface) GAHSref = new GeomAdaptor_HSurface(Sref);
|
|
||||||
Handle(Geom2dAdaptor_HCurve) GHPCref = new Geom2dAdaptor_HCurve(PCref, First, Last);
|
|
||||||
Adaptor3d_CurveOnSurface ACSref(GHPCref,GAHSref);
|
|
||||||
myHCurve = new Adaptor3d_HCurveOnSurface(ACSref);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//===============================================
|
|
||||||
// 2. Tolerances in InContext
|
|
||||||
{
|
|
||||||
if (myCref.IsNull())
|
|
||||||
return;
|
|
||||||
Standard_Boolean ok=Standard_True;;
|
|
||||||
|
|
||||||
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*)&myShape.TShape());
|
|
||||||
Standard_Real Tol = BRep_Tool::Tolerance(TopoDS::Edge(myShape));
|
|
||||||
Standard_Real aNewTol=Tol;
|
|
||||||
|
|
||||||
Standard_Boolean SameParameter = TE->SameParameter();
|
|
||||||
Standard_Boolean SameRange = TE->SameRange();
|
|
||||||
Standard_Real First = myHCurve->FirstParameter();
|
|
||||||
Standard_Real Last = myHCurve->LastParameter();
|
|
||||||
Standard_Real Delta =1.e-14;
|
|
||||||
|
|
||||||
Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &S.TShape());
|
|
||||||
const TopLoc_Location& Floc = S.Location();
|
|
||||||
const TopLoc_Location& TFloc = TF->Location();
|
|
||||||
const Handle(Geom_Surface)& Su = TF->Surface();
|
|
||||||
TopLoc_Location L = (Floc * TFloc).Predivided(myShape.Location());
|
|
||||||
// Standard_Boolean checkclosed = Standard_False;
|
|
||||||
Standard_Boolean pcurvefound = Standard_False;
|
|
||||||
|
|
||||||
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
|
|
||||||
while (itcr.More()) {
|
|
||||||
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
|
||||||
if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
|
|
||||||
pcurvefound = Standard_True;
|
|
||||||
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
|
|
||||||
Standard_Real f,l;
|
|
||||||
GC->Range(f,l);
|
|
||||||
if (SameRange && (f != First || l != Last)) {
|
|
||||||
return ;//BRepCheck_InvalidSameRangeFlag);
|
|
||||||
if (SameParameter) {
|
|
||||||
return; //BRepCheck_InvalidSameParameterFlag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(Geom_Surface) Sb = cr->Surface();
|
|
||||||
Sb = Handle(Geom_Surface)::DownCast (Su->Transformed(L.Transformation()));
|
|
||||||
Handle(Geom2d_Curve) PC = cr->PCurve();
|
|
||||||
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(Sb);
|
|
||||||
Handle(Geom2dAdaptor_HCurve) GHPC = new Geom2dAdaptor_HCurve(PC,f,l);
|
|
||||||
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
|
|
||||||
ok = Validate(myHCurve->Curve(), ACS, Tol, SameParameter, aNewTol);
|
|
||||||
if (ok) {
|
|
||||||
if (cr->IsCurveOnClosedSurface()) {
|
|
||||||
//return ;// BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
|
|
||||||
}
|
|
||||||
if (SameParameter) {
|
|
||||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (aNewTol<aMaxTol) {
|
|
||||||
TE->UpdateTolerance(aNewTol+Delta);
|
|
||||||
//
|
|
||||||
CorrectVertexTolerance(myShape);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cr->IsCurveOnClosedSurface()) {
|
|
||||||
// checkclosed = Standard_True;
|
|
||||||
GHPC->ChangeCurve2d().Load(cr->PCurve2(),f,l); // same bounds
|
|
||||||
ACS.Load(GAHS); // sans doute inutile
|
|
||||||
ACS.Load(GHPC); // meme remarque...
|
|
||||||
ok = Validate(myHCurve->Curve(),ACS,Tol,SameParameter, aNewTol);
|
|
||||||
if (ok) {
|
|
||||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
|
|
||||||
if (SameParameter) {
|
|
||||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
|
|
||||||
}
|
|
||||||
if (aNewTol<aMaxTol) {
|
|
||||||
TE->UpdateTolerance(aNewTol+Delta);
|
|
||||||
CorrectVertexTolerance(myShape);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
itcr.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pcurvefound) {
|
|
||||||
Handle(Geom_Plane) P;
|
|
||||||
Handle(Standard_Type) styp = Su->DynamicType();
|
|
||||||
if (styp == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
|
|
||||||
P = Handle(Geom_Plane)::DownCast(Handle(Geom_RectangularTrimmedSurface)::
|
|
||||||
DownCast(Su)->BasisSurface());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
P = Handle(Geom_Plane)::DownCast(Su);
|
|
||||||
}
|
|
||||||
if (P.IsNull()) { // not a plane
|
|
||||||
return;//BRepCheck::Add(lst,BRepCheck_NoCurveOnSurface);
|
|
||||||
}
|
|
||||||
|
|
||||||
else {// on fait la projection a la volee, comme BRep_Tool
|
|
||||||
P = Handle(Geom_Plane)::DownCast(P->Transformed(L.Transformation()));
|
|
||||||
//on projette Cref sur ce plan
|
|
||||||
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(P);
|
|
||||||
|
|
||||||
// Dub - Normalement myHCurve est une GeomAdaptor_HCurve
|
|
||||||
GeomAdaptor_Curve& Gac = Handle(GeomAdaptor_HCurve)::DownCast(myHCurve)->ChangeCurve();
|
|
||||||
Handle(Geom_Curve) C3dx = Gac.Curve();
|
|
||||||
Handle(Geom_Curve) ProjOnPlane = GeomProjLib::ProjectOnPlane
|
|
||||||
(new Geom_TrimmedCurve(C3dx,First,Last), P, P->Position().Direction(), Standard_True);
|
|
||||||
|
|
||||||
Handle(GeomAdaptor_HCurve) aHCurve = new GeomAdaptor_HCurve(ProjOnPlane);
|
|
||||||
|
|
||||||
ProjLib_ProjectedCurve proj(GAHS,aHCurve);
|
|
||||||
Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
|
|
||||||
Handle(Geom2dAdaptor_HCurve) GHPC =
|
|
||||||
new Geom2dAdaptor_HCurve(PC, myHCurve->FirstParameter(), myHCurve->LastParameter());
|
|
||||||
|
|
||||||
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
|
|
||||||
|
|
||||||
Standard_Boolean okx = Validate(myHCurve->Curve(),ACS,
|
|
||||||
Tol,Standard_True, aNewTol); // voir dub...
|
|
||||||
if (okx) {
|
|
||||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
|
|
||||||
if (aNewTol<aMaxTol) {
|
|
||||||
TE->UpdateTolerance(aNewTol+Delta);
|
|
||||||
CorrectVertexTolerance(myShape);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}//end of if (!pcurvefound) {
|
|
||||||
} // end of 2. Tolerances in InContext
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : CorrectVertexTolerance
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void CorrectVertexTolerance(const TopoDS_Edge& aE)
|
|
||||||
{
|
|
||||||
Standard_Integer k, aNbV;
|
|
||||||
Standard_Real aTolE, aTolV;
|
|
||||||
TopTools_IndexedMapOfShape aVMap;
|
|
||||||
|
|
||||||
aTolE=BRep_Tool::Tolerance(aE);
|
|
||||||
|
|
||||||
TopExp::MapShapes(aE, TopAbs_VERTEX, aVMap);
|
|
||||||
aNbV=aVMap.Extent();
|
|
||||||
for (k=1; k<=aNbV; ++k) {
|
|
||||||
const TopoDS_Vertex& aV=TopoDS::Vertex(aVMap(k));
|
|
||||||
aTolV=BRep_Tool::Tolerance(aV);
|
|
||||||
if (aTolV<aTolE) {
|
|
||||||
Handle(BRep_TVertex)& aTV = *((Handle(BRep_TVertex)*)&aV.TShape());
|
|
||||||
aTV->UpdateTolerance(aTolE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define NCONTROL 23
|
|
||||||
//=======================================================================
|
|
||||||
//function : Validate
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
|
|
||||||
const Adaptor3d_Curve& Other,
|
|
||||||
const Standard_Real Tol,
|
|
||||||
const Standard_Boolean SameParameter,
|
|
||||||
Standard_Real& aNewTolerance)
|
|
||||||
{
|
|
||||||
Standard_Real First, Last, MaxDistance, aD, Tol2;
|
|
||||||
|
|
||||||
First = CRef.FirstParameter();
|
|
||||||
Last = CRef.LastParameter();
|
|
||||||
MaxDistance = 0.;
|
|
||||||
Tol2 = Tol*Tol;
|
|
||||||
|
|
||||||
Standard_Integer i, aNC1=NCONTROL-1;
|
|
||||||
|
|
||||||
Standard_Boolean aFlag=Standard_False;
|
|
||||||
Standard_Boolean proj = (!SameParameter ||
|
|
||||||
First != Other.FirstParameter() ||
|
|
||||||
Last != Other.LastParameter());
|
|
||||||
//
|
|
||||||
// 1.
|
|
||||||
if (!proj) {
|
|
||||||
for (i = 0; i < NCONTROL; i++) {
|
|
||||||
Standard_Real prm = ((aNC1-i)*First + i*Last)/aNC1;
|
|
||||||
gp_Pnt pref = CRef.Value(prm);
|
|
||||||
gp_Pnt pother = Other.Value(prm);
|
|
||||||
|
|
||||||
aD=pref.SquareDistance(pother);
|
|
||||||
|
|
||||||
if (aD > Tol2) {
|
|
||||||
if (aD>MaxDistance) {
|
|
||||||
MaxDistance=aD;
|
|
||||||
}
|
|
||||||
aFlag=Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aFlag) {
|
|
||||||
aNewTolerance=sqrt(MaxDistance);
|
|
||||||
}
|
|
||||||
return aFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 2.
|
|
||||||
else {
|
|
||||||
Extrema_LocateExtPC refd,otherd;
|
|
||||||
Standard_Real OFirst, OLast;
|
|
||||||
OFirst = Other.FirstParameter();
|
|
||||||
OLast = Other.LastParameter();
|
|
||||||
|
|
||||||
gp_Pnt pd = CRef.Value(First);
|
|
||||||
gp_Pnt pdo = Other.Value(OFirst);
|
|
||||||
|
|
||||||
aD = pd.SquareDistance(pdo);
|
|
||||||
if (aD > Tol2) {
|
|
||||||
if (aD>MaxDistance) {
|
|
||||||
MaxDistance=aD;
|
|
||||||
}
|
|
||||||
aFlag=Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
pd = CRef.Value(Last);
|
|
||||||
pdo = Other.Value(OLast);
|
|
||||||
aD = pd.SquareDistance(pdo);
|
|
||||||
if (aD > Tol2 && aD > MaxDistance) {
|
|
||||||
MaxDistance=aD;
|
|
||||||
aFlag=Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
refd.Initialize(CRef, First, Last, CRef.Resolution(Tol));
|
|
||||||
otherd.Initialize(Other, OFirst, OLast, Other.Resolution(Tol));
|
|
||||||
|
|
||||||
for (i = 2; i< aNC1; i++) {
|
|
||||||
Standard_Real rprm = ((aNC1-i)*First + i*Last)/aNC1;
|
|
||||||
gp_Pnt pref = CRef.Value(rprm);
|
|
||||||
|
|
||||||
Standard_Real oprm = ((aNC1-i)*OFirst + i*OLast)/aNC1;
|
|
||||||
gp_Pnt pother = Other.Value(oprm);
|
|
||||||
|
|
||||||
refd.Perform(pother,rprm);
|
|
||||||
if (!refd.IsDone() || refd.SquareDistance() > Tol2) {
|
|
||||||
if (refd.IsDone()) {
|
|
||||||
aD=refd.SquareDistance();
|
|
||||||
if (aD > Tol2 && aD>MaxDistance) {
|
|
||||||
aFlag=Standard_True;
|
|
||||||
MaxDistance=aD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
otherd.Perform(pref,oprm);
|
|
||||||
if (!otherd.IsDone() || otherd.SquareDistance() > Tol2) {
|
|
||||||
|
|
||||||
if (otherd.IsDone()) {
|
|
||||||
aD=otherd.SquareDistance();
|
|
||||||
if (aD > Tol2 && aD>MaxDistance) {
|
|
||||||
aFlag=Standard_True;
|
|
||||||
MaxDistance=aD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
aD=sqrt (MaxDistance);
|
|
||||||
aNewTolerance=aD;
|
|
||||||
|
|
||||||
return aFlag;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// Function : CheckEdge
|
|
||||||
// purpose : Correct tolerances for Vertices on Edge
|
|
||||||
//=======================================================================
|
|
||||||
void CheckEdge (const TopoDS_Edge& Ed, const Standard_Real aMaxTol)
|
|
||||||
{
|
|
||||||
TopoDS_Edge E=Ed;
|
|
||||||
E.Orientation(TopAbs_FORWARD);
|
|
||||||
|
|
||||||
gp_Pnt Controlp;
|
|
||||||
|
|
||||||
TopExp_Explorer aVExp;
|
|
||||||
aVExp.Init(E, TopAbs_VERTEX);
|
|
||||||
for (; aVExp.More(); aVExp.Next()) {
|
|
||||||
TopoDS_Vertex aVertex= TopoDS::Vertex(aVExp.Current());
|
|
||||||
|
|
||||||
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &aVertex.TShape());
|
|
||||||
const gp_Pnt& prep = TV->Pnt();
|
|
||||||
|
|
||||||
Standard_Real Tol, aD2, aNewTolerance, dd;
|
|
||||||
|
|
||||||
Tol =BRep_Tool::Tolerance(aVertex);
|
|
||||||
Tol = Max(Tol, BRep_Tool::Tolerance(E));
|
|
||||||
dd=0.1*Tol;
|
|
||||||
Tol*=Tol;
|
|
||||||
|
|
||||||
const TopLoc_Location& Eloc = E.Location();
|
|
||||||
BRep_ListIteratorOfListOfPointRepresentation itpr;
|
|
||||||
|
|
||||||
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*)&E.TShape());
|
|
||||||
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
|
|
||||||
while (itcr.More()) {
|
|
||||||
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
|
||||||
const TopLoc_Location& loc = cr->Location();
|
|
||||||
TopLoc_Location L = (Eloc * loc).Predivided(aVertex.Location());
|
|
||||||
|
|
||||||
if (cr->IsCurve3D()) {
|
|
||||||
const Handle(Geom_Curve)& C = cr->Curve3D();
|
|
||||||
if (!C.IsNull()) {
|
|
||||||
itpr.Initialize(TV->Points());
|
|
||||||
while (itpr.More()) {
|
|
||||||
const Handle(BRep_PointRepresentation)& pr = itpr.Value();
|
|
||||||
if (pr->IsPointOnCurve(C,L)) {
|
|
||||||
Controlp = C->Value(pr->Parameter());
|
|
||||||
Controlp.Transform(L.Transformation());
|
|
||||||
aD2=prep.SquareDistance(Controlp);
|
|
||||||
if (aD2 > Tol) {
|
|
||||||
aNewTolerance=sqrt(aD2)+dd;
|
|
||||||
if (aNewTolerance<aMaxTol)
|
|
||||||
TV->UpdateTolerance(aNewTolerance);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
itpr.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
TopAbs_Orientation orv = aVertex.Orientation();
|
|
||||||
if (orv == TopAbs_FORWARD || orv == TopAbs_REVERSED) {
|
|
||||||
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
|
|
||||||
|
|
||||||
if (orv==TopAbs_FORWARD)
|
|
||||||
Controlp = C->Value(GC->First());
|
|
||||||
else
|
|
||||||
Controlp = C->Value(GC->Last());
|
|
||||||
|
|
||||||
Controlp.Transform(L.Transformation());
|
|
||||||
aD2=prep.SquareDistance(Controlp);
|
|
||||||
|
|
||||||
if (aD2 > Tol) {
|
|
||||||
aNewTolerance=sqrt(aD2)+dd;
|
|
||||||
if (aNewTolerance<aMaxTol)
|
|
||||||
TV->UpdateTolerance(aNewTolerance);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
itcr.Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
|||||||
-- Created on: 2001-05-31
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 Draw from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- auxiliary class to display intermediate results
|
|
||||||
--- in Draw's winowds for the debugging purposes
|
|
||||||
---
|
|
||||||
|
|
||||||
uses
|
|
||||||
ListOfShape from TopTools,
|
|
||||||
Face from TopoDS,
|
|
||||||
Edge from TopoDS
|
|
||||||
|
|
||||||
is
|
|
||||||
DrawListOfShape (myclass;
|
|
||||||
aList : ListOfShape from TopTools;
|
|
||||||
aName : CString from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Display in 3D-view shapes from the ListOfShape <aList>
|
|
||||||
--- aName is base name of shape. Actual name for each
|
|
||||||
--- subsequent shape will be aName+"_#", where
|
|
||||||
--- # - is ordered index of the shape in <aList>
|
|
||||||
---
|
|
||||||
DrawListOfEdgesWithPC (myclass;
|
|
||||||
aFace : Face from TopoDS;
|
|
||||||
aList : ListOfShape from TopTools;
|
|
||||||
aName : CString from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Display in 2D-view the edges from the ListOfShape <aList>,
|
|
||||||
--- that have P-curves for the face <aFace>
|
|
||||||
--- aName is base name of shape. Actual name for each
|
|
||||||
--- subsequent shape will be aName+"_#", where
|
|
||||||
--- # - is ordered index of the shape in <aList>
|
|
||||||
---
|
|
||||||
DrawListOfEdgesWithPC (myclass;
|
|
||||||
aFace : Face from TopoDS;
|
|
||||||
aList : ListOfShape from TopTools;
|
|
||||||
anInd : Integer from Standard;
|
|
||||||
aName : CString from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Display in 2D-view the edges from the ListOfShape <aList>,
|
|
||||||
--- that have P-curves for the face <aFace>
|
|
||||||
--- aName is base name of shape. Actual name for each
|
|
||||||
--- shape will be aName+"_anInd"
|
|
||||||
---
|
|
||||||
DrawEdgeWithPC (myclass;
|
|
||||||
aFace : Face from TopoDS;
|
|
||||||
aEdge : Edge from TopoDS;
|
|
||||||
aName : CString from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Display in 2D-view the edge,
|
|
||||||
--- that has P-curve for the face <aFace>
|
|
||||||
--- aName is the name of shape.
|
|
||||||
---
|
|
||||||
Wait(myclass);
|
|
||||||
---Purpose:
|
|
||||||
--- Wait for user's keystroke
|
|
||||||
---
|
|
||||||
|
|
||||||
end Draw;
|
|
@ -1,201 +0,0 @@
|
|||||||
// Created on: 2001-05-31
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2001-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 <BOP_Draw.ixx>
|
|
||||||
|
|
||||||
#ifdef BOPDRAW
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <TCollection_AsciiString.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
|
|
||||||
#include <Geom2d_Curve.hxx>
|
|
||||||
#include <Geom2d_TrimmedCurve.hxx>
|
|
||||||
|
|
||||||
#include <DBRep.hxx>
|
|
||||||
|
|
||||||
#include <DrawTrSurf.hxx>
|
|
||||||
#include <Draw_Color.hxx>
|
|
||||||
#include <Draw_Interpretor.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
Standard_IMPORT
|
|
||||||
Draw_Color DrawTrSurf_CurveColor(const Draw_Color col);
|
|
||||||
|
|
||||||
Standard_IMPORT
|
|
||||||
Draw_Color DBRep_ColorOrientation (const TopAbs_Orientation Or);
|
|
||||||
|
|
||||||
Standard_EXPORT
|
|
||||||
Draw_Interpretor theCommands;
|
|
||||||
//=======================================================================
|
|
||||||
// function: DrawListOfShape
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Draw::DrawListOfShape (const TopTools_ListOfShape& aListOfShape,
|
|
||||||
const Standard_CString aName)
|
|
||||||
|
|
||||||
{
|
|
||||||
Standard_Integer j;
|
|
||||||
TCollection_AsciiString aNm(aName);
|
|
||||||
|
|
||||||
j=aListOfShape.Extent();
|
|
||||||
if (!j) {
|
|
||||||
cout << " No shapes to draw" << flush;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aListOfShape);
|
|
||||||
for (j=1; anIt.More(); anIt.Next(), j++) {
|
|
||||||
const TopoDS_Shape& aEx=anIt.Value();
|
|
||||||
|
|
||||||
TCollection_AsciiString aN, jIndex(j);
|
|
||||||
aN=aNm+jIndex;
|
|
||||||
Standard_CString aTxt=aN.ToCString();
|
|
||||||
cout << aTxt << " " << flush;
|
|
||||||
DBRep::Set(aTxt, aEx);
|
|
||||||
}
|
|
||||||
cout << endl << flush;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: DrawListOfEdgesWithPC
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Draw::DrawListOfEdgesWithPC (const TopoDS_Face& aFace,
|
|
||||||
const TopTools_ListOfShape& aListOfShape,
|
|
||||||
const Standard_Integer i,
|
|
||||||
const Standard_CString cName)
|
|
||||||
|
|
||||||
{
|
|
||||||
theCommands.Eval("2dclear");
|
|
||||||
|
|
||||||
TCollection_AsciiString aName, aIndex(i), aUndscr("_"), aNm(cName);
|
|
||||||
aName=aName+aNm;
|
|
||||||
aName=aName+aIndex;
|
|
||||||
aName=aName+aUndscr;
|
|
||||||
Standard_CString aCString=aName.ToCString();
|
|
||||||
|
|
||||||
DrawListOfEdgesWithPC(aFace, aListOfShape, aCString);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: DrawListOfEdgesWithPC
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Draw::DrawListOfEdgesWithPC (const TopoDS_Face& aFace,
|
|
||||||
const TopTools_ListOfShape& aListOfShape,
|
|
||||||
const Standard_CString aName)
|
|
||||||
|
|
||||||
{
|
|
||||||
theCommands.Eval("2dclear");
|
|
||||||
|
|
||||||
Standard_Integer j;
|
|
||||||
TCollection_AsciiString aNm(aName);
|
|
||||||
|
|
||||||
j=aListOfShape.Extent();
|
|
||||||
if (!j) {
|
|
||||||
cout << " No shapes to draw" << flush;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aListOfShape);
|
|
||||||
for (j=1; anIt.More(); anIt.Next(), j++) {
|
|
||||||
const TopoDS_Edge& aEx=TopoDS::Edge(anIt.Value());
|
|
||||||
|
|
||||||
TCollection_AsciiString aN, jIndex(j);
|
|
||||||
aN=aNm+jIndex;
|
|
||||||
Standard_CString aTxt=aN.ToCString();
|
|
||||||
BOP_Draw::DrawEdgeWithPC(aFace, aEx, aTxt);
|
|
||||||
cout << " " << aTxt << flush;
|
|
||||||
}
|
|
||||||
|
|
||||||
theCommands.Eval("2dfit");
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: DrawEdgeWithPC
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Draw::DrawEdgeWithPC (const TopoDS_Face& aFace,
|
|
||||||
const TopoDS_Edge& aEdge,
|
|
||||||
const Standard_CString aName)
|
|
||||||
|
|
||||||
{
|
|
||||||
Standard_Real f,l;
|
|
||||||
|
|
||||||
// Edge 3D
|
|
||||||
DBRep::Set(aName, aEdge);
|
|
||||||
// PC
|
|
||||||
Draw_Color col, savecol;
|
|
||||||
savecol = DrawTrSurf_CurveColor(Draw_rouge);
|
|
||||||
|
|
||||||
const Handle(Geom2d_Curve) c =
|
|
||||||
BRep_Tool::CurveOnSurface (aEdge, aFace, f, l);
|
|
||||||
|
|
||||||
col = DBRep_ColorOrientation(aEdge.Orientation());
|
|
||||||
DrawTrSurf_CurveColor(col);
|
|
||||||
|
|
||||||
TCollection_AsciiString aNm(aName), aAdd("_p");
|
|
||||||
aNm=aNm+aAdd;
|
|
||||||
Standard_CString aTxtPC=aNm.ToCString();
|
|
||||||
|
|
||||||
DrawTrSurf::Set(aTxtPC, new Geom2d_TrimmedCurve(c, f, l));
|
|
||||||
|
|
||||||
DrawTrSurf_CurveColor(savecol);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: Wait
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Draw::Wait()
|
|
||||||
{
|
|
||||||
char xx;
|
|
||||||
scanf ("%c", &xx);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BOPDRAW
|
|
||||||
|
|
||||||
void BOP_Draw::DrawListOfShape (const TopTools_ListOfShape& ,
|
|
||||||
const Standard_CString ){}
|
|
||||||
void BOP_Draw::DrawListOfEdgesWithPC (const TopoDS_Face& ,
|
|
||||||
const TopTools_ListOfShape& ,
|
|
||||||
const Standard_Integer ,
|
|
||||||
const Standard_CString ){}
|
|
||||||
void BOP_Draw::DrawListOfEdgesWithPC (const TopoDS_Face& ,
|
|
||||||
const TopTools_ListOfShape& ,
|
|
||||||
const Standard_CString ){}
|
|
||||||
void BOP_Draw::DrawEdgeWithPC (const TopoDS_Face& ,
|
|
||||||
const TopoDS_Edge& ,
|
|
||||||
const Standard_CString ){}
|
|
||||||
void BOP_Draw::Wait(){}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
|||||||
-- Created on: 2001-04-09
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 EdgeInfo from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- The auxiliary class to store data about edges
|
|
||||||
--- that have common vertex
|
|
||||||
---
|
|
||||||
uses
|
|
||||||
Edge from TopoDS
|
|
||||||
|
|
||||||
--raises
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns EdgeInfo from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
SetEdge (me:out;
|
|
||||||
aE:Edge from TopoDS);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetPassed (me:out;
|
|
||||||
aFlag:Boolean from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetAngle (me:out;
|
|
||||||
anAngle:Real from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetInFlag (me:out;
|
|
||||||
aFlag:Boolean from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
Edge (me)
|
|
||||||
returns Edge from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
Passed (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
Angle (me)
|
|
||||||
returns Real from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
IsIn (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
fields
|
|
||||||
|
|
||||||
myEdge : Edge from TopoDS;
|
|
||||||
myPassed: Boolean from Standard;
|
|
||||||
myInFlag: Boolean from Standard;
|
|
||||||
myAngle : Real from Standard;
|
|
||||||
|
|
||||||
end EdgeInfo;
|
|
@ -1,67 +0,0 @@
|
|||||||
-- Created on: 2002-02-01
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2002-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 EmptyBuilder from BOP inherits Builder from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- Performs Boolean Operation (BO) for shapes
|
|
||||||
--- in cases when one of arguments(or both) is(are) empty
|
|
||||||
---
|
|
||||||
uses
|
|
||||||
DSFiller from BOPTools,
|
|
||||||
PDSFiller from BOPTools,
|
|
||||||
ListOfShape from TopTools
|
|
||||||
|
|
||||||
--raises
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns EmptyBuilder from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
Do (me:out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- see base classes, please
|
|
||||||
---
|
|
||||||
DoWithFiller (me:out;
|
|
||||||
aDSF: DSFiller from BOPTools)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- see base classes, please
|
|
||||||
---
|
|
||||||
Destroy (me: in out)
|
|
||||||
is redefined;
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_EmptyBuilder(){Destroy();}"
|
|
||||||
---Purpose:
|
|
||||||
--- Destructor
|
|
||||||
---
|
|
||||||
BuildResult (me:out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- see base classes, please
|
|
||||||
---
|
|
||||||
|
|
||||||
--fields
|
|
||||||
|
|
||||||
end EmptyBuilder;
|
|
||||||
|
|
@ -1,136 +0,0 @@
|
|||||||
// Created on: 2002-02-01
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2002-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 <BOP_EmptyBuilder.ixx>
|
|
||||||
|
|
||||||
#include <Standard_Failure.hxx>
|
|
||||||
#include <Standard_ErrorHandler.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS_Compound.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Builder.hxx>
|
|
||||||
|
|
||||||
#include <BOPTColStd_Dump.hxx>
|
|
||||||
#include <BOPTools_DSFiller.hxx>
|
|
||||||
#include <BOPTools_Tools3D.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_EmptyBuilder::BOP_EmptyBuilder
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_EmptyBuilder::BOP_EmptyBuilder()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Destroy
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_EmptyBuilder::Destroy()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Do
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_EmptyBuilder::Do()
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
myIsDone=Standard_False;
|
|
||||||
//
|
|
||||||
// Filling the DS
|
|
||||||
BOPTools_DSFiller aDSFiller;
|
|
||||||
aDSFiller.SetShapes (myShape1, myShape2);
|
|
||||||
//
|
|
||||||
aDSFiller.Perform ();
|
|
||||||
//
|
|
||||||
DoWithFiller(aDSFiller);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoWithFiller
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_EmptyBuilder::DoWithFiller(const BOPTools_DSFiller& aDSFiller)
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
myIsDone=Standard_False;
|
|
||||||
//
|
|
||||||
myResultMap.Clear();
|
|
||||||
myModifiedMap.Clear();
|
|
||||||
//
|
|
||||||
myDSFiller=(BOPTools_DSFiller*) &aDSFiller;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
try {
|
|
||||||
OCC_CATCH_SIGNALS
|
|
||||||
Standard_Boolean bIsNewFiller;
|
|
||||||
bIsNewFiller=aDSFiller.IsNewFiller();
|
|
||||||
|
|
||||||
if (bIsNewFiller) {
|
|
||||||
aDSFiller.SetNewFiller(!bIsNewFiller);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
BuildResult();
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//FillModified();
|
|
||||||
myIsDone=Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
catch ( Standard_Failure ) {
|
|
||||||
myErrorStatus = 1;
|
|
||||||
BOPTColStd_Dump::PrintMessage("Can not build result\n");
|
|
||||||
}
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BuildResult
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_EmptyBuilder::BuildResult()
|
|
||||||
{
|
|
||||||
Standard_Boolean bIsEmptyShape1, bIsEmptyShape2;
|
|
||||||
BRep_Builder aBB;
|
|
||||||
TopoDS_Compound aCompound;
|
|
||||||
|
|
||||||
aBB.MakeCompound(aCompound);
|
|
||||||
//
|
|
||||||
bIsEmptyShape1=BOPTools_Tools3D::IsEmptyShape(myShape1);
|
|
||||||
bIsEmptyShape2=BOPTools_Tools3D::IsEmptyShape(myShape2);
|
|
||||||
//
|
|
||||||
if (!bIsEmptyShape1 && bIsEmptyShape2) {
|
|
||||||
if (myOperation==BOP_FUSE || myOperation==BOP_CUT) {
|
|
||||||
aBB.Add(aCompound, myShape1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
else if (bIsEmptyShape1 && !bIsEmptyShape2) {
|
|
||||||
if (myOperation==BOP_FUSE || myOperation==BOP_CUT21) {
|
|
||||||
aBB.Add(aCompound, myShape2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
myResult=aCompound;
|
|
||||||
}
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
|||||||
-- Created on: 1995-12-21
|
|
||||||
-- Created by: Jean Yves LEBEY
|
|
||||||
-- Copyright (c) 1995-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.
|
|
||||||
|
|
||||||
--modified by NIZNHY-PKV Tue Apr 3 15:53:58 2001
|
|
||||||
|
|
||||||
class FaceAreaBuilder from BOP inherits Area2dBuilder from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
-- The FaceAreaBuilder algorithm is used to construct Faces from a LoopSet,
|
|
||||||
-- where the Loop is the composite topological object of the boundary,
|
|
||||||
-- here wire or block of edges.
|
|
||||||
-- The LoopSet gives an iteration on Loops.
|
|
||||||
-- For each Loop it indicates if it is on the boundary (wire) or if it
|
|
||||||
-- results from an interference (block of edges).
|
|
||||||
-- The result of the FaceAreaBuilder is an iteration on areas.
|
|
||||||
-- An area is described by a set of Loops.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
LoopSet from BOP,
|
|
||||||
LoopClassifier from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns FaceAreaBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
Create(LS :out LoopSet from BOP;
|
|
||||||
LC :out LoopClassifier from BOP;
|
|
||||||
ForceClass : Boolean = Standard_False)
|
|
||||||
returns FaceAreaBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Creates the object to build faces on the (wires,blocks of edge)
|
|
||||||
--- of <LS>, using the classifier <LC>.
|
|
||||||
---
|
|
||||||
InitFaceAreaBuilder(me :out;
|
|
||||||
LS :out LoopSet from BOP;
|
|
||||||
LC :out LoopClassifier from BOP;
|
|
||||||
ForceClass : Boolean = Standard_False)
|
|
||||||
is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Initializes the object to build faces on the (wires,blocks of edge)
|
|
||||||
--- of <LS>, using the classifier <LC>.
|
|
||||||
---
|
|
||||||
end FaceAreaBuilder;
|
|
@ -1,225 +0,0 @@
|
|||||||
-- Created on: 1995-12-21
|
|
||||||
-- Created by: Jean Yves LEBEY
|
|
||||||
-- Copyright (c) 1995-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.
|
|
||||||
|
|
||||||
-- modified by PKV Tue Apr 3 16:57:39 2001
|
|
||||||
|
|
||||||
|
|
||||||
class FaceBuilder from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- The algorithm to construct Faces from a WireEdgeSet
|
|
||||||
---
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
Shape from TopoDS,
|
|
||||||
Face from TopoDS,
|
|
||||||
Wire from TopoDS,
|
|
||||||
Edge from TopoDS,
|
|
||||||
Vertex from TopoDS,
|
|
||||||
ListOfShape from TopTools,
|
|
||||||
SequenceOfInteger from TColStd,
|
|
||||||
Context from IntTools,
|
|
||||||
WireEdgeSet from BOP,
|
|
||||||
PWireEdgeSet from BOP
|
|
||||||
-- LoopSet from BOP,
|
|
||||||
-- BlockIterator from BOP,
|
|
||||||
-- BlockBuilder from BOP,
|
|
||||||
-- FaceAreaBuilder from BOP,
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns FaceBuilder;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
Do(me :out;
|
|
||||||
aWES : WireEdgeSet from BOP;
|
|
||||||
aForceClass : Boolean from Standard =Standard_True);
|
|
||||||
---Purpose:
|
|
||||||
--- Launches the algorithm consisting of four steps
|
|
||||||
--- 1. Split the WES on wires
|
|
||||||
--- 2. Make Loops from wires
|
|
||||||
--- 3. Make Areas from Loops
|
|
||||||
--- 4. Make Faces from Areas
|
|
||||||
---
|
|
||||||
|
|
||||||
---
|
|
||||||
-- BuildNewFaces (me :out)
|
|
||||||
-- is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Make Faces from Areas
|
|
||||||
---
|
|
||||||
|
|
||||||
--modified by NIZNHY-PKV Wed Feb 29 10:57:40 2012f
|
|
||||||
SetContext(me:out;
|
|
||||||
aCtx:Context from IntTools);
|
|
||||||
---Purpose:
|
|
||||||
-- Sets intersection context <aCtx>
|
|
||||||
|
|
||||||
Context(me)
|
|
||||||
returns Context from IntTools;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
-- Returns intersection context
|
|
||||||
--modified by NIZNHY-PKV Wed Feb 29 10:57:52 2012t
|
|
||||||
|
|
||||||
WES (me)
|
|
||||||
returns WireEdgeSet from BOP;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
NewFaces (me)
|
|
||||||
returns ListOfShape from TopTools;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
SetTreatment (me: out;
|
|
||||||
aTreatment: Integer from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
--- 0 -Treat internal edges,
|
|
||||||
--- 1 -Do not treat internal edges
|
|
||||||
---
|
|
||||||
|
|
||||||
SetTreatSDScales (me: out;
|
|
||||||
aTreatment: Integer from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
--- 1 -Treat scale configured same domain faces,
|
|
||||||
--- 0 -Do not treat them.
|
|
||||||
---
|
|
||||||
-- SetManifoldFlag(me: out;
|
|
||||||
-- aMFlag: Boolean from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
-- ManifoldFlag(me)
|
|
||||||
-- returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
Treatment (me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
TreatSDScales (me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
---
|
|
||||||
---
|
|
||||||
--- Faces' iterator
|
|
||||||
---
|
|
||||||
-- InitFace(me:out)
|
|
||||||
-- returns Integer from Standard;
|
|
||||||
|
|
||||||
-- MoreFace(me)
|
|
||||||
-- returns Boolean from Standard;
|
|
||||||
|
|
||||||
-- NextFace(me:out);
|
|
||||||
---Purpose:
|
|
||||||
---
|
|
||||||
---
|
|
||||||
--- Wires' iterator
|
|
||||||
---
|
|
||||||
-- InitWire(me:out)
|
|
||||||
-- returns Integer from Standard;
|
|
||||||
|
|
||||||
-- MoreWire(me)
|
|
||||||
-- returns Boolean from Standard;
|
|
||||||
|
|
||||||
-- NextWire(me:out);
|
|
||||||
|
|
||||||
-- IsOldWire(me)
|
|
||||||
-- returns Boolean from Standard;
|
|
||||||
|
|
||||||
-- OldWire(me)
|
|
||||||
-- returns Shape from TopoDS;
|
|
||||||
-- ---C++: return const &
|
|
||||||
|
|
||||||
-- Wire(me)
|
|
||||||
-- returns Wire from TopoDS;
|
|
||||||
-- ---C++: return const &
|
|
||||||
-- ---Purpose:
|
|
||||||
-- ---
|
|
||||||
|
|
||||||
---
|
|
||||||
--- Edges' iterator
|
|
||||||
---
|
|
||||||
-- FindNextValidElement(me:out);
|
|
||||||
|
|
||||||
-- InitEdge(me:out)
|
|
||||||
-- returns Integer from Standard;
|
|
||||||
|
|
||||||
-- MoreEdge(me)
|
|
||||||
-- returns Boolean from Standard;
|
|
||||||
|
|
||||||
-- NextEdge(me : in out);
|
|
||||||
|
|
||||||
-- Edge(me)
|
|
||||||
-- returns Edge from TopoDS;
|
|
||||||
-- ---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
---
|
|
||||||
|
|
||||||
-- MakeLoops(me :out;
|
|
||||||
-- SS :out WireEdgeSet from BOP)
|
|
||||||
-- is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Make Loops from wires
|
|
||||||
---
|
|
||||||
DoInternalEdges (me :out)
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Processes internal edges if they exists
|
|
||||||
|
|
||||||
SDScales(me :out)
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Treatment SD faces with a "scale"
|
|
||||||
---
|
|
||||||
--modified by NIZNHY-PKV Wed Feb 29 09:12:17 2012f
|
|
||||||
PerformAreas(me :out;
|
|
||||||
SS :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
--modified by NIZNHY-PKV Wed Feb 29 09:12:20 2012t
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myFace : Face from TopoDS;
|
|
||||||
-- myLoopSet : LoopSet from BOP;
|
|
||||||
-- myBlockIterator : BlockIterator from BOP;
|
|
||||||
-- myBlockBuilder : BlockBuilder from BOP;
|
|
||||||
-- myFaceAreaBuilder : FaceAreaBuilder from BOP;
|
|
||||||
myWES : PWireEdgeSet from BOP;
|
|
||||||
myNewFaces : ListOfShape from TopTools;
|
|
||||||
myTreatment : Integer from Standard;
|
|
||||||
-- myManifoldFlag : Boolean from Standard;
|
|
||||||
myTreatSDScales : Integer from Standard;
|
|
||||||
myNegatives : SequenceOfInteger from TColStd;
|
|
||||||
myContext : Context from IntTools;
|
|
||||||
end FaceBuilder;
|
|
@ -1,801 +0,0 @@
|
|||||||
// Created by: Mister Open CAS.CADE
|
|
||||||
// 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.
|
|
||||||
|
|
||||||
|
|
||||||
#include <BOP_FaceBuilder.ixx>
|
|
||||||
|
|
||||||
#include <Geom2d_Curve.hxx>
|
|
||||||
#include <Geom_Surface.hxx>
|
|
||||||
#include <Geom_Curve.hxx>
|
|
||||||
|
|
||||||
#include <Geom2dInt_Geom2dCurveTool.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Builder.hxx>
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
|
|
||||||
#include <BRepLib.hxx>
|
|
||||||
|
|
||||||
#include <BRepAdaptor_Surface.hxx>
|
|
||||||
#include <BRepAdaptor_Curve2d.hxx>
|
|
||||||
|
|
||||||
#include <TopAbs_Orientation.hxx>
|
|
||||||
|
|
||||||
#include <TopLoc_Location.hxx>
|
|
||||||
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfOrientedShape.hxx>
|
|
||||||
#include <TopTools_ListOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
|
||||||
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
|
||||||
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Face.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
#include <TopoDS_Vertex.hxx>
|
|
||||||
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
|
|
||||||
#include <IntTools_Tools.hxx>
|
|
||||||
#include <IntTools_FClass2d.hxx>
|
|
||||||
#include <IntTools_Context.hxx>
|
|
||||||
|
|
||||||
#include <BOP_WireEdgeClassifier.hxx>
|
|
||||||
#include <BOP_Loop.hxx>
|
|
||||||
#include <BOP_BlockBuilder.hxx>
|
|
||||||
#include <BOP_LoopSet.hxx>
|
|
||||||
#include <BOP_WESCorrector.hxx>
|
|
||||||
#include <BOPTools_Tools2D.hxx>
|
|
||||||
#include <BOPTools_Tools3D.hxx>
|
|
||||||
|
|
||||||
#include <BOP_ListOfConnexityBlock.hxx>
|
|
||||||
#include <BOP_BuilderTools.hxx>
|
|
||||||
#include <BOP_ListIteratorOfListOfConnexityBlock.hxx>
|
|
||||||
#include <BOP_ConnexityBlock.hxx>
|
|
||||||
#include <BRepBuilderAPI_Copy.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
Standard_Boolean IsGrowthWire(const TopoDS_Shape& theWire,
|
|
||||||
const TopTools_IndexedMapOfShape& theMHE);
|
|
||||||
static
|
|
||||||
Standard_Boolean IsHole(const TopoDS_Shape& aW,
|
|
||||||
const TopoDS_Shape& aFace);
|
|
||||||
static
|
|
||||||
Standard_Boolean IsInside(const TopoDS_Shape& theHole,
|
|
||||||
const TopoDS_Shape& theF2,
|
|
||||||
const Handle(IntTools_Context)& theContext);
|
|
||||||
static
|
|
||||||
void DoTopologicalVerification(TopoDS_Face& F);
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_FaceBuilder
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_FaceBuilder::BOP_FaceBuilder():
|
|
||||||
myTreatment(0),
|
|
||||||
// myManifoldFlag(Standard_True),
|
|
||||||
myTreatSDScales(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetContext
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_FaceBuilder::SetContext(const Handle(IntTools_Context)& aCtx)
|
|
||||||
{
|
|
||||||
myContext=aCtx;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Context
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const Handle(IntTools_Context)& BOP_FaceBuilder::Context()const
|
|
||||||
{
|
|
||||||
return myContext;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetTreatment
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_FaceBuilder::SetTreatment(const Standard_Integer aTreatment)
|
|
||||||
{
|
|
||||||
myTreatment=aTreatment;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Treatment
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_FaceBuilder::Treatment()const
|
|
||||||
{
|
|
||||||
return myTreatment;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetTreatSDScales
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_FaceBuilder::SetTreatSDScales(const Standard_Integer aTreatment)
|
|
||||||
{
|
|
||||||
myTreatSDScales=aTreatment;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : TreatSDScales
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_FaceBuilder::TreatSDScales()const
|
|
||||||
{
|
|
||||||
return myTreatSDScales;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : WES
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const BOP_WireEdgeSet& BOP_FaceBuilder::WES() const
|
|
||||||
{
|
|
||||||
return *myWES;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewFaces
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const TopTools_ListOfShape& BOP_FaceBuilder::NewFaces() const
|
|
||||||
{
|
|
||||||
return myNewFaces;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Do
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_FaceBuilder::Do(const BOP_WireEdgeSet& aWES,
|
|
||||||
const Standard_Boolean bForceClass)
|
|
||||||
{
|
|
||||||
myFace=aWES.Face();
|
|
||||||
myWES=(BOP_WireEdgeSet*) &aWES;
|
|
||||||
//
|
|
||||||
if (myContext.IsNull()) {
|
|
||||||
myContext=new IntTools_Context;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
BOP_WESCorrector aWESCor;
|
|
||||||
aWESCor.SetWES(aWES);
|
|
||||||
aWESCor.Do();
|
|
||||||
BOP_WireEdgeSet& aNewWES=aWESCor.NewWES();
|
|
||||||
//
|
|
||||||
PerformAreas(aNewWES);
|
|
||||||
//
|
|
||||||
if (myTreatment==0) {
|
|
||||||
DoInternalEdges();
|
|
||||||
}
|
|
||||||
if (myTreatSDScales) {
|
|
||||||
SDScales();
|
|
||||||
}
|
|
||||||
|
|
||||||
// do topological verification
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt;
|
|
||||||
anIt.Initialize(myNewFaces);
|
|
||||||
for(anIt.Initialize(myNewFaces); anIt.More(); anIt.Next()) {
|
|
||||||
TopoDS_Face& aF = TopoDS::Face(anIt.Value());
|
|
||||||
DoTopologicalVerification(aF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : DoInternalEdges
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_FaceBuilder::DoInternalEdges()
|
|
||||||
{
|
|
||||||
Standard_Integer i, aNbE, aNbSE, aNb, aNbF;
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aDifferenceMap, aFLEMap;
|
|
||||||
TopTools_IndexedMapOfOrientedShape aStartElementsMap, anEdgesMap;
|
|
||||||
TopTools_IndexedMapOfShape anInternalEdges;
|
|
||||||
//
|
|
||||||
const TopTools_ListOfShape& aStartElements=myWES->StartElements();
|
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aStartElements);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& aE=anIt.Value();
|
|
||||||
aStartElementsMap.Add(aE);
|
|
||||||
}
|
|
||||||
|
|
||||||
anIt.Initialize(myNewFaces);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& aF=anIt.Value();
|
|
||||||
TopExp_Explorer anExp (aF, TopAbs_EDGE);
|
|
||||||
for (; anExp.More(); anExp.Next()) {
|
|
||||||
const TopoDS_Shape& aE=anExp.Current();
|
|
||||||
anEdgesMap.Add(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
aNbSE=aStartElementsMap.Extent();
|
|
||||||
aNbE=anEdgesMap.Extent();
|
|
||||||
|
|
||||||
if (aNbE==aNbSE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=1; i<=aNbSE; i++) {
|
|
||||||
const TopoDS_Shape& aE=aStartElementsMap(i);
|
|
||||||
if (!anEdgesMap.Contains(aE)) {
|
|
||||||
if (!aDifferenceMap.Contains(aE)) {
|
|
||||||
TopTools_ListOfShape aLEx;
|
|
||||||
aLEx.Append(aE);
|
|
||||||
aDifferenceMap.Add(aE, aLEx);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape& aLEx=aDifferenceMap.ChangeFromKey(aE);
|
|
||||||
aLEx.Append(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
aNbE=aDifferenceMap.Extent();
|
|
||||||
if(!aNbE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=1; i<=aNbE; i++) {
|
|
||||||
const TopoDS_Shape& aE=aDifferenceMap.FindKey(i);
|
|
||||||
const TopTools_ListOfShape& aLE=aDifferenceMap(i);
|
|
||||||
aNb=aLE.Extent();
|
|
||||||
if (aNb==2) {
|
|
||||||
const TopoDS_Edge& anEdge=TopoDS::Edge(aE);
|
|
||||||
if (!BRep_Tool::IsClosed(anEdge, myFace)) {
|
|
||||||
anInternalEdges.Add(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (aNb==1) {
|
|
||||||
const TopoDS_Edge& anEdge=TopoDS::Edge(aE);
|
|
||||||
if (anEdge.Orientation()==TopAbs_INTERNAL) {
|
|
||||||
anInternalEdges.Add(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
aNbE=anInternalEdges.Extent();
|
|
||||||
if(!aNbE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
aFLEMap.Clear();
|
|
||||||
|
|
||||||
for (i=1; i<=aNbE; i++) {
|
|
||||||
const TopoDS_Edge& aEx=TopoDS::Edge(anInternalEdges(i));
|
|
||||||
TopoDS_Edge aE=aEx;
|
|
||||||
|
|
||||||
Standard_Real aT, aT1, aT2, aToler;
|
|
||||||
Standard_Boolean bHasCurveOnSurface, bIsPointInOnFace;
|
|
||||||
Handle(Geom2d_Curve)aC2D;
|
|
||||||
|
|
||||||
bHasCurveOnSurface=
|
|
||||||
BOPTools_Tools2D::HasCurveOnSurface(aE, myFace, aC2D, aT1, aT2, aToler);
|
|
||||||
|
|
||||||
if (bHasCurveOnSurface) {
|
|
||||||
aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
|
|
||||||
gp_Pnt2d aP2D;
|
|
||||||
aC2D->D0(aT, aP2D);
|
|
||||||
//
|
|
||||||
anIt.Initialize(myNewFaces);
|
|
||||||
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
TopoDS_Face& aF=TopoDS::Face(anIt.Value());
|
|
||||||
//
|
|
||||||
bIsPointInOnFace=myContext->IsPointInOnFace(aF, aP2D);
|
|
||||||
//
|
|
||||||
if (bIsPointInOnFace) {
|
|
||||||
//
|
|
||||||
if (!aFLEMap.Contains(aF)) {
|
|
||||||
TopTools_ListOfShape aLE;
|
|
||||||
aLE.Append(aEx);
|
|
||||||
aFLEMap.Add(aF, aLE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape& aLE=aFLEMap.ChangeFromKey(aF);
|
|
||||||
aLE.Append(aEx);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} //for (; anIt.More(); anIt.Next())
|
|
||||||
}// if (bHasCurveOnSurface)
|
|
||||||
} // for (i=1; i<=aNbE; i++)
|
|
||||||
//
|
|
||||||
// Make Wires from Internal Edges and Add the Wires to the faces
|
|
||||||
aNbF=aFLEMap.Extent();
|
|
||||||
BRep_Builder aBB;
|
|
||||||
for (i=1; i<=aNbF; i++) {
|
|
||||||
const TopoDS_Face& aF=TopoDS::Face(aFLEMap.FindKey(i));
|
|
||||||
TopoDS_Face* pF=(TopoDS_Face*)&aF;
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& aLE=aFLEMap(i);
|
|
||||||
//
|
|
||||||
BOP_ListOfConnexityBlock aLConBlks;
|
|
||||||
|
|
||||||
BOP_BuilderTools::MakeConnexityBlocks(aLE, TopAbs_EDGE, aLConBlks);
|
|
||||||
|
|
||||||
BOP_ListIteratorOfListOfConnexityBlock aConBlkIt(aLConBlks);
|
|
||||||
for (; aConBlkIt.More(); aConBlkIt.Next()) {
|
|
||||||
BOP_ConnexityBlock& aConnexityBlock=aConBlkIt.Value();
|
|
||||||
const TopTools_ListOfShape& aLECB=aConnexityBlock.Shapes();
|
|
||||||
|
|
||||||
aNbE=aLECB.Extent();
|
|
||||||
if (aNbE) {
|
|
||||||
TopoDS_Wire aW;
|
|
||||||
aBB.MakeWire(aW);
|
|
||||||
|
|
||||||
anIt.Initialize(aLECB);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
TopoDS_Edge& aE=TopoDS::Edge(anIt.Value());
|
|
||||||
aE.Orientation(TopAbs_INTERNAL);
|
|
||||||
aBB.Add(aW, aE);
|
|
||||||
}
|
|
||||||
|
|
||||||
aBB.Add(*pF, aW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: TreatSDScales
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_FaceBuilder::SDScales()
|
|
||||||
{
|
|
||||||
|
|
||||||
Standard_Integer iNegativeFlag, aNbFR, i, aNbEFOpen, iCnt;
|
|
||||||
|
|
||||||
TopTools_ListOfShape aLFR;
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt, anItFR;
|
|
||||||
TopTools_IndexedMapOfShape aMFR;
|
|
||||||
//
|
|
||||||
iCnt=myNewFaces.Extent();
|
|
||||||
if (iCnt<2){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// 1. Collect all faces with negative (infinite) area
|
|
||||||
anIt.Initialize(myNewFaces);
|
|
||||||
for (i=1; anIt.More(); anIt.Next(), ++i) {
|
|
||||||
const TopoDS_Face& aF=TopoDS::Face(anIt.Value());
|
|
||||||
|
|
||||||
iNegativeFlag=myNegatives(i);
|
|
||||||
if (iNegativeFlag) {
|
|
||||||
aLFR.Append(aF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aNbFR=aLFR.Extent();
|
|
||||||
//
|
|
||||||
if (!aNbFR) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
BOP_ListOfConnexityBlock aLCB;
|
|
||||||
BOP_ListIteratorOfListOfConnexityBlock aLCBIt;
|
|
||||||
//
|
|
||||||
BOP_BuilderTools::MakeConnexityBlocks (myNewFaces, TopAbs_FACE, aLCB);
|
|
||||||
//
|
|
||||||
anItFR.Initialize(aLFR);
|
|
||||||
for (; anItFR.More(); anItFR.Next()) {
|
|
||||||
const TopoDS_Face& aFR=TopoDS::Face(anItFR.Value());
|
|
||||||
//
|
|
||||||
iCnt=1;
|
|
||||||
TopTools_IndexedMapOfShape aMEFOpen;
|
|
||||||
BOP_ConnexityBlock* pCBR=NULL;
|
|
||||||
//
|
|
||||||
TopExp::MapShapes(aFR, TopAbs_EDGE, aMEFOpen);
|
|
||||||
aNbEFOpen=aMEFOpen.Extent();
|
|
||||||
//
|
|
||||||
// Look for ConnexityBlock to which aFR belongs to (pCBR)
|
|
||||||
aLCBIt.Initialize(aLCB);
|
|
||||||
for (; aLCBIt.More() && iCnt; aLCBIt.Next()) {
|
|
||||||
const BOP_ConnexityBlock& aCB=aLCBIt.Value();
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& aLCF=aCB.Shapes();
|
|
||||||
anIt.Initialize(aLCF);
|
|
||||||
for (; anIt.More() && iCnt; anIt.Next()) {
|
|
||||||
const TopoDS_Face& aF=TopoDS::Face(anIt.Value());
|
|
||||||
TopTools_IndexedMapOfShape aMECB;
|
|
||||||
TopExp::MapShapes(aF, TopAbs_EDGE, aMECB);
|
|
||||||
|
|
||||||
for (i=1; i<=aNbEFOpen; ++i) {
|
|
||||||
const TopoDS_Shape& aEFOpen= aMEFOpen(i);
|
|
||||||
if (aMECB.Contains(aEFOpen)) {
|
|
||||||
iCnt=0;
|
|
||||||
pCBR=(BOP_ConnexityBlock*) &aCB;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (iCnt) {
|
|
||||||
// it is strange
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Collect Faces to remove in the map aMFR
|
|
||||||
const TopTools_ListOfShape& aLCR=pCBR->Shapes();
|
|
||||||
anIt.Initialize(aLCR);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Face& aF=TopoDS::Face(anIt.Value());
|
|
||||||
aMFR.Add(aF);
|
|
||||||
}
|
|
||||||
} // for (; anItFR.More(); anItFR.Next())
|
|
||||||
//
|
|
||||||
//
|
|
||||||
iCnt=aMFR.Extent();
|
|
||||||
if (!iCnt) {
|
|
||||||
// Nothing to remove
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
TopTools_ListOfShape aLFOut;
|
|
||||||
anIt.Initialize(myNewFaces);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Face& aF=TopoDS::Face(anIt.Value());
|
|
||||||
if (!aMFR.Contains(aF)) {
|
|
||||||
aLFOut.Append(aF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
myNewFaces.Clear();
|
|
||||||
anIt.Initialize(aLFOut);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Face& aF=TopoDS::Face(anIt.Value());
|
|
||||||
myNewFaces.Append(aF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : PerformAreas
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_FaceBuilder::PerformAreas(BOP_WireEdgeSet& aWES)
|
|
||||||
{
|
|
||||||
Standard_Boolean bIsGrowth, bIsHole;
|
|
||||||
Standard_Real aTol;
|
|
||||||
TopTools_ListOfShape aNewFaces, aHoleWires, aLoops;
|
|
||||||
TopoDS_Shape anInfinitePointShape;
|
|
||||||
TopTools_DataMapOfShapeShape aInOutMap;
|
|
||||||
TopTools_DataMapOfShapeListOfShape aMSH;
|
|
||||||
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSH;
|
|
||||||
TopTools_ListIteratorOfListOfShape aIt1, aIt2;
|
|
||||||
TopTools_IndexedMapOfShape aMHE;
|
|
||||||
BRep_Builder aBB;
|
|
||||||
Handle(Geom_Surface) aS;
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
//
|
|
||||||
aTol=BRep_Tool::Tolerance(myFace);
|
|
||||||
aS=BRep_Tool::Surface(myFace, aLoc);
|
|
||||||
//
|
|
||||||
myNewFaces.Clear();
|
|
||||||
//
|
|
||||||
for(aWES.InitShapes(); aWES.MoreShapes(); aWES.NextShape()) {
|
|
||||||
const TopoDS_Shape& aW=aWES.Shape();
|
|
||||||
aLoops.Append(aW);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Draft faces [aNewFaces]
|
|
||||||
aIt1.Initialize(aLoops);
|
|
||||||
for ( ; aIt1.More(); aIt1.Next()) {
|
|
||||||
const TopoDS_Shape& aWire=aIt1.Value();
|
|
||||||
//
|
|
||||||
bIsGrowth=IsGrowthWire(aWire, aMHE);
|
|
||||||
if (bIsGrowth) {
|
|
||||||
// make a growth face from a wire
|
|
||||||
TopoDS_Face aFace;
|
|
||||||
aBB.MakeFace(aFace, aS, aLoc, aTol);
|
|
||||||
aBB.Add (aFace, aWire);
|
|
||||||
//
|
|
||||||
aNewFaces.Append (aFace);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
// check if a wire is a hole
|
|
||||||
bIsHole=IsHole(aWire, myFace);
|
|
||||||
//XX
|
|
||||||
if (bIsHole) {
|
|
||||||
aHoleWires.Append(aWire);
|
|
||||||
TopExp::MapShapes(aWire, TopAbs_EDGE, aMHE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// make a growth face from a wire
|
|
||||||
TopoDS_Face aFace;
|
|
||||||
aBB.MakeFace(aFace, aS, aLoc, aTol);
|
|
||||||
aBB.Add (aFace, aWire);
|
|
||||||
//
|
|
||||||
aNewFaces.Append (aFace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// 2. Find outer growth shell that is most close to each hole shell
|
|
||||||
aIt2.Initialize(aHoleWires);
|
|
||||||
for (; aIt2.More(); aIt2.Next()) {
|
|
||||||
const TopoDS_Shape& aHole = aIt2.Value();
|
|
||||||
//
|
|
||||||
aIt1.Initialize(aNewFaces);
|
|
||||||
for ( ; aIt1.More(); aIt1.Next()) {
|
|
||||||
const TopoDS_Shape& aF=aIt1.Value();
|
|
||||||
//
|
|
||||||
if (!IsInside(aHole, aF, myContext)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if ( aInOutMap.IsBound (aHole)){
|
|
||||||
const TopoDS_Shape& aF2=aInOutMap(aHole);
|
|
||||||
if (IsInside(aF, aF2, myContext)) {
|
|
||||||
aInOutMap.UnBind(aHole);
|
|
||||||
aInOutMap.Bind (aHole, aF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
aInOutMap.Bind (aHole, aF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Add aHole to a map Face/ListOfHoles [aMSH]
|
|
||||||
if (aInOutMap.IsBound(aHole)){
|
|
||||||
const TopoDS_Shape& aF=aInOutMap(aHole);
|
|
||||||
if (aMSH.IsBound(aF)) {
|
|
||||||
TopTools_ListOfShape& aLH=aMSH.ChangeFind(aF);
|
|
||||||
aLH.Append(aHole);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape aLH;
|
|
||||||
aLH.Append(aHole);
|
|
||||||
aMSH.Bind(aF, aLH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}// for (; aIt2.More(); aIt2.Next())
|
|
||||||
//
|
|
||||||
// 3. Add aHoles to Faces
|
|
||||||
aItMSH.Initialize(aMSH);
|
|
||||||
for (; aItMSH.More(); aItMSH.Next()) {
|
|
||||||
TopoDS_Face aF=TopoDS::Face(aItMSH.Key());
|
|
||||||
//
|
|
||||||
const TopTools_ListOfShape& aLH=aItMSH.Value();
|
|
||||||
aIt2.Initialize(aLH);
|
|
||||||
for (; aIt2.More(); aIt2.Next()) {
|
|
||||||
const TopoDS_Shape& aHole = aIt2.Value();
|
|
||||||
aBB.Add (aF, aHole);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// update classifier
|
|
||||||
aTol=BRep_Tool::Tolerance(aF);
|
|
||||||
IntTools_FClass2d& aClsf=myContext->FClass2d(aF);
|
|
||||||
aClsf.Init(aF, aTol);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// These aNewFaces are draft faces that
|
|
||||||
// do not contain any internal shapes
|
|
||||||
//
|
|
||||||
Standard_Boolean bIsValidIn2D, bNegativeFlag;
|
|
||||||
Standard_Integer iNegativeFlag;
|
|
||||||
//
|
|
||||||
myNewFaces.Clear();
|
|
||||||
myNegatives.Clear();
|
|
||||||
//
|
|
||||||
aIt1.Initialize(aNewFaces);
|
|
||||||
for ( ; aIt1.More(); aIt1.Next()) {
|
|
||||||
const TopoDS_Face& aFx=TopoDS::Face(aIt1.Value());
|
|
||||||
bIsValidIn2D=BOPTools_Tools3D::IsValidArea (aFx, bNegativeFlag);
|
|
||||||
if(bIsValidIn2D) {
|
|
||||||
myNewFaces.Append (aFx);
|
|
||||||
iNegativeFlag=(Standard_Integer)bNegativeFlag;
|
|
||||||
myNegatives.Append(iNegativeFlag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsGrowthWire
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean IsGrowthWire(const TopoDS_Shape& theWire,
|
|
||||||
const TopTools_IndexedMapOfShape& theMHE)
|
|
||||||
{
|
|
||||||
Standard_Boolean bRet;
|
|
||||||
TopoDS_Iterator aIt;
|
|
||||||
//
|
|
||||||
bRet=Standard_False;
|
|
||||||
if (theMHE.Extent()) {
|
|
||||||
aIt.Initialize(theWire);
|
|
||||||
for(; aIt.More(); aIt.Next()) {
|
|
||||||
const TopoDS_Shape& aE=aIt.Value();
|
|
||||||
if (theMHE.Contains(aE)) {
|
|
||||||
return !bRet;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsHole
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean IsHole(const TopoDS_Shape& aW,
|
|
||||||
const TopoDS_Shape& aFace)
|
|
||||||
{
|
|
||||||
Standard_Boolean bIsHole;
|
|
||||||
Standard_Real aTolF;
|
|
||||||
TopoDS_Face aFF, aFC;
|
|
||||||
BRep_Builder aBB;
|
|
||||||
IntTools_FClass2d aFClass2d;
|
|
||||||
//
|
|
||||||
aFF=TopoDS::Face(aFace.EmptyCopied());
|
|
||||||
aFF.Orientation(TopAbs_FORWARD);
|
|
||||||
aBB.Add(aFF, aW);
|
|
||||||
//
|
|
||||||
BRepBuilderAPI_Copy aBC;
|
|
||||||
//
|
|
||||||
aBC.Perform(aFF);
|
|
||||||
aFC=TopoDS::Face(aBC.Shape());
|
|
||||||
aFF=aFC;
|
|
||||||
//
|
|
||||||
aTolF=BRep_Tool::Tolerance(aFF);
|
|
||||||
//modified by NIZNHY-PKV Thu Aug 23 09:18:05 2012f
|
|
||||||
BRepLib::SameParameter(aFF, aTolF, Standard_True);
|
|
||||||
//modified by NIZNHY-PKV Thu Aug 23 09:18:08 2012t
|
|
||||||
//
|
|
||||||
aFClass2d.Init(aFF, aTolF);
|
|
||||||
//
|
|
||||||
bIsHole=aFClass2d.IsHole();
|
|
||||||
//
|
|
||||||
return bIsHole;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsInside
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean IsInside(const TopoDS_Shape& theHole,
|
|
||||||
const TopoDS_Shape& theF2,
|
|
||||||
const Handle(IntTools_Context)& theContext)
|
|
||||||
{
|
|
||||||
Standard_Boolean bRet;
|
|
||||||
Standard_Real aT, aU, aV;
|
|
||||||
|
|
||||||
TopAbs_State aState;
|
|
||||||
TopExp_Explorer aExp;
|
|
||||||
TopTools_IndexedMapOfShape aME2;
|
|
||||||
gp_Pnt2d aP2D;
|
|
||||||
//
|
|
||||||
bRet=Standard_False;
|
|
||||||
aState=TopAbs_UNKNOWN;
|
|
||||||
const TopoDS_Face& aF2=TopoDS::Face(theF2);
|
|
||||||
//
|
|
||||||
TopExp::MapShapes(aF2, TopAbs_EDGE, aME2);
|
|
||||||
//
|
|
||||||
aExp.Init(theHole, TopAbs_EDGE);
|
|
||||||
if (aExp.More()) {
|
|
||||||
const TopoDS_Edge& aE = TopoDS::Edge(aExp.Current());
|
|
||||||
if (aME2.Contains(aE)) {
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aT=BOPTools_Tools2D::IntermediatePoint(aE);
|
|
||||||
BOPTools_Tools2D::PointOnSurface(aE, aF2, aT, aU, aV);
|
|
||||||
aP2D.SetCoord(aU, aV);
|
|
||||||
//
|
|
||||||
IntTools_FClass2d& aClsf=theContext->FClass2d(aF2);
|
|
||||||
aState=aClsf.Perform(aP2D);
|
|
||||||
bRet=(aState==TopAbs_IN);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : DoTopologicalVerification
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void DoTopologicalVerification(TopoDS_Face& F)
|
|
||||||
{
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape mapVE;
|
|
||||||
mapVE.Clear();
|
|
||||||
TopExp::MapShapesAndAncestors(F,TopAbs_VERTEX,TopAbs_EDGE,mapVE);
|
|
||||||
|
|
||||||
Standard_Real pF1 = 0., pL1 = 0., pF2 = 0., pL2 = 0.;
|
|
||||||
Standard_Integer nbKeys = mapVE.Extent(), iKey = 0;
|
|
||||||
|
|
||||||
for( iKey = 1; iKey <= nbKeys; iKey++ ) {
|
|
||||||
const TopoDS_Vertex& iV = TopoDS::Vertex(mapVE.FindKey(iKey));
|
|
||||||
if( iV.IsNull() ) continue;
|
|
||||||
|
|
||||||
Standard_Real TolV = BRep_Tool::Tolerance(iV);
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& iLE = mapVE.FindFromIndex(iKey);
|
|
||||||
Standard_Integer nbE = iLE.Extent();
|
|
||||||
if( nbE != 2 ) break;
|
|
||||||
|
|
||||||
const TopoDS_Edge& iE1 = TopoDS::Edge(iLE.First());
|
|
||||||
const TopoDS_Edge& iE2 = TopoDS::Edge(iLE.Last());
|
|
||||||
|
|
||||||
if(BRep_Tool::Degenerated(iE1) || BRep_Tool::Degenerated(iE2) ) continue;
|
|
||||||
|
|
||||||
Standard_Real iPE1 = BRep_Tool::Parameter(iV,iE1);
|
|
||||||
Standard_Real iPE2 = BRep_Tool::Parameter(iV,iE2);
|
|
||||||
|
|
||||||
Handle(Geom_Curve) aC3D1 = BRep_Tool::Curve(iE1,pF1,pL1);
|
|
||||||
Handle(Geom_Curve) aC3D2 = BRep_Tool::Curve(iE2,pF2,pL2);
|
|
||||||
if( aC3D1.IsNull() || aC3D2.IsNull() ) break;
|
|
||||||
|
|
||||||
Standard_Boolean is1F = (fabs(iPE1-pF1) < fabs(iPE1-pL1));
|
|
||||||
Standard_Boolean is2F = (fabs(iPE2-pF2) < fabs(iPE2-pL2));
|
|
||||||
|
|
||||||
Standard_Real useP1 = iPE1;
|
|
||||||
if( is1F ) {
|
|
||||||
if( fabs(iPE1-pF1) > 1.e-7 ) useP1 = pF1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if( fabs(iPE1-pL1) > 1.e-7 ) useP1 = pL1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Real useP2 = iPE2;
|
|
||||||
if( is2F ) {
|
|
||||||
if( fabs(iPE2-pF2) > 1.e-7 ) useP2 = pF2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if( fabs(iPE2-pL2) > 1.e-7 ) useP2 = pL2;
|
|
||||||
}
|
|
||||||
|
|
||||||
gp_Pnt aPnt1 = aC3D1->Value(useP1);
|
|
||||||
gp_Pnt aPnt2 = aC3D2->Value(useP2);
|
|
||||||
gp_Pnt aPntV = BRep_Tool::Pnt(iV);
|
|
||||||
|
|
||||||
Standard_Real distV1 = aPntV.Distance(aPnt1);
|
|
||||||
Standard_Real distV2 = aPntV.Distance(aPnt2);
|
|
||||||
|
|
||||||
// update vertex tolerance checking 3D curves
|
|
||||||
if( distV1 > TolV || distV2 > TolV ) {
|
|
||||||
Standard_Real distMax = Max(distV1,distV2);
|
|
||||||
Standard_Real delta = fabs(distMax-TolV);
|
|
||||||
Standard_Real newTol = TolV + delta + 2.e-7;
|
|
||||||
TopoDS_Vertex & aV = (TopoDS_Vertex &) iV;
|
|
||||||
BRep_Builder bb;
|
|
||||||
bb.UpdateVertex(aV,newTol);
|
|
||||||
TolV = newTol;
|
|
||||||
}
|
|
||||||
|
|
||||||
gp_Pnt2d aPnt2dF, aPnt2dL;
|
|
||||||
BRep_Tool::UVPoints(iE1,F,aPnt2dF, aPnt2dL);
|
|
||||||
gp_Pnt2d aPnt2dE1 = (is1F) ? aPnt2dF : aPnt2dL;
|
|
||||||
BRep_Tool::UVPoints(iE2,F,aPnt2dF, aPnt2dL);
|
|
||||||
gp_Pnt2d aPnt2dE2 = (is2F) ? aPnt2dF : aPnt2dL;
|
|
||||||
|
|
||||||
BRepAdaptor_Surface aFSurf (F,Standard_False);
|
|
||||||
aPnt1 = aFSurf.Value(aPnt2dE1.X(), aPnt2dE1.Y());
|
|
||||||
aPnt2 = aFSurf.Value(aPnt2dE2.X(), aPnt2dE2.Y());
|
|
||||||
distV1 = aPntV.Distance(aPnt1);
|
|
||||||
distV2 = aPntV.Distance(aPnt2);
|
|
||||||
|
|
||||||
// update vertex tolerance checking 3D points on surface
|
|
||||||
if( distV1 > TolV || distV2 > TolV ) {
|
|
||||||
Standard_Real distMax = Max(distV1,distV2);
|
|
||||||
Standard_Real delta = fabs(distMax-TolV);
|
|
||||||
Standard_Real newTol = TolV + delta + 2.e-7;
|
|
||||||
TopoDS_Vertex & aV = (TopoDS_Vertex &) iV;
|
|
||||||
BRep_Builder bb;
|
|
||||||
bb.UpdateVertex(aV,newTol);
|
|
||||||
TolV = newTol;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,130 +0,0 @@
|
|||||||
-- Created on: 2001-08-02
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 FaceInfo from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- The auxiliary class to store data about faces on a shell
|
|
||||||
--- that have common edge
|
|
||||||
---
|
|
||||||
|
|
||||||
uses
|
|
||||||
Face from TopoDS,
|
|
||||||
Pnt from gp,
|
|
||||||
Dir from gp,
|
|
||||||
Pnt2d from gp
|
|
||||||
|
|
||||||
--raises
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns FaceInfo from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
SetFace (me:out;
|
|
||||||
aF:Face from TopoDS);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetPassed (me:out;
|
|
||||||
aFlag:Boolean from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetPOnEdge (me:out;
|
|
||||||
aP:Pnt from gp);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetPInFace (me:out;
|
|
||||||
aP:Pnt from gp);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetPInFace2D (me:out;
|
|
||||||
aP:Pnt2d from gp);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetNormal (me:out;
|
|
||||||
aD:Dir from gp);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetAngle (me:out;
|
|
||||||
A:Real from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
|
|
||||||
Face (me)
|
|
||||||
returns Face from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
POnEdge (me)
|
|
||||||
returns Pnt from gp;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
PInFace (me)
|
|
||||||
returns Pnt from gp;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
PInFace2D (me)
|
|
||||||
returns Pnt2d from gp;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
|
|
||||||
Normal (me)
|
|
||||||
returns Dir from gp;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
IsPassed (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
Angle (me)
|
|
||||||
returns Real from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
fields
|
|
||||||
|
|
||||||
myFace : Face from TopoDS;
|
|
||||||
myPassed: Boolean from Standard;
|
|
||||||
myPOnEdge : Pnt from gp;
|
|
||||||
myPInFace : Pnt from gp;
|
|
||||||
myPInFace2D: Pnt2d from gp;
|
|
||||||
myNormal : Dir from gp;
|
|
||||||
myAngle : Real from Standard;
|
|
||||||
|
|
||||||
end FaceInfo;
|
|
@ -1,76 +0,0 @@
|
|||||||
-- Created on: 2003-03-20
|
|
||||||
-- Created by: Michael KLOKOV
|
|
||||||
-- Copyright (c) 2003-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.
|
|
||||||
|
|
||||||
|
|
||||||
deferred class HistoryCollector from BOP inherits TShared from MMgt
|
|
||||||
uses
|
|
||||||
Shape from TopoDS,
|
|
||||||
Operation from BOP,
|
|
||||||
ListOfShape from TopTools,
|
|
||||||
DataMapOfShapeListOfShape from TopTools,
|
|
||||||
PDSFiller from BOPTools
|
|
||||||
|
|
||||||
is
|
|
||||||
Initialize;
|
|
||||||
|
|
||||||
Initialize(theShape1 : Shape from TopoDS;
|
|
||||||
theShape2 : Shape from TopoDS;
|
|
||||||
theOperation: Operation from BOP);
|
|
||||||
|
|
||||||
Generated (me: mutable; S : Shape from TopoDS)
|
|
||||||
returns ListOfShape from TopTools
|
|
||||||
is virtual;
|
|
||||||
---C++: return const &
|
|
||||||
|
|
||||||
SetResult(me: mutable; theResult: Shape from TopoDS;
|
|
||||||
theDSFiller: PDSFiller from BOPTools)
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Modified (me: mutable; S : Shape from TopoDS)
|
|
||||||
returns ListOfShape from TopTools
|
|
||||||
is virtual;
|
|
||||||
---C++: return const &
|
|
||||||
|
|
||||||
IsDeleted (me: mutable; S : Shape from TopoDS)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
HasGenerated (me)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
HasModified (me)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
HasDeleted (me)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
fields
|
|
||||||
myEmptyList: ListOfShape from TopTools is protected;
|
|
||||||
myOp : Operation from BOP is protected;
|
|
||||||
myGenMap : DataMapOfShapeListOfShape from TopTools is protected;
|
|
||||||
myModifMap: DataMapOfShapeListOfShape from TopTools is protected;
|
|
||||||
myS1 : Shape from TopoDS is protected;
|
|
||||||
myS2 : Shape from TopoDS is protected;
|
|
||||||
myResult : Shape from TopoDS is protected;
|
|
||||||
myHasDeleted : Boolean from Standard is protected;
|
|
||||||
|
|
||||||
end HistoryCollector from BOP;
|
|
@ -1,110 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
#include <BOP_HistoryCollector.ixx>
|
|
||||||
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
|
|
||||||
BOP_HistoryCollector::BOP_HistoryCollector()
|
|
||||||
{
|
|
||||||
myOp = BOP_UNKNOWN;
|
|
||||||
myHasDeleted = Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOP_HistoryCollector::BOP_HistoryCollector(const TopoDS_Shape& theShape1,
|
|
||||||
const TopoDS_Shape& theShape2,
|
|
||||||
const BOP_Operation theOperation)
|
|
||||||
{
|
|
||||||
myOp = theOperation;
|
|
||||||
myS1 = theShape1;
|
|
||||||
myS2 = theShape2;
|
|
||||||
myHasDeleted = Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BOP_HistoryCollector::SetResult(const TopoDS_Shape& theResult,
|
|
||||||
const BOPTools_PDSFiller& theDSFiller)
|
|
||||||
{
|
|
||||||
myResult = theResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& BOP_HistoryCollector::Generated(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
if(S.IsNull())
|
|
||||||
return myEmptyList;
|
|
||||||
|
|
||||||
if(myGenMap.IsBound(S)) {
|
|
||||||
return myGenMap.Find(S);
|
|
||||||
}
|
|
||||||
return myEmptyList;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& BOP_HistoryCollector::Modified(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
if(S.IsNull())
|
|
||||||
return myEmptyList;
|
|
||||||
|
|
||||||
if(myModifMap.IsBound(S)) {
|
|
||||||
return myModifMap.Find(S);
|
|
||||||
}
|
|
||||||
return myEmptyList;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean BOP_HistoryCollector::IsDeleted(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
if(S.IsNull())
|
|
||||||
return Standard_True;
|
|
||||||
|
|
||||||
TopAbs_ShapeEnum aType = S.ShapeType();
|
|
||||||
TopExp_Explorer anExp(myResult, aType);
|
|
||||||
|
|
||||||
for(; anExp.More(); anExp.Next()) {
|
|
||||||
if(S.IsSame(anExp.Current()))
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(myModifMap.IsBound(S)) {
|
|
||||||
if(!myModifMap(S).IsEmpty())
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(myGenMap.IsBound(S)) {
|
|
||||||
if(!myGenMap(S).IsEmpty())
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean BOP_HistoryCollector::HasGenerated() const
|
|
||||||
{
|
|
||||||
if(!myGenMap.IsEmpty()) {
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean BOP_HistoryCollector::HasModified() const
|
|
||||||
{
|
|
||||||
if(!myModifMap.IsEmpty()) {
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean BOP_HistoryCollector::HasDeleted() const
|
|
||||||
{
|
|
||||||
return myHasDeleted;
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
-- Created on: 1995-12-19
|
|
||||||
-- Created by: Jean Yves LEBEY
|
|
||||||
-- Copyright (c) 1995-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 Loop from BOP inherits TShared from MMgt
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
-- A Loop is an existing shape (Shell,Wire) or a set
|
|
||||||
-- of shapes (Faces,Edges) which are connex.
|
|
||||||
-- a set of connex shape is represented by a BlockIterator
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
Shape from TopoDS,
|
|
||||||
BlockIterator from BOP,
|
|
||||||
ShapeEnum from TopAbs
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(S : Shape from TopoDS)
|
|
||||||
returns mutable Loop;
|
|
||||||
---Purpose:
|
|
||||||
--- Creates the object using the shape S;
|
|
||||||
---
|
|
||||||
Create(BI : BlockIterator from BOP)
|
|
||||||
returns mutable Loop;
|
|
||||||
---Purpose:
|
|
||||||
--- Creates the object using the BlockIterator BI;
|
|
||||||
---
|
|
||||||
IsShape(me)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is virtual;
|
|
||||||
---Purpose:
|
|
||||||
--- Returns TRUE if the object was created using shape
|
|
||||||
---
|
|
||||||
Shape(me)
|
|
||||||
returns Shape from TopoDS
|
|
||||||
is virtual;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Returns Shape from which the object was created
|
|
||||||
--- Valid only when IsShape() is TRUE
|
|
||||||
---
|
|
||||||
BlockIterator(me)
|
|
||||||
returns BlockIterator
|
|
||||||
is static;
|
|
||||||
---C++: return const &
|
|
||||||
--- Returns BlockIterator from which the object was created
|
|
||||||
--- Valid only when IsShape() is FALSE
|
|
||||||
---
|
|
||||||
|
|
||||||
fields
|
|
||||||
myIsShape : Boolean from Standard
|
|
||||||
is protected;
|
|
||||||
myShape : Shape from TopoDS
|
|
||||||
is protected;
|
|
||||||
myBlockIterator : BlockIterator from BOP
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
end Loop from BOP;
|
|
@ -1,74 +0,0 @@
|
|||||||
// Created on: 1995-12-19
|
|
||||||
// Created by: Jean Yves LEBEY
|
|
||||||
// Copyright (c) 1995-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.
|
|
||||||
|
|
||||||
|
|
||||||
#include <BOP_Loop.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_Loop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_Loop::BOP_Loop (const TopoDS_Shape& S)
|
|
||||||
:
|
|
||||||
myIsShape(Standard_True),
|
|
||||||
myShape(S),
|
|
||||||
myBlockIterator(0,0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_Loop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_Loop::BOP_Loop (const BOP_BlockIterator& BI)
|
|
||||||
:
|
|
||||||
myIsShape(Standard_False),
|
|
||||||
myBlockIterator(BI)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsShape
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_Loop::IsShape() const
|
|
||||||
{
|
|
||||||
return myIsShape;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Shape
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const TopoDS_Shape& BOP_Loop::Shape() const
|
|
||||||
{
|
|
||||||
return myShape;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BlockIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const BOP_BlockIterator& BOP_Loop::BlockIterator() const
|
|
||||||
{
|
|
||||||
return myBlockIterator;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
|||||||
-- Created on: 1993-03-03
|
|
||||||
-- Created by: Jean Yves LEBEY
|
|
||||||
-- Copyright (c) 1993-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.
|
|
||||||
|
|
||||||
|
|
||||||
deferred class LoopClassifier from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
-- Root class to classify Loops in order to build Areas
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
ShapeEnum from TopAbs,
|
|
||||||
State from TopAbs,
|
|
||||||
Loop from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Delete(me:out) is virtual;
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_LoopClassifier(){Delete() ; }"
|
|
||||||
---Purpose:
|
|
||||||
--- Destructor;
|
|
||||||
---
|
|
||||||
Compare(me : in out; L1,L2 : Loop from BOP)
|
|
||||||
returns State from TopAbs
|
|
||||||
is deferred;
|
|
||||||
---Purpose:
|
|
||||||
--- Returns the state of loop <L1> compared with loop <L2>.
|
|
||||||
---
|
|
||||||
|
|
||||||
end LoopClassifier;
|
|
@ -1,77 +0,0 @@
|
|||||||
-- Created on: 1993-03-23
|
|
||||||
-- Created by: Jean Yves LEBEY
|
|
||||||
-- Copyright (c) 1993-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 LoopSet from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
-- The auxiliary class to store and iterate on Loop(s)
|
|
||||||
uses
|
|
||||||
|
|
||||||
Loop from BOP,
|
|
||||||
ListOfLoop from BOP,
|
|
||||||
ListIteratorOfListOfLoop from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns LoopSet;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
Delete(me:out)
|
|
||||||
is virtual;
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_LoopSet(){Delete() ; }"
|
|
||||||
---Purpose:
|
|
||||||
--- Destructor;
|
|
||||||
---
|
|
||||||
ChangeListOfLoop(me : in out)
|
|
||||||
returns ListOfLoop
|
|
||||||
is static;
|
|
||||||
---C++: return &
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier;
|
|
||||||
|
|
||||||
---
|
|
||||||
--- Exploration of the loops
|
|
||||||
---
|
|
||||||
InitLoop(me : in out)
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
MoreLoop(me)
|
|
||||||
returns Boolean
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
NextLoop(me : in out)
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Loop(me)
|
|
||||||
returns Loop from BOP
|
|
||||||
is virtual;
|
|
||||||
---C++: return const &
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myListOfLoop : ListOfLoop from BOP;
|
|
||||||
myLoopIterator : ListIteratorOfListOfLoop from BOP;
|
|
||||||
myLoopIndex : Integer from Standard;
|
|
||||||
myNbLoop : Integer from Standard;
|
|
||||||
|
|
||||||
end LoopSet;
|
|
@ -1,83 +0,0 @@
|
|||||||
// Created on: 1993-03-23
|
|
||||||
// Created by: Jean Yves LEBEY
|
|
||||||
// Copyright (c) 1993-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.
|
|
||||||
|
|
||||||
|
|
||||||
#include <BOP_LoopSet.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_LoopSet::BOP_LoopSet
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_LoopSet::BOP_LoopSet()
|
|
||||||
:
|
|
||||||
myLoopIndex(1),
|
|
||||||
myNbLoop(0)
|
|
||||||
{}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Delete
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_LoopSet::Delete()
|
|
||||||
{}
|
|
||||||
//=======================================================================
|
|
||||||
//function : InitLoop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_LoopSet::InitLoop()
|
|
||||||
{
|
|
||||||
myLoopIterator.Initialize(myListOfLoop);
|
|
||||||
myLoopIndex = 1;
|
|
||||||
myNbLoop = myListOfLoop.Extent();
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : MoreLoop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_LoopSet::MoreLoop() const
|
|
||||||
{
|
|
||||||
Standard_Boolean b = myLoopIterator.More();
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : NextLoop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_LoopSet::NextLoop()
|
|
||||||
{
|
|
||||||
myLoopIndex++;
|
|
||||||
myLoopIterator.Next();
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Loop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const Handle(BOP_Loop)& BOP_LoopSet::Loop() const
|
|
||||||
{
|
|
||||||
const Handle(BOP_Loop)& L = myLoopIterator.Value();
|
|
||||||
return L;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : ChangeListOfLoop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_ListOfLoop& BOP_LoopSet::ChangeListOfLoop()
|
|
||||||
{
|
|
||||||
return myListOfLoop;
|
|
||||||
}
|
|
@ -1,103 +0,0 @@
|
|||||||
-- Created on: 2001-12-24
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 Refiner from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
-- The algorithm to provide the refinition
|
|
||||||
-- for a resulting shape of Boolean Operation
|
|
||||||
-- algorithm.
|
|
||||||
-- (not completed yet)
|
|
||||||
|
|
||||||
|
|
||||||
uses
|
|
||||||
Shape from TopoDS,
|
|
||||||
ListOfShape from TopTools
|
|
||||||
|
|
||||||
--raises
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns Refiner from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
Create(aS: Shape from TopoDS)
|
|
||||||
returns Refiner from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Constructor;
|
|
||||||
---
|
|
||||||
SetShape(me:out;
|
|
||||||
aS: Shape from TopoDS);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetInternals (me:out;
|
|
||||||
aLS:ListOfShape from TopTools);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
Do(me:out);
|
|
||||||
---Purpose:
|
|
||||||
--- Performs the algorithm
|
|
||||||
---
|
|
||||||
IsDone(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
ErrorStatus(me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
Shape(me)
|
|
||||||
returns Shape from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
NbRemovedVertices(me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
NbRemovedEdges(me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
DoInternals(me:out) is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myShape : Shape from TopoDS;
|
|
||||||
myIsDone : Boolean from Standard;
|
|
||||||
myErrorStatus : Integer from Standard;
|
|
||||||
myNbRemovedVertices : Integer from Standard;
|
|
||||||
myNbRemovedEdges : Integer from Standard;
|
|
||||||
myInternals : ListOfShape from TopTools;
|
|
||||||
|
|
||||||
end Refiner;
|
|
@ -1,314 +0,0 @@
|
|||||||
// Created on: 2001-12-24
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2001-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 <BOP_Refiner.ixx>
|
|
||||||
|
|
||||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
|
||||||
#include <TopTools_ListOfShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS_Vertex.hxx>
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Face.hxx>
|
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
#include <TopoDS_Wire.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Builder.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_Refiner::BOP_Refiner
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_Refiner::BOP_Refiner()
|
|
||||||
:
|
|
||||||
myIsDone(Standard_False),
|
|
||||||
myErrorStatus(1),
|
|
||||||
myNbRemovedVertices(0),
|
|
||||||
myNbRemovedEdges(0)
|
|
||||||
{}
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_Refiner::BOP_Refiner
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_Refiner::BOP_Refiner(const TopoDS_Shape& aS)
|
|
||||||
:
|
|
||||||
myIsDone(Standard_False),
|
|
||||||
myErrorStatus(1),
|
|
||||||
myNbRemovedVertices(0),
|
|
||||||
myNbRemovedEdges(0)
|
|
||||||
{
|
|
||||||
myShape=aS;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetShape
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Refiner::SetShape (const TopoDS_Shape& aS)
|
|
||||||
{
|
|
||||||
myShape=aS;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetInternals
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Refiner::SetInternals (const TopTools_ListOfShape& aLS)
|
|
||||||
{
|
|
||||||
myInternals.Clear();
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aLS);
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& aS=anIt.Value();
|
|
||||||
myInternals.Append(aS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: IsDone
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_Refiner::IsDone() const
|
|
||||||
{
|
|
||||||
return myIsDone;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: ErrorStatus
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_Refiner::ErrorStatus() const
|
|
||||||
{
|
|
||||||
return myErrorStatus;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Shape
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
const TopoDS_Shape& BOP_Refiner::Shape() const
|
|
||||||
{
|
|
||||||
return myShape;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: NbRemovedVertices
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_Refiner::NbRemovedVertices() const
|
|
||||||
{
|
|
||||||
return myNbRemovedVertices;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: NbRemovedEdges
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_Refiner::NbRemovedEdges() const
|
|
||||||
{
|
|
||||||
return myNbRemovedEdges;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Do
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Refiner::Do()
|
|
||||||
{
|
|
||||||
DoInternals();
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoInternals
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Refiner::DoInternals()
|
|
||||||
{
|
|
||||||
Standard_Integer i, aNb, aNbF, aNbE;
|
|
||||||
BRep_Builder aBB;
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aMVF, aMFV, aMVE;
|
|
||||||
TopTools_IndexedMapOfShape aMInternals;
|
|
||||||
//
|
|
||||||
// 0. Source Internals
|
|
||||||
TopTools_ListIteratorOfListOfShape anItx(myInternals);
|
|
||||||
for(; anItx.More(); anItx.Next()) {
|
|
||||||
const TopoDS_Shape& aS=anItx.Value();
|
|
||||||
aMInternals.Add(aS);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// 1. Vertices
|
|
||||||
TopExp::MapShapesAndAncestors(myShape, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
|
|
||||||
TopExp::MapShapesAndAncestors(myShape, TopAbs_VERTEX, TopAbs_FACE, aMVF);
|
|
||||||
|
|
||||||
aNb=aMVF.Extent();
|
|
||||||
for (i=1; i<=aNb; ++i) {
|
|
||||||
const TopoDS_Vertex& aV=TopoDS::Vertex(aMVF.FindKey(i));
|
|
||||||
|
|
||||||
if (aV.Orientation()!=TopAbs_INTERNAL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// how many edges attached to the vertex ?
|
|
||||||
aNbE=aMVE.FindFromKey(aV).Extent();
|
|
||||||
|
|
||||||
if (aNbE) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& aLF=aMVF(i);
|
|
||||||
// how many edges attached to the vertex ?
|
|
||||||
aNbF=aLF.Extent();
|
|
||||||
if (aNbF==1) {
|
|
||||||
const TopoDS_Face& aF=TopoDS::Face(aLF.First());
|
|
||||||
|
|
||||||
if (aMFV.Contains(aF)) {
|
|
||||||
TopTools_ListOfShape& aLFWithVertex=aMFV.ChangeFromKey(aF);
|
|
||||||
aLFWithVertex.Append(aV);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape aLFWithVertex;
|
|
||||||
aLFWithVertex.Append(aV);
|
|
||||||
aMFV.Add(aF, aLFWithVertex);
|
|
||||||
}
|
|
||||||
}// if (aNbF==1)
|
|
||||||
}// for (i=1; i<=aNb; ++i)
|
|
||||||
|
|
||||||
aNbF=aMFV.Extent();
|
|
||||||
for (i=1; i<=aNbF; ++i) {
|
|
||||||
const TopoDS_Face& aF=TopoDS::Face(aMFV.FindKey(i));
|
|
||||||
TopoDS_Face* pF=(TopoDS_Face*)&aF;
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& aLV=aMFV(i);
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aLV);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Vertex& aV=TopoDS::Vertex(anIt.Value());
|
|
||||||
//
|
|
||||||
if (aMInternals.Contains(aV)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
pF->Free(Standard_True);
|
|
||||||
aBB.Remove(*pF, aV);
|
|
||||||
myNbRemovedVertices++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// 2. Edges
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aMEF, aMFE;
|
|
||||||
TopExp::MapShapesAndAncestors(myShape, TopAbs_EDGE, TopAbs_FACE, aMEF);
|
|
||||||
|
|
||||||
aNb=aMEF.Extent();
|
|
||||||
for (i=1; i<=aNb; ++i) {
|
|
||||||
const TopoDS_Edge& aE=TopoDS::Edge(aMEF.FindKey(i));
|
|
||||||
if (aE.Orientation()!=TopAbs_INTERNAL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const TopTools_ListOfShape& aLF=aMEF(i);
|
|
||||||
aNbF=aLF.Extent();
|
|
||||||
if (aNbF==1) {
|
|
||||||
const TopoDS_Face& aF=TopoDS::Face(aLF.First());
|
|
||||||
|
|
||||||
if (aMFE.Contains(aF)) {
|
|
||||||
TopTools_ListOfShape& aLFWithEdge=aMFE.ChangeFromKey(aF);
|
|
||||||
aLFWithEdge.Append(aE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape aLFWithEdge;
|
|
||||||
aLFWithEdge.Append(aE);
|
|
||||||
aMFE.Add(aF, aLFWithEdge);
|
|
||||||
}
|
|
||||||
}// if (aNbF==1)
|
|
||||||
}// for (i=1; i<=aNb; ++i)
|
|
||||||
//
|
|
||||||
//modified by NIZNHY-PKV Wed Nov 03 14:27:22 2010f
|
|
||||||
Standard_Boolean bFound;
|
|
||||||
TopoDS_Iterator aItS;
|
|
||||||
TopAbs_Orientation aOr;
|
|
||||||
//modified by NIZNHY-PKV Wed Nov 03 14:27:24 2010t
|
|
||||||
//
|
|
||||||
aNbF=aMFE.Extent();
|
|
||||||
for (i=1; i<=aNbF; ++i) {
|
|
||||||
//modified by NIZNHY-PKV Wed Nov 03 14:29:03 2010f
|
|
||||||
TopoDS_Face aF=TopoDS::Face(aMFE.FindKey(i));
|
|
||||||
aOr=aF.Orientation();
|
|
||||||
if (aOr==TopAbs_INTERNAL) {
|
|
||||||
aF.Orientation(TopAbs_FORWARD);
|
|
||||||
}
|
|
||||||
//const TopoDS_Face& aF=TopoDS::Face(aMFE.FindKey(i));
|
|
||||||
//modified by NIZNHY-PKV Wed Nov 03 14:29:06 2010t
|
|
||||||
TopoDS_Face* pF=(TopoDS_Face*)&aF;
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& aLE=aMFE(i);
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aLE);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Edge& aE=TopoDS::Edge(anIt.Value());
|
|
||||||
//
|
|
||||||
if (aMInternals.Contains(aE)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aMEW;
|
|
||||||
TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_WIRE, aMEW);
|
|
||||||
//
|
|
||||||
if (aMEW.Contains(aE)) {
|
|
||||||
const TopTools_ListOfShape& aLW=aMEW.FindFromKey(aE);
|
|
||||||
TopTools_ListIteratorOfListOfShape aWIt(aLW);
|
|
||||||
for (; aWIt.More(); aWIt.Next()) {
|
|
||||||
const TopoDS_Wire& aW=TopoDS::Wire(aWIt.Value());
|
|
||||||
//
|
|
||||||
//modified by NIZNHY-PKV Wed Nov 03 14:12:48 2010f
|
|
||||||
bFound=Standard_False;
|
|
||||||
aItS.Initialize(aW);
|
|
||||||
for(; aItS.More(); aItS.Next()) {
|
|
||||||
const TopoDS_Shape& aEW=aItS.Value();
|
|
||||||
if (aEW==aE) {
|
|
||||||
bFound=Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (!bFound) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//modified by NIZNHY-PKV Wed Nov 03 14:14:22 2010t
|
|
||||||
//
|
|
||||||
TopoDS_Wire* pW=(TopoDS_Wire*)&aW;
|
|
||||||
pW->Free(Standard_True);
|
|
||||||
//
|
|
||||||
TopExp_Explorer anExp(*pW, TopAbs_EDGE);
|
|
||||||
for (; anExp.More(); anExp.Next()) {
|
|
||||||
const TopoDS_Edge& anEdge=TopoDS::Edge(anExp.Current());
|
|
||||||
aBB.Remove(*pW, anEdge);
|
|
||||||
anExp.Init(*pW, TopAbs_EDGE);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
pF->Free(Standard_True);
|
|
||||||
aBB.Remove(*pF, aW);
|
|
||||||
//modified by NIZNHY-PKV Wed Nov 03 14:29:56 2010f
|
|
||||||
pF->Orientation(aOr);
|
|
||||||
//modified by NIZNHY-PKV Wed Nov 03 14:29:59 2010t
|
|
||||||
myNbRemovedEdges++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}// next inernal edge
|
|
||||||
}// for (i=1; i<=aNbF; ++i)
|
|
||||||
myIsDone=!myIsDone;
|
|
||||||
}
|
|
||||||
// myErrorStatus:
|
|
||||||
// 0 - OK
|
|
||||||
// 1 - Nothing has been done after constructor
|
|
||||||
//
|
|
@ -1,219 +0,0 @@
|
|||||||
-- Created on: 2001-06-06
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 SDFWESFiller from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
-- The algorithm that fills a wire edges set (WES)
|
|
||||||
-- for a couple of faces that are same domain
|
|
||||||
---
|
|
||||||
|
|
||||||
uses
|
|
||||||
Face from TopoDS,
|
|
||||||
ListOfShape from TopTools,
|
|
||||||
DSFiller from BOPTools,
|
|
||||||
PDSFiller from BOPTools,
|
|
||||||
IndexedDataMapOfIntegerState from BOPTools,
|
|
||||||
|
|
||||||
Operation from BOP,
|
|
||||||
WireEdgeSet from BOP,
|
|
||||||
PWireEdgeSet from BOP
|
|
||||||
|
|
||||||
|
|
||||||
--raises
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns SDFWESFiller from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor
|
|
||||||
---
|
|
||||||
Create (nF1: Integer from Standard;
|
|
||||||
nF2: Integer from Standard;
|
|
||||||
aDSF: DSFiller from BOPTools);
|
|
||||||
---Purpose:
|
|
||||||
--- Constructor
|
|
||||||
--- nF1, nF2 - indices of faces in the DataStructue (DS)
|
|
||||||
---
|
|
||||||
SetStatesMap(me:out;
|
|
||||||
aStatesMap: IndexedDataMapOfIntegerState from BOPTools);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetFaces(me:out;
|
|
||||||
nF1: Integer from Standard;
|
|
||||||
nF2: Integer from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetDSFiller(me:out;
|
|
||||||
aDSF: DSFiller from BOPTools);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetOperation (me:out;
|
|
||||||
anOp:Operation from BOP);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
SetSenseFlag (me:out;
|
|
||||||
aFlag:Integer from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
--- Assigns sensitivity flag for the faces in accordance
|
|
||||||
--- with scalar product between theirs normalls
|
|
||||||
--- 1 for same sense; -1 for different sense
|
|
||||||
---
|
|
||||||
|
|
||||||
Prepare(me:out);
|
|
||||||
---Purpose:
|
|
||||||
--- Prepares data for the algorithm
|
|
||||||
---
|
|
||||||
Do (me:out;
|
|
||||||
aWES:WireEdgeSet from BOP);
|
|
||||||
---Purpose:
|
|
||||||
--- Performs the algorithm
|
|
||||||
---
|
|
||||||
DSFiller(me)
|
|
||||||
returns DSFiller from BOPTools;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
StatesMap(me)
|
|
||||||
returns IndexedDataMapOfIntegerState from BOPTools;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
Faces(me;
|
|
||||||
nF1:out Integer from Standard;
|
|
||||||
nF2:out Integer from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
SenseFlag (me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
Operation (me)
|
|
||||||
returns Operation from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
AssignStates (me:out;
|
|
||||||
nF1: Integer from Standard;
|
|
||||||
nF2: Integer from Standard)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Assigns the 2D-State for split parts of
|
|
||||||
--- the edges having 3D-Curves of given faces
|
|
||||||
--- Internal Purpose
|
|
||||||
---
|
|
||||||
PrepareOnParts(me:out)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Prepares ON 2D parts to filled the WES
|
|
||||||
--- Internal Purpose
|
|
||||||
---
|
|
||||||
PrepareWESForZone(me:out;
|
|
||||||
nF1: Integer from Standard;
|
|
||||||
nF2: Integer from Standard)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Fills the WES by split parts of the edges for
|
|
||||||
--- the Common Zone
|
|
||||||
--- Internal Purpose
|
|
||||||
---
|
|
||||||
PrepareWESForCut(me:out;
|
|
||||||
nF1: Integer from Standard;
|
|
||||||
nF2: Integer from Standard)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Fills the WES by split parts of the edges for
|
|
||||||
--- the Cut operation
|
|
||||||
--- Internal Purpose
|
|
||||||
---
|
|
||||||
PrepareOnParts(me:out;
|
|
||||||
nF1: Integer from Standard;
|
|
||||||
nF2: Integer from Standard;
|
|
||||||
Op : Operation from BOP)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Fills the WES by split parts (ON 2D) of the edges
|
|
||||||
--- Internal Purpose
|
|
||||||
---
|
|
||||||
PrepareFaces(me;
|
|
||||||
nF1: Integer from Standard;
|
|
||||||
nF2: Integer from Standard;
|
|
||||||
aF1:out Face from TopoDS;
|
|
||||||
aF2:out Face from TopoDS)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Make orientation of the faces consistent
|
|
||||||
--- Internal Purpose
|
|
||||||
---
|
|
||||||
AssignDEStates (me:out;
|
|
||||||
nF1: Integer from Standard;
|
|
||||||
nF2: Integer from Standard)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Assigns the 2D-State for split parts of
|
|
||||||
--- the edges that do not have 3D-Curves of given faces
|
|
||||||
--- Internal Purpose
|
|
||||||
---
|
|
||||||
AssignDEStates (me:out;
|
|
||||||
nF1: Integer from Standard;
|
|
||||||
nE1: Integer from Standard;
|
|
||||||
nF2: Integer from Standard)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Assigns the 2D-State for split parts of
|
|
||||||
--- the edge nE1 that do not have 3D-Curves from face nF1
|
|
||||||
---
|
|
||||||
--- Internal Purpose
|
|
||||||
---
|
|
||||||
UpdateDEStates3D (me:out);
|
|
||||||
---Purpose:
|
|
||||||
--- Update 3D-State for edges
|
|
||||||
---
|
|
||||||
RejectedOnParts(me)
|
|
||||||
returns ListOfShape from TopTools;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
-- Returns all split edges of nF1 that are CB with
|
|
||||||
-- splis of nF1 but not included in myWES,
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myDSFiller : PDSFiller from BOPTools;
|
|
||||||
myOperation : Operation from BOP;
|
|
||||||
myNF1 : Integer from Standard;
|
|
||||||
myNF2 : Integer from Standard;
|
|
||||||
|
|
||||||
myWES : PWireEdgeSet from BOP;
|
|
||||||
myStatesMap: IndexedDataMapOfIntegerState from BOPTools;
|
|
||||||
mySenseFlag: Integer from Standard;
|
|
||||||
myRejectedOnParts: ListOfShape from TopTools;
|
|
||||||
|
|
||||||
end SDFWESFiller;
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,96 +0,0 @@
|
|||||||
-- Created on: 2001-04-13
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 SFSCorrector from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- the algorithm is to change the Shell Faces Set (SFS)contents.
|
|
||||||
--- The NewSFS will contain only shells
|
|
||||||
--- instead of shells and faces.
|
|
||||||
---
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
ShellFaceSet from BOP,
|
|
||||||
PShellFaceSet from BOP,
|
|
||||||
ListOfConnexityBlock from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns SFSCorrector from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
SetSFS (me:out;
|
|
||||||
aSFS: ShellFaceSet from BOP);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
Do (me:out);
|
|
||||||
---Purpose:
|
|
||||||
--- Performs the algorithm of two steps
|
|
||||||
--- 1. Make conexity blocks ( DoConnexityBlocks() )
|
|
||||||
--- 2. Make corrections ( DoCorrections() )
|
|
||||||
---
|
|
||||||
DoConnexityBlocks(me:out)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal Purpose
|
|
||||||
---
|
|
||||||
DoCorrections(me:out)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal Purpose
|
|
||||||
---
|
|
||||||
IsDone(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
ErrorStatus (me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
--- - 1 - Nothing is done because only constructor has been called
|
|
||||||
---
|
|
||||||
SFS (me:out)
|
|
||||||
returns ShellFaceSet from BOP;
|
|
||||||
---C++: return &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
NewSFS (me:out)
|
|
||||||
returns ShellFaceSet from BOP;
|
|
||||||
---C++: return &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
--- Returns the resulting SFS
|
|
||||||
---
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
mySFS : PShellFaceSet from BOP;
|
|
||||||
myNewSFS : ShellFaceSet from BOP;
|
|
||||||
myConnexityBlocks : ListOfConnexityBlock from BOP;
|
|
||||||
myIsDone : Boolean from Standard;
|
|
||||||
myErrorStatus : Integer from Standard;
|
|
||||||
|
|
||||||
end SFSCorrector;
|
|
@ -1,236 +0,0 @@
|
|||||||
// Created on: 2001-08-02
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2001-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 <BOP_SFSCorrector.ixx>
|
|
||||||
|
|
||||||
#include <TopTools_IndexedMapOfOrientedShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
#include <TopoDS_Shell.hxx>
|
|
||||||
#include <TopoDS_Face.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Builder.hxx>
|
|
||||||
|
|
||||||
#include <BOP_ConnexityBlock.hxx>
|
|
||||||
#include <BOP_ListIteratorOfListOfConnexityBlock.hxx>
|
|
||||||
#include <BOP_ShellSplitter.hxx>
|
|
||||||
#include <BOPTColStd_ListOfListOfShape.hxx>
|
|
||||||
#include <BOPTColStd_ListIteratorOfListOfListOfShape.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
void MakeShell (const TopTools_ListOfShape& aLE,
|
|
||||||
TopoDS_Shell& newShell);
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_SFSCorrector::BOP_SFSCorrector
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_SFSCorrector::BOP_SFSCorrector()
|
|
||||||
:
|
|
||||||
myIsDone(Standard_False),
|
|
||||||
myErrorStatus(1)
|
|
||||||
{}
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetSFS
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_SFSCorrector::SetSFS (const BOP_ShellFaceSet& aSFS)
|
|
||||||
{
|
|
||||||
BOP_ShellFaceSet* pSFS=(BOP_ShellFaceSet*) &aSFS;
|
|
||||||
mySFS=pSFS;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: SFS
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_ShellFaceSet& BOP_SFSCorrector::SFS ()
|
|
||||||
{
|
|
||||||
return *mySFS;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: NewSFS
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_ShellFaceSet& BOP_SFSCorrector::NewSFS ()
|
|
||||||
{
|
|
||||||
return myNewSFS;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: IsDone
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_SFSCorrector::IsDone () const
|
|
||||||
{
|
|
||||||
return myIsDone;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: ErrorStatus
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_SFSCorrector::ErrorStatus () const
|
|
||||||
{
|
|
||||||
return myErrorStatus;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Do
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_SFSCorrector::Do()
|
|
||||||
{
|
|
||||||
DoConnexityBlocks();
|
|
||||||
DoCorrections();
|
|
||||||
myIsDone=Standard_True;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoConnexityBlocks
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_SFSCorrector::DoConnexityBlocks()
|
|
||||||
{
|
|
||||||
Standard_Boolean EnewinM, aGoOn;
|
|
||||||
Standard_Integer Mextent, IsRegular, aNbNeighbours, Eindex;
|
|
||||||
TopTools_IndexedMapOfOrientedShape myOrientedShapeMap, aMap;
|
|
||||||
//
|
|
||||||
mySFS->InitStartElements();
|
|
||||||
for (; mySFS->MoreStartElements(); mySFS->NextStartElement()) {
|
|
||||||
const TopoDS_Shape& anE = mySFS->StartElement();
|
|
||||||
Mextent = myOrientedShapeMap.Extent();
|
|
||||||
|
|
||||||
Eindex = myOrientedShapeMap.Add(anE);
|
|
||||||
|
|
||||||
EnewinM = (Eindex > Mextent);
|
|
||||||
if (EnewinM) {
|
|
||||||
//
|
|
||||||
// make a new block starting at element Eindex
|
|
||||||
IsRegular=Standard_True;
|
|
||||||
aNbNeighbours=0;
|
|
||||||
Mextent = myOrientedShapeMap.Extent();
|
|
||||||
//
|
|
||||||
aMap.Clear();
|
|
||||||
aMap.Add(anE);
|
|
||||||
//
|
|
||||||
aGoOn = (Eindex <= Mextent);
|
|
||||||
while (aGoOn) {
|
|
||||||
const TopoDS_Shape& anEE = myOrientedShapeMap(Eindex);
|
|
||||||
aNbNeighbours = mySFS->MaxNumberSubShape(anEE);
|
|
||||||
|
|
||||||
IsRegular = IsRegular && (aNbNeighbours == 2);
|
|
||||||
//
|
|
||||||
mySFS->InitNeighbours(anEE);
|
|
||||||
for (; mySFS->MoreNeighbours(); mySFS->NextNeighbour()) {
|
|
||||||
const TopoDS_Shape& aNeignbE = mySFS->Neighbour();
|
|
||||||
myOrientedShapeMap.Add(aNeignbE);
|
|
||||||
//
|
|
||||||
aMap.Add(aNeignbE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Eindex++;
|
|
||||||
Mextent = myOrientedShapeMap.Extent();
|
|
||||||
aGoOn = (Eindex <= Mextent);
|
|
||||||
} // end of while aGoOn
|
|
||||||
|
|
||||||
BOP_ConnexityBlock aConnexityBlock;
|
|
||||||
aConnexityBlock.SetShapes(aMap);
|
|
||||||
aConnexityBlock.SetRegularity(IsRegular);
|
|
||||||
myConnexityBlocks.Append(aConnexityBlock);
|
|
||||||
} // end of if (EnewinM)
|
|
||||||
} // end of for (; mySFS->MoreStartElements();...
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoCorrections
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_SFSCorrector::DoCorrections()
|
|
||||||
{
|
|
||||||
Standard_Boolean anIsRegular, anIsNothingToDo, anIsDone;
|
|
||||||
TopoDS_Shell aShell;
|
|
||||||
BOP_ListIteratorOfListOfConnexityBlock aCBIt;
|
|
||||||
|
|
||||||
//myNewSFS.Initialize(mySFS->Face());
|
|
||||||
anIsDone=Standard_False;
|
|
||||||
anIsNothingToDo=Standard_True;
|
|
||||||
|
|
||||||
aCBIt.Initialize(myConnexityBlocks);
|
|
||||||
for (; aCBIt.More(); aCBIt.Next()) {
|
|
||||||
const BOP_ConnexityBlock& aCB=aCBIt.Value();
|
|
||||||
const TopTools_ListOfShape& aListOfEdges=aCB.Shapes();
|
|
||||||
|
|
||||||
anIsRegular=aCB.IsRegular();
|
|
||||||
|
|
||||||
if (anIsRegular) {
|
|
||||||
MakeShell(aListOfEdges, aShell);
|
|
||||||
myNewSFS.AddShape (aShell);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Treatment of non regular Connexity Block
|
|
||||||
BOP_ShellSplitter aShellSplitter;
|
|
||||||
aShellSplitter.DoWithListOfEdges(aListOfEdges);
|
|
||||||
|
|
||||||
anIsDone=aShellSplitter.IsDone();
|
|
||||||
anIsNothingToDo=aShellSplitter.IsNothingToDo();
|
|
||||||
|
|
||||||
if (!anIsDone || anIsNothingToDo) {
|
|
||||||
MakeShell(aListOfEdges, aShell);
|
|
||||||
myNewSFS.AddShape (aShell);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
const BOPTColStd_ListOfListOfShape& aSSS=aShellSplitter.Shapes();
|
|
||||||
|
|
||||||
BOPTColStd_ListIteratorOfListOfListOfShape aShellIt(aSSS);
|
|
||||||
for (; aShellIt.More(); aShellIt.Next()) {
|
|
||||||
const TopTools_ListOfShape& aListF=aShellIt.Value();
|
|
||||||
//
|
|
||||||
MakeShell(aListF, aShell);
|
|
||||||
myNewSFS.AddShape (aShell);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: MakeShell
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void MakeShell(const TopTools_ListOfShape& aLE,
|
|
||||||
TopoDS_Shell& newShell)
|
|
||||||
{
|
|
||||||
BRep_Builder aBB;
|
|
||||||
aBB.MakeShell(newShell);
|
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aLE);
|
|
||||||
for (; anIt.More(); anIt.Next()){
|
|
||||||
const TopoDS_Face& aF=TopoDS::Face(anIt.Value());
|
|
||||||
aBB.Add(newShell, aF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// myErrorStatus:
|
|
||||||
//
|
|
||||||
// 1 - Nothing is done because only constructor has been called
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
@ -1,75 +0,0 @@
|
|||||||
-- Created on: 2001-05-18
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 Section from BOP inherits Builder from BOP
|
|
||||||
|
|
||||||
----Purpose: Performs the Boolean Operation (BO) Section
|
|
||||||
--- for the shapes
|
|
||||||
|
|
||||||
|
|
||||||
uses
|
|
||||||
DSFiller from BOPTools,
|
|
||||||
HistoryCollector from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns Section from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
Do (me:out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- Does the BO from the beggining to the end,
|
|
||||||
--- i.e. create new DataStructure, DSFiller,
|
|
||||||
--- compute all interferences, compute states,
|
|
||||||
--- build result etc
|
|
||||||
---
|
|
||||||
Do (me:out;toApprox : Boolean from Standard;
|
|
||||||
toComputePCurve1 : Boolean from Standard;
|
|
||||||
toComputePCurve2 : Boolean from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Does the BO from the beggining to the end,
|
|
||||||
--- i.e. create new DataStructure, DSFiller,
|
|
||||||
--- compute all interferences, compute states,
|
|
||||||
--- build result etc
|
|
||||||
---
|
|
||||||
|
|
||||||
DoWithFiller (me:out;
|
|
||||||
aDSF: DSFiller from BOPTools)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- Does the BO using existing Filler to the end
|
|
||||||
---
|
|
||||||
|
|
||||||
Destroy (me: in out)
|
|
||||||
is redefined;
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_Section(){Destroy();}"
|
|
||||||
---Purpose:
|
|
||||||
--- Destructor
|
|
||||||
---
|
|
||||||
|
|
||||||
SetHistoryCollector(me: in out; theHistory: HistoryCollector from BOP)
|
|
||||||
is redefined virtual;
|
|
||||||
|
|
||||||
--fields
|
|
||||||
|
|
||||||
end Section;
|
|
@ -1,302 +0,0 @@
|
|||||||
// Created on: 2001-05-18
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2001-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 <BOP_Section.ixx>
|
|
||||||
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
#include <TopoDS_Compound.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Builder.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>
|
|
||||||
#include <BOPTools_InterferencePool.hxx>
|
|
||||||
#include <BOPTools_CArray1OfSSInterference.hxx>
|
|
||||||
#include <BOPTools_PaveFiller.hxx>
|
|
||||||
#include <BOPTools_SSIntersectionAttribute.hxx>
|
|
||||||
#include <BOPTools_Tools2D.hxx>
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
#include <Geom_Curve.hxx>
|
|
||||||
#include <Geom_TrimmedCurve.hxx>
|
|
||||||
#include <TopoDS_Face.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
|
|
||||||
#include <BOP_CorrectTolerances.hxx>
|
|
||||||
|
|
||||||
#include <BOPTColStd_Dump.hxx>
|
|
||||||
|
|
||||||
#include <BOP_SectionHistoryCollector.hxx>
|
|
||||||
|
|
||||||
#include <Standard_Failure.hxx>
|
|
||||||
#include <Standard_ErrorHandler.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_Section::BOP_Section
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_Section::BOP_Section()
|
|
||||||
{
|
|
||||||
SetOperation (BOP_SECTION);
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Destroy
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Section::Destroy() {}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: Do
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Section::Do()
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
myIsDone=Standard_False;
|
|
||||||
|
|
||||||
TopAbs_ShapeEnum aT1, aT2;
|
|
||||||
|
|
||||||
aT1=myShape1.ShapeType();
|
|
||||||
aT2=myShape2.ShapeType();
|
|
||||||
|
|
||||||
BOP_Builder::SortTypes (aT1, aT2);
|
|
||||||
//
|
|
||||||
// Filling the DS
|
|
||||||
BOPTools_DSFiller aDSFiller;
|
|
||||||
aDSFiller.SetShapes (myShape1, myShape2);
|
|
||||||
aDSFiller.Perform ();
|
|
||||||
DoWithFiller(aDSFiller);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
//=======================================================================
|
|
||||||
// function: Do
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Section::Do(const Standard_Boolean toApprox,
|
|
||||||
const Standard_Boolean toComputePCurve1,
|
|
||||||
const Standard_Boolean toComputePCurve2)
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
myIsDone=Standard_False;
|
|
||||||
|
|
||||||
TopAbs_ShapeEnum aT1, aT2;
|
|
||||||
|
|
||||||
aT1=myShape1.ShapeType();
|
|
||||||
aT2=myShape2.ShapeType();
|
|
||||||
|
|
||||||
BOP_Builder::SortTypes (aT1, aT2);
|
|
||||||
//
|
|
||||||
// Filling the DS
|
|
||||||
BOPTools_DSFiller aDSFiller;
|
|
||||||
aDSFiller.SetShapes (myShape1, myShape2);
|
|
||||||
|
|
||||||
BOPTools_SSIntersectionAttribute aSectionAttribute(toApprox,
|
|
||||||
toComputePCurve1,
|
|
||||||
toComputePCurve2);
|
|
||||||
aDSFiller.Perform (aSectionAttribute);
|
|
||||||
DoWithFiller(aDSFiller);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoDoWithFiller
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Section::DoWithFiller(const BOPTools_DSFiller& aDSFiller)
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
myIsDone=Standard_False;
|
|
||||||
|
|
||||||
//
|
|
||||||
myResultMap.Clear();
|
|
||||||
myModifiedMap.Clear();
|
|
||||||
myDSFiller=(BOPTools_DSFiller*) &aDSFiller;
|
|
||||||
//
|
|
||||||
|
|
||||||
try {
|
|
||||||
OCC_CATCH_SIGNALS
|
|
||||||
Standard_Boolean addPCurve1 = aDSFiller.PaveFiller().SectionAttribute().PCurveOnS1();
|
|
||||||
Standard_Boolean addPCurve2 = aDSFiller.PaveFiller().SectionAttribute().PCurveOnS2();
|
|
||||||
|
|
||||||
Standard_Integer i, j, nF1, nF2, aNbFFs, aNbS, aNbCurves, nSect;
|
|
||||||
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=aDSFiller.DS();
|
|
||||||
const BOPTools_InterferencePool& anInterfPool=aDSFiller.InterfPool();
|
|
||||||
BOPTools_InterferencePool* pInterfPool=
|
|
||||||
(BOPTools_InterferencePool*) &anInterfPool;
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs=
|
|
||||||
pInterfPool->SSInterferences();
|
|
||||||
//
|
|
||||||
TopTools_IndexedMapOfShape aMap;
|
|
||||||
//
|
|
||||||
aNbFFs=aFFs.Extent();
|
|
||||||
for (i=1; i<=aNbFFs; ++i) {
|
|
||||||
BOPTools_SSInterference& aFFi=aFFs(i);
|
|
||||||
//
|
|
||||||
nF1=aFFi.Index1();
|
|
||||||
nF2=aFFi.Index2();
|
|
||||||
|
|
||||||
TopoDS_Face aF1FWD = TopoDS::Face(aDSFiller.DS().Shape(nF1));
|
|
||||||
aF1FWD.Orientation(TopAbs_FORWARD);
|
|
||||||
TopoDS_Face aF2FWD = TopoDS::Face(aDSFiller.DS().Shape(nF2));
|
|
||||||
aF2FWD.Orientation(TopAbs_FORWARD);
|
|
||||||
//
|
|
||||||
// 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(addPCurve1) {
|
|
||||||
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(addPCurve2) {
|
|
||||||
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD);
|
|
||||||
}
|
|
||||||
aMap.Add(aS);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
if(addPCurve1 || addPCurve2) {
|
|
||||||
const IntTools_Curve& aIC = aBC.Curve();
|
|
||||||
const TopoDS_Edge& aE = TopoDS::Edge(aS);
|
|
||||||
Standard_Real f, l;
|
|
||||||
const Handle(Geom_Curve)& aC3DE = BRep_Tool::Curve(aE, f, l);
|
|
||||||
Handle(Geom_TrimmedCurve) aC3DETrim;
|
|
||||||
|
|
||||||
if(!aC3DE.IsNull()) {
|
|
||||||
aC3DETrim = new Geom_TrimmedCurve(aC3DE, f, l);
|
|
||||||
}
|
|
||||||
BRep_Builder aBB;
|
|
||||||
Standard_Real aTolEdge = BRep_Tool::Tolerance(aE);
|
|
||||||
Standard_Real aTolR2D = aFFi.TolR2D();
|
|
||||||
Standard_Real aTolFact = Max(aTolEdge, aTolR2D);
|
|
||||||
|
|
||||||
if(addPCurve1 && !BOPTools_Tools2D::HasCurveOnSurface(aE, aF1FWD)) {
|
|
||||||
Handle(Geom2d_Curve) aC2d = aIC.FirstCurve2d();
|
|
||||||
|
|
||||||
if(!aC3DETrim.IsNull()) {
|
|
||||||
Handle(Geom2d_Curve) aC2dNew;
|
|
||||||
|
|
||||||
if(aC3DE->IsPeriodic()) {
|
|
||||||
BOPTools_Tools2D::AdjustPCurveOnFace(aF1FWD, f, l, aC2d, aC2dNew);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
BOPTools_Tools2D::AdjustPCurveOnFace(aF1FWD, aC3DETrim, aC2d, aC2dNew);
|
|
||||||
}
|
|
||||||
aC2d = aC2dNew;
|
|
||||||
}
|
|
||||||
aBB.UpdateEdge(aE, aC2d, aF1FWD, aTolFact);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(addPCurve2 && !BOPTools_Tools2D::HasCurveOnSurface(aE, aF2FWD)) {
|
|
||||||
Handle(Geom2d_Curve) aC2d = aIC.SecondCurve2d();
|
|
||||||
|
|
||||||
if(!aC3DETrim.IsNull()) {
|
|
||||||
Handle(Geom2d_Curve) aC2dNew;
|
|
||||||
|
|
||||||
if(aC3DE->IsPeriodic()) {
|
|
||||||
BOPTools_Tools2D::AdjustPCurveOnFace(aF2FWD, f, l, aC2d, aC2dNew);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
BOPTools_Tools2D::AdjustPCurveOnFace(aF2FWD, aC3DETrim, aC2d, aC2dNew);
|
|
||||||
}
|
|
||||||
aC2d = aC2dNew;
|
|
||||||
}
|
|
||||||
aBB.UpdateEdge(aE, aC2d, aF2FWD, aTolFact);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
aMap.Add(aS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
BRep_Builder BB;
|
|
||||||
TopoDS_Compound aCompound;
|
|
||||||
BB.MakeCompound(aCompound);
|
|
||||||
|
|
||||||
aNbS=aMap.Extent();
|
|
||||||
|
|
||||||
for (i=1; i<=aNbS; i++) {
|
|
||||||
const TopoDS_Shape& aS=aMap(i);
|
|
||||||
BB.Add(aCompound, aS);
|
|
||||||
mySectionEdges.Append(aS);
|
|
||||||
}
|
|
||||||
myResult=aCompound;
|
|
||||||
BOP_CorrectTolerances::CorrectTolerances(myResult, 0.01);
|
|
||||||
//
|
|
||||||
if (!myErrorStatus) {
|
|
||||||
FillModified();
|
|
||||||
|
|
||||||
if(!myHistory.IsNull()) {
|
|
||||||
Handle(BOP_SectionHistoryCollector) aHistory =
|
|
||||||
Handle(BOP_SectionHistoryCollector)::DownCast(myHistory);
|
|
||||||
aHistory->SetResult(myResult, myDSFiller);
|
|
||||||
}
|
|
||||||
myIsDone=Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch ( Standard_Failure ) {
|
|
||||||
myErrorStatus = 1;
|
|
||||||
BOPTColStd_Dump::PrintMessage("Can not build result\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetHistoryCollector
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_Section::SetHistoryCollector(const Handle(BOP_HistoryCollector)& theHistory)
|
|
||||||
{
|
|
||||||
if(theHistory.IsNull() ||
|
|
||||||
!theHistory->IsKind(STANDARD_TYPE(BOP_SectionHistoryCollector)))
|
|
||||||
myHistory.Nullify();
|
|
||||||
else
|
|
||||||
myHistory = theHistory;
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
-- Created on: 2003-04-29
|
|
||||||
-- Created by: Michael KLOKOV
|
|
||||||
-- Copyright (c) 2003-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 SectionHistoryCollector from BOP inherits HistoryCollector from BOP
|
|
||||||
|
|
||||||
uses
|
|
||||||
Shape from TopoDS,
|
|
||||||
Operation from BOP,
|
|
||||||
PDSFiller from BOPTools,
|
|
||||||
ListOfShape from TopTools,
|
|
||||||
IndexedMapOfShape from TopTools,
|
|
||||||
IndexedDataMapOfShapeListOfShape from TopTools
|
|
||||||
|
|
||||||
is
|
|
||||||
Create(theShape1 : Shape from TopoDS;
|
|
||||||
theShape2 : Shape from TopoDS)
|
|
||||||
returns SectionHistoryCollector from BOP;
|
|
||||||
|
|
||||||
SetResult(me: mutable; theResult: Shape from TopoDS;
|
|
||||||
theDSFiller: PDSFiller from BOPTools)
|
|
||||||
is redefined virtual;
|
|
||||||
|
|
||||||
|
|
||||||
-- private
|
|
||||||
FillFaceSection(me: mutable; theDSFiller : PDSFiller from BOPTools;
|
|
||||||
theResultMap: IndexedMapOfShape from TopTools)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
FillEdgeSection(me: mutable; theEdge : Shape from TopoDS;
|
|
||||||
theDSFiller : PDSFiller from BOPTools;
|
|
||||||
theResultMap: IndexedMapOfShape from TopTools;
|
|
||||||
theVEMapRes : IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
theEFMap : IndexedDataMapOfShapeListOfShape from TopTools)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
end SectionHistoryCollector from BOP;
|
|
@ -1,605 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
#include <BOP_SectionHistoryCollector.ixx>
|
|
||||||
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
#include <BOPTools_DSFiller.hxx>
|
|
||||||
#include <BOPTools_InterferencePool.hxx>
|
|
||||||
#include <BOPTools_SSInterference.hxx>
|
|
||||||
#include <BOPTools_ListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPave.hxx>
|
|
||||||
#include <BOPTools_PaveBlock.hxx>
|
|
||||||
#include <BOPTools_Curve.hxx>
|
|
||||||
#include <BOPTools_PavePool.hxx>
|
|
||||||
#include <BOPTools_PaveFiller.hxx>
|
|
||||||
#include <BOPTools_VVInterference.hxx>
|
|
||||||
#include <BOPTools_VEInterference.hxx>
|
|
||||||
#include <BOPTools_VSInterference.hxx>
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopTools_MapOfShape.hxx>
|
|
||||||
|
|
||||||
static Standard_Boolean AddNewShape(const TopoDS_Shape& theKey,
|
|
||||||
const TopoDS_Shape& theItem,
|
|
||||||
TopTools_DataMapOfShapeListOfShape& theMap);
|
|
||||||
|
|
||||||
// ============================================================================================
|
|
||||||
// function: Constructor
|
|
||||||
// purpose:
|
|
||||||
// ============================================================================================
|
|
||||||
BOP_SectionHistoryCollector::BOP_SectionHistoryCollector(const TopoDS_Shape& theShape1,
|
|
||||||
const TopoDS_Shape& theShape2) :
|
|
||||||
BOP_HistoryCollector(theShape1,theShape2, BOP_SECTION)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================================================================================
|
|
||||||
// function: SetResult
|
|
||||||
// purpose:
|
|
||||||
// ============================================================================================
|
|
||||||
void BOP_SectionHistoryCollector::SetResult(const TopoDS_Shape& theResult,
|
|
||||||
const BOPTools_PDSFiller& theDSFiller)
|
|
||||||
{
|
|
||||||
myResult = theResult;
|
|
||||||
|
|
||||||
if(myResult.IsNull())
|
|
||||||
return;
|
|
||||||
|
|
||||||
TopAbs_ShapeEnum aResultType = TopAbs_EDGE;
|
|
||||||
Standard_Boolean bcontainsface1 = Standard_False;
|
|
||||||
Standard_Boolean bcontainsface2 = Standard_False;
|
|
||||||
|
|
||||||
Standard_Boolean bcontainsedge1 = Standard_False;
|
|
||||||
Standard_Boolean bcontainsedge2 = Standard_False;
|
|
||||||
|
|
||||||
TopExp_Explorer anExp(myS1, TopAbs_FACE);
|
|
||||||
|
|
||||||
if(anExp.More()) {
|
|
||||||
bcontainsface1 = Standard_True;
|
|
||||||
bcontainsedge1 = Standard_True;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
anExp.Init(myS1, TopAbs_EDGE);
|
|
||||||
|
|
||||||
if(anExp.More()) {
|
|
||||||
bcontainsedge1 = Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
anExp.Init(myS2, TopAbs_FACE);
|
|
||||||
|
|
||||||
if(anExp.More()) {
|
|
||||||
bcontainsface2 = Standard_True;
|
|
||||||
bcontainsedge2 = Standard_True;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
anExp.Init(myS2, TopAbs_EDGE);
|
|
||||||
|
|
||||||
if(anExp.More()) {
|
|
||||||
bcontainsedge2 = Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bcontainsface1 && bcontainsface2)
|
|
||||||
aResultType = TopAbs_EDGE;
|
|
||||||
else if(bcontainsedge1 && bcontainsedge2)
|
|
||||||
aResultType = TopAbs_VERTEX;
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
myHasDeleted = Standard_True;
|
|
||||||
|
|
||||||
|
|
||||||
TopTools_IndexedMapOfShape aMap;
|
|
||||||
TopExp::MapShapes(myResult, aResultType, aMap);
|
|
||||||
|
|
||||||
if(aResultType == TopAbs_EDGE) {
|
|
||||||
FillFaceSection(theDSFiller, aMap);
|
|
||||||
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aEFMap;
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aVEMap;
|
|
||||||
|
|
||||||
TopExp::MapShapesAndAncestors(myResult, TopAbs_VERTEX, TopAbs_EDGE, aVEMap);
|
|
||||||
TopExp::MapShapesAndAncestors(myS1, TopAbs_EDGE, TopAbs_FACE, aEFMap);
|
|
||||||
TopExp::MapShapesAndAncestors(myS2, TopAbs_EDGE, TopAbs_FACE, aEFMap);
|
|
||||||
|
|
||||||
TopTools_IndexedMapOfShape aResultMap, aFreeBoundaryMap;
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
|
|
||||||
for(i = 1; i <= aEFMap.Extent(); i++) {
|
|
||||||
if(aEFMap.FindFromIndex(i).Extent() < 2)
|
|
||||||
aFreeBoundaryMap.Add(aEFMap.FindKey(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 1; i <= aFreeBoundaryMap.Extent(); i++) {
|
|
||||||
const TopoDS_Shape& anEdge = aFreeBoundaryMap.FindKey(i);
|
|
||||||
FillEdgeSection(anEdge, theDSFiller, aMap, aVEMap, aEFMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================================================================================
|
|
||||||
// function: FillFaceSection
|
|
||||||
// purpose:
|
|
||||||
// ============================================================================================
|
|
||||||
void BOP_SectionHistoryCollector::FillFaceSection(const BOPTools_PDSFiller& theDSFiller,
|
|
||||||
const TopTools_IndexedMapOfShape& theResultMap)
|
|
||||||
{
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS = theDSFiller->DS();
|
|
||||||
const BOPTools_InterferencePool& anInterfPool = theDSFiller->InterfPool();
|
|
||||||
BOPTools_InterferencePool* pInterfPool = (BOPTools_InterferencePool*) &anInterfPool;
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs = pInterfPool->SSInterferences();
|
|
||||||
//
|
|
||||||
TopTools_IndexedMapOfShape aMap;
|
|
||||||
Standard_Integer aNbFFs = aFFs.Extent();
|
|
||||||
Standard_Integer i = 0, j = 0;
|
|
||||||
|
|
||||||
for (i=1; i<=aNbFFs; ++i) {
|
|
||||||
BOPTools_SSInterference& aFFi = aFFs(i);
|
|
||||||
//
|
|
||||||
Standard_Integer nF1 = aFFi.Index1();
|
|
||||||
Standard_Integer nF2 = aFFi.Index2();
|
|
||||||
TopoDS_Shape aF1 = aDS.Shape(nF1);
|
|
||||||
TopoDS_Shape aF2 = aDS.Shape(nF2);
|
|
||||||
Standard_Integer nSect = 0;
|
|
||||||
|
|
||||||
// Old Section Edges
|
|
||||||
const BOPTools_ListOfPaveBlock& aSectList = aFFi.PaveBlocks();
|
|
||||||
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);
|
|
||||||
|
|
||||||
if(theResultMap.Contains(aS)) {
|
|
||||||
TopTools_ListOfShape thelist;
|
|
||||||
if(!myGenMap.IsBound(aF1))
|
|
||||||
myGenMap.Bind(aF1, thelist );
|
|
||||||
|
|
||||||
if(!myGenMap.IsBound(aF2))
|
|
||||||
myGenMap.Bind(aF2, thelist);
|
|
||||||
|
|
||||||
for(Standard_Integer fit = 0; fit < 2; fit++) {
|
|
||||||
if(fit == 0)
|
|
||||||
AddNewShape(aF1, aS, myGenMap);
|
|
||||||
else
|
|
||||||
AddNewShape(aF2, aS, myGenMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// New Section Edges
|
|
||||||
BOPTools_SequenceOfCurves& aBCurves = aFFi.Curves();
|
|
||||||
Standard_Integer aNbCurves = aBCurves.Length();
|
|
||||||
|
|
||||||
for (j = 1; j <= aNbCurves; j++) {
|
|
||||||
BOPTools_Curve& aBC = aBCurves(j);
|
|
||||||
const BOPTools_ListOfPaveBlock& aSectEdges = aBC.NewPaveBlocks();
|
|
||||||
|
|
||||||
BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSectEdges);
|
|
||||||
|
|
||||||
for (; aPBIt.More(); aPBIt.Next()) {
|
|
||||||
BOPTools_PaveBlock& aPB = aPBIt.Value();
|
|
||||||
nSect = aPB.Edge();
|
|
||||||
const TopoDS_Shape& aS = aDS.GetShape(nSect);
|
|
||||||
|
|
||||||
if(theResultMap.Contains(aS) && !aMap.Contains(aS)) {
|
|
||||||
TopTools_ListOfShape thelist1;
|
|
||||||
|
|
||||||
if(!myGenMap.IsBound(aF1)) {
|
|
||||||
myGenMap.Bind(aF1, thelist1);
|
|
||||||
}
|
|
||||||
myGenMap.ChangeFind(aF1).Append(aS);
|
|
||||||
|
|
||||||
if(!myGenMap.IsBound(aF2))
|
|
||||||
myGenMap.Bind(aF2, thelist1);
|
|
||||||
myGenMap.ChangeFind(aF2).Append(aS);
|
|
||||||
aMap.Add(aS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modified by skv - Wed Nov 5 15:52:48 2003 OCC3644 Begin
|
|
||||||
// ============================================================================================
|
|
||||||
// function: IsEdgeToAdd
|
|
||||||
// purpose:
|
|
||||||
// ============================================================================================
|
|
||||||
|
|
||||||
static Standard_Boolean IsEdgeToAdd
|
|
||||||
(const TopoDS_Shape &theEdge,
|
|
||||||
const TopTools_IndexedMapOfShape &theResultMap,
|
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape &theVEMapRes,
|
|
||||||
const BOPTools_PDSFiller &theDSFiller)
|
|
||||||
{
|
|
||||||
if (theEdge.ShapeType() != TopAbs_EDGE)
|
|
||||||
return Standard_True;
|
|
||||||
|
|
||||||
const BooleanOperations_ShapesDataStructure &aDS=theDSFiller->DS();
|
|
||||||
const BOPTools_PaveFiller &aPvFiller=theDSFiller->PaveFiller();
|
|
||||||
const BOPTools_SplitShapesPool &aSplitShapesPool=aPvFiller.SplitShapesPool();
|
|
||||||
Standard_Integer aNbE1 = aDS.ShapeIndex(theEdge, 1);
|
|
||||||
Standard_Integer aNbE2 = aDS.ShapeIndex(theEdge, 2);
|
|
||||||
Standard_Integer aNbE = (aNbE1 == 0) ? aNbE2 : aNbE1;
|
|
||||||
|
|
||||||
if (aNbE == 0)
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
const BOPTools_ListOfPaveBlock &aLPB=aSplitShapesPool(aDS.RefEdge(aNbE));
|
|
||||||
BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aLPB);
|
|
||||||
|
|
||||||
for (; aPBIt.More(); aPBIt.Next()) {
|
|
||||||
const BOPTools_PaveBlock& aPB = aPBIt.Value();
|
|
||||||
Standard_Integer aSplitNb = aPB.Edge();
|
|
||||||
const TopoDS_Shape& aSplit = aDS.Shape(aSplitNb);
|
|
||||||
|
|
||||||
if (theResultMap.Contains(aSplit)) {
|
|
||||||
TopoDS_Vertex aVf;
|
|
||||||
TopoDS_Vertex aVl;
|
|
||||||
TopoDS_Edge anEdge = TopoDS::Edge(aSplit);
|
|
||||||
|
|
||||||
TopExp::Vertices(anEdge, aVf, aVl);
|
|
||||||
|
|
||||||
if (theVEMapRes.FindFromKey(aVf).Extent() < 2 ||
|
|
||||||
theVEMapRes.FindFromKey(aVl).Extent() < 2)
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
// Modified by skv - Wed Nov 5 15:52:50 2003 OCC3644 End
|
|
||||||
|
|
||||||
// ============================================================================================
|
|
||||||
// function: FillEdgeSection
|
|
||||||
// purpose:
|
|
||||||
// ============================================================================================
|
|
||||||
void BOP_SectionHistoryCollector::FillEdgeSection
|
|
||||||
(const TopoDS_Shape &theEdge,
|
|
||||||
const BOPTools_PDSFiller &theDSFiller,
|
|
||||||
const TopTools_IndexedMapOfShape &theResultMap,
|
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape &theVEMapRes,
|
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape &theEFMap)
|
|
||||||
{
|
|
||||||
if(myResult.IsNull())
|
|
||||||
return;
|
|
||||||
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aMapOfOldNewVertex;
|
|
||||||
|
|
||||||
BOPTools_InterferencePool* pIntrPool = (BOPTools_InterferencePool*)&theDSFiller->InterfPool();
|
|
||||||
const BOPTools_PavePool& aPavePool = theDSFiller->PaveFiller().PavePool();
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS = theDSFiller->DS();
|
|
||||||
|
|
||||||
Standard_Integer anIndex = 0;
|
|
||||||
const BooleanOperations_IndexedDataMapOfShapeInteger& aMap1 = theDSFiller->DS().ShapeIndexMap(1);
|
|
||||||
const BooleanOperations_IndexedDataMapOfShapeInteger& aMap2 = theDSFiller->DS().ShapeIndexMap(2);
|
|
||||||
|
|
||||||
if(aMap1.Contains(theEdge))
|
|
||||||
anIndex = aMap1.FindFromKey(theEdge);
|
|
||||||
else if(aMap2.Contains(theEdge))
|
|
||||||
anIndex = aMap2.FindFromKey(theEdge);
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
const BOPTools_PaveSet& aPaveSet = aPavePool.Value(aDS.RefEdge(anIndex));
|
|
||||||
const BOPTools_ListOfPave& aListOfPave = aPaveSet.Set();
|
|
||||||
BOPTools_ListIteratorOfListOfPave anIt(aListOfPave);
|
|
||||||
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
const BOPTools_Pave& aPave = anIt.Value();
|
|
||||||
const BooleanOperations_KindOfInterference aPaveType = aPave.Type();
|
|
||||||
|
|
||||||
if((aPaveType == BooleanOperations_EdgeSurface)) {
|
|
||||||
BOPTools_PShapeShapeInterference anInter = pIntrPool->GetInterference(aPave.Interference(), aPaveType);
|
|
||||||
|
|
||||||
if(anInter == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const TopoDS_Shape& aS1 = aDS.Shape(anInter->Index1());
|
|
||||||
const TopoDS_Shape& aS2 = aDS.Shape(anInter->Index2());
|
|
||||||
const TopoDS_Shape& aNewShape = aDS.Shape(anInter->NewShape());
|
|
||||||
|
|
||||||
if((aNewShape.ShapeType() != TopAbs_VERTEX) ||
|
|
||||||
(!theVEMapRes.Contains(aNewShape)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(theVEMapRes.FindFromKey(aNewShape).Extent() >= 2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(aS1.IsSame(aNewShape) || aS2.IsSame(aNewShape)) {
|
|
||||||
TopTools_ListOfShape thelist;
|
|
||||||
if(!aMapOfOldNewVertex.Contains(aNewShape))
|
|
||||||
aMapOfOldNewVertex.Add(aNewShape, thelist);
|
|
||||||
aMapOfOldNewVertex.ChangeFromKey(aNewShape).Append(aNewShape);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Standard_Boolean addfirst = Standard_True;
|
|
||||||
Standard_Boolean addsecond = Standard_True;
|
|
||||||
|
|
||||||
for(Standard_Integer sit = 0; sit < 2; sit++) {
|
|
||||||
if(((sit == 0) && !addfirst) || ((sit != 0) && !addsecond))
|
|
||||||
continue;
|
|
||||||
const TopoDS_Shape& aS = (sit == 0) ? aS1 : aS2;
|
|
||||||
// Modified by skv - Wed Nov 5 17:11:41 2003 OCC3644 Begin
|
|
||||||
// AddNewShape(aS, aNewShape, myGenMap);
|
|
||||||
if (IsEdgeToAdd(aS, theResultMap, theVEMapRes, theDSFiller))
|
|
||||||
AddNewShape(aS, aNewShape, myGenMap);
|
|
||||||
// Modified by skv - Wed Nov 5 17:11:49 2003 OCC3644 End
|
|
||||||
}
|
|
||||||
} else if (aPaveType == BooleanOperations_EdgeEdge ||
|
|
||||||
aPaveType == BooleanOperations_VertexEdge) {
|
|
||||||
// Special treatment of case Edge-Edge and Edge-Vertex interference.
|
|
||||||
BOPTools_PShapeShapeInterference anInter = pIntrPool->GetInterference(aPave.Interference(), aPaveType);
|
|
||||||
|
|
||||||
if(anInter == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const TopoDS_Shape& aS1 = aDS.Shape(anInter->Index1());
|
|
||||||
const TopoDS_Shape& aS2 = aDS.Shape(anInter->Index2());
|
|
||||||
const TopoDS_Shape& aNewShape = aDS.Shape(anInter->NewShape());
|
|
||||||
|
|
||||||
if((aNewShape.ShapeType() != TopAbs_VERTEX) ||
|
|
||||||
(!theVEMapRes.Contains(aNewShape)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(theVEMapRes.FindFromKey(aNewShape).Extent() >= 2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Standard_Boolean isAddObj = IsEdgeToAdd(aS1, theResultMap, theVEMapRes, theDSFiller);
|
|
||||||
Standard_Boolean isAddTool = IsEdgeToAdd(aS2, theResultMap, theVEMapRes, theDSFiller);
|
|
||||||
|
|
||||||
if (!isAddObj) {
|
|
||||||
if (!theEFMap.Contains(aS1))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
AddNewShape(aS2, aNewShape, myGenMap);
|
|
||||||
|
|
||||||
const TopTools_ListOfShape &aFaces = theEFMap.FindFromKey(aS1);
|
|
||||||
TopTools_ListIteratorOfListOfShape aFIter(aFaces);
|
|
||||||
|
|
||||||
for (; aFIter.More(); aFIter.Next()) {
|
|
||||||
const TopoDS_Shape &anAncFace = aFIter.Value();
|
|
||||||
|
|
||||||
AddNewShape(anAncFace, aNewShape, myGenMap);
|
|
||||||
}
|
|
||||||
} else if (!isAddTool) {
|
|
||||||
if (!theEFMap.Contains(aS2))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
AddNewShape(aS1, aNewShape, myGenMap);
|
|
||||||
|
|
||||||
const TopTools_ListOfShape &aFaces = theEFMap.FindFromKey(aS2);
|
|
||||||
TopTools_ListIteratorOfListOfShape aFIter(aFaces);
|
|
||||||
|
|
||||||
for (; aFIter.More(); aFIter.Next()) {
|
|
||||||
const TopoDS_Shape &anAncFace = aFIter.Value();
|
|
||||||
|
|
||||||
AddNewShape(anAncFace, aNewShape, myGenMap);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!theEFMap.Contains(aS1) || !theEFMap.Contains(aS2))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
AddNewShape(aS1, aNewShape, myGenMap);
|
|
||||||
AddNewShape(aS2, aNewShape, myGenMap);
|
|
||||||
|
|
||||||
const TopTools_ListOfShape &aFaces1 = theEFMap.FindFromKey(aS1);
|
|
||||||
const TopTools_ListOfShape &aFaces2 = theEFMap.FindFromKey(aS1);
|
|
||||||
TopTools_ListIteratorOfListOfShape aFIter(aFaces1);
|
|
||||||
|
|
||||||
for (; aFIter.More(); aFIter.Next()) {
|
|
||||||
const TopoDS_Shape &anAncFace = aFIter.Value();
|
|
||||||
|
|
||||||
AddNewShape(anAncFace, aNewShape, myGenMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (aFIter.Initialize(aFaces2); aFIter.More(); aFIter.Next()) {
|
|
||||||
const TopoDS_Shape &anAncFace = aFIter.Value();
|
|
||||||
|
|
||||||
AddNewShape(anAncFace, aNewShape, myGenMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer i = 0, j = 0;
|
|
||||||
|
|
||||||
for(j = 1; j <= aDS.NumberOfSuccessors(anIndex); j++) {
|
|
||||||
Standard_Integer avindex = aDS.GetSuccessor(anIndex, j);
|
|
||||||
|
|
||||||
BOPTools_CArray1OfVVInterference& VVs = pIntrPool->VVInterferences();
|
|
||||||
Standard_Integer aNb = VVs.Extent();
|
|
||||||
|
|
||||||
for (i = 1; i <= aNb; i++) {
|
|
||||||
BOPTools_VVInterference& VV=VVs(i);
|
|
||||||
Standard_Integer anIndex1 = VV.Index1();
|
|
||||||
Standard_Integer anIndex2 = VV.Index2();
|
|
||||||
|
|
||||||
if((avindex == anIndex1) || (avindex == anIndex2)) {
|
|
||||||
Standard_Integer aNewShapeIndex = VV.NewShape();
|
|
||||||
TopoDS_Shape aNewShape = aDS.Shape(aNewShapeIndex);
|
|
||||||
|
|
||||||
if(!theVEMapRes.Contains(aNewShape))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(theVEMapRes.FindFromKey(aNewShape).Extent() >= 2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for(Standard_Integer vit = 0; vit < 2; vit++) {
|
|
||||||
TopoDS_Shape aShape = (vit == 0) ? aDS.Shape(anIndex1) : aDS.Shape(anIndex2);
|
|
||||||
TopTools_ListOfShape thelist1;
|
|
||||||
if(!aMapOfOldNewVertex.Contains(aShape))
|
|
||||||
aMapOfOldNewVertex.Add(aShape, thelist1);
|
|
||||||
aMapOfOldNewVertex.ChangeFromKey(aShape).Append(aNewShape);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(Standard_Integer aninterit = 0; aninterit < 2; aninterit++) {
|
|
||||||
|
|
||||||
if(aninterit == 0)
|
|
||||||
aNb = pIntrPool->VEInterferences().Extent();
|
|
||||||
else
|
|
||||||
aNb = pIntrPool->VSInterferences().Extent();
|
|
||||||
|
|
||||||
for (i = 1; i <= aNb; i++) {
|
|
||||||
BOPTools_ShapeShapeInterference* anInterference = NULL;
|
|
||||||
|
|
||||||
if(aninterit == 0)
|
|
||||||
anInterference = (BOPTools_ShapeShapeInterference*)(&pIntrPool->VEInterferences().Value(i));
|
|
||||||
else
|
|
||||||
anInterference = (BOPTools_ShapeShapeInterference*)(&pIntrPool->VSInterferences().Value(i));
|
|
||||||
Standard_Integer anIndex1 = anInterference->Index1();
|
|
||||||
Standard_Integer anIndex2 = anInterference->Index2();
|
|
||||||
|
|
||||||
if((avindex == anIndex1) || (avindex == anIndex2)) {
|
|
||||||
Standard_Integer aNewShapeIndex = anInterference->NewShape();
|
|
||||||
TopoDS_Shape aNewShape = aDS.Shape(aNewShapeIndex);
|
|
||||||
|
|
||||||
if(!theVEMapRes.Contains(aNewShape))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(theVEMapRes.FindFromKey(aNewShape).Extent() >= 2)
|
|
||||||
continue;
|
|
||||||
TopoDS_Shape aShape1 = aDS.Shape(avindex);
|
|
||||||
TopoDS_Shape aShape2 = (avindex == anIndex1) ? aDS.Shape(anIndex2) : aDS.Shape(anIndex1);
|
|
||||||
|
|
||||||
if(aninterit == 0) {
|
|
||||||
TopTools_ListOfShape thelist2;
|
|
||||||
if(!aMapOfOldNewVertex.Contains(aShape1))
|
|
||||||
aMapOfOldNewVertex.Add(aShape1, thelist2);
|
|
||||||
aMapOfOldNewVertex.ChangeFromKey(aShape1).Append(aNewShape);
|
|
||||||
} else {
|
|
||||||
Standard_Integer aRank = 1;
|
|
||||||
Standard_Integer aVtxIndex = aDS.ShapeIndex(aShape1, aRank);
|
|
||||||
|
|
||||||
if (aVtxIndex == 0) {
|
|
||||||
aRank = 2;
|
|
||||||
aVtxIndex = aDS.ShapeIndex(aShape1, aRank);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aVtxIndex != 0) {
|
|
||||||
Standard_Integer aNbEdges = aDS.NumberOfAncestors(aVtxIndex);
|
|
||||||
Standard_Integer anEdgeInd;
|
|
||||||
TopTools_MapOfShape anAddedFaces;
|
|
||||||
|
|
||||||
for (anEdgeInd = 1; anEdgeInd <= aNbEdges; anEdgeInd++) {
|
|
||||||
Standard_Integer anEdgeId = aDS.GetAncestor(aVtxIndex, anEdgeInd);
|
|
||||||
const TopoDS_Shape &anEdge = aDS.GetShape(anEdgeId);
|
|
||||||
|
|
||||||
if (IsEdgeToAdd(anEdge, theResultMap, theVEMapRes, theDSFiller))
|
|
||||||
AddNewShape(anEdge, aNewShape, myGenMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modified by skv - Wed Nov 5 17:11:41 2003 OCC3644 Begin
|
|
||||||
// AddNewShape(aShape2, aNewShape, myGenMap);
|
|
||||||
if (IsEdgeToAdd(aShape2, theResultMap, theVEMapRes, theDSFiller))
|
|
||||||
AddNewShape(aShape2, aNewShape, myGenMap);
|
|
||||||
// Modified by skv - Wed Nov 5 17:11:49 2003 OCC3644 End
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!aMapOfOldNewVertex.IsEmpty()) {
|
|
||||||
Standard_Integer vit = 0;
|
|
||||||
|
|
||||||
for(vit = 1; vit <= aMapOfOldNewVertex.Extent(); vit++) {
|
|
||||||
const TopoDS_Shape& aV = aMapOfOldNewVertex.FindKey(vit);
|
|
||||||
Standard_Integer aRank = 1;
|
|
||||||
Standard_Integer aVtxIndex = aDS.ShapeIndex(aV, aRank);
|
|
||||||
|
|
||||||
if (aVtxIndex == 0) {
|
|
||||||
aRank = 2;
|
|
||||||
aVtxIndex = aDS.ShapeIndex(aV, aRank);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aVtxIndex == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Standard_Integer aNbEdges = aDS.NumberOfAncestors(aVtxIndex);
|
|
||||||
Standard_Integer anEdgeInd;
|
|
||||||
TopTools_MapOfShape anAddedFaces;
|
|
||||||
const TopTools_ListOfShape& aNewVList = aMapOfOldNewVertex.FindFromIndex(vit);
|
|
||||||
|
|
||||||
if(aNewVList.IsEmpty())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
TopoDS_Shape aNewShape = aNewVList.First();
|
|
||||||
|
|
||||||
for (anEdgeInd = 1; anEdgeInd <= aNbEdges; anEdgeInd++) {
|
|
||||||
Standard_Integer anEdgeId = aDS.GetAncestor(aVtxIndex, anEdgeInd);
|
|
||||||
const TopoDS_Shape &anEdge = aDS.GetShape(anEdgeId);
|
|
||||||
const TopTools_ListOfShape &aFaces = theEFMap.FindFromKey(anEdge);
|
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape aFaceIter(aFaces);
|
|
||||||
|
|
||||||
for (; aFaceIter.More(); aFaceIter.Next()) {
|
|
||||||
const TopoDS_Shape &aFace = aFaceIter.Value();
|
|
||||||
|
|
||||||
if (!anAddedFaces.Add(aFace))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
AddNewShape(aFace, aNewShape, myGenMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------
|
|
||||||
// static function: AddNewShape
|
|
||||||
// purpose:
|
|
||||||
// --------------------------------------------------------------------------------
|
|
||||||
Standard_Boolean AddNewShape(const TopoDS_Shape& theKey,
|
|
||||||
const TopoDS_Shape& theItem,
|
|
||||||
TopTools_DataMapOfShapeListOfShape& theMap) {
|
|
||||||
|
|
||||||
|
|
||||||
if(!theMap.IsBound(theKey)) {
|
|
||||||
TopTools_ListOfShape aList;
|
|
||||||
aList.Append(theItem);
|
|
||||||
theMap.Bind(theKey, aList);
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean found = Standard_False;
|
|
||||||
TopTools_ListOfShape& aList = theMap.ChangeFind(theKey);
|
|
||||||
TopTools_ListIteratorOfListOfShape aVIt(aList);
|
|
||||||
|
|
||||||
for(; aVIt.More(); aVIt.Next()) {
|
|
||||||
if(theItem.IsSame(aVIt.Value())) {
|
|
||||||
found = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!found) {
|
|
||||||
aList.Append(theItem);
|
|
||||||
}
|
|
||||||
return !found;
|
|
||||||
}
|
|
@ -1,242 +0,0 @@
|
|||||||
-- Created on: 1993-06-16
|
|
||||||
-- Created by: Jean Yves LEBEY
|
|
||||||
-- Copyright (c) 1993-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 ShapeSet from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
|
|
||||||
-- Auxiliary class providing an exploration of a set
|
|
||||||
-- of shapes to build faces or solids.
|
|
||||||
|
|
||||||
-- To build faces : shapes are wires, elements are edges.
|
|
||||||
-- To build solids : shapes are shells, elements are faces.
|
|
||||||
|
|
||||||
-- The ShapeSet stores a list of shapes, a list of elements
|
|
||||||
-- to start reconstructions, and a map to search neighbours.
|
|
||||||
-- The map stores the connection between elements through
|
|
||||||
-- subshapes of type <SubShapeType> given in constructor.
|
|
||||||
|
|
||||||
-- <SubShapeType> is :
|
|
||||||
-- - TopAbs_VERTEX to connect edges
|
|
||||||
-- - TopAbs_EDGE to connect faces
|
|
||||||
--
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
ShapeEnum from TopAbs,
|
|
||||||
|
|
||||||
Orientation from TopAbs,
|
|
||||||
Shape from TopoDS,
|
|
||||||
|
|
||||||
ListOfShape from TopTools,
|
|
||||||
ListIteratorOfListOfShape from TopTools,
|
|
||||||
IndexedDataMapOfShapeListOfShape from TopTools,
|
|
||||||
IndexedMapOfOrientedShape from TopTools,
|
|
||||||
|
|
||||||
Explorer from TopExp
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create (SubShapeType : ShapeEnum from TopAbs)
|
|
||||||
returns ShapeSet from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Creates a ShapeSet in order to build shapes connected
|
|
||||||
--- by <SubShapeType> shapes.
|
|
||||||
---
|
|
||||||
|
|
||||||
Delete(me:out)
|
|
||||||
is virtual;
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_ShapeSet(){Delete() ; }"
|
|
||||||
---Purpose:
|
|
||||||
--- Destructor
|
|
||||||
---
|
|
||||||
AddShape(me:out;
|
|
||||||
S:Shape from TopoDS)
|
|
||||||
is virtual;
|
|
||||||
---Purpose:
|
|
||||||
--- Adds <S> to the list of shapes. (wires or shells).
|
|
||||||
---
|
|
||||||
AddStartElement(me:out;
|
|
||||||
S:Shape from TopoDS)
|
|
||||||
is virtual;
|
|
||||||
---Purpose:
|
|
||||||
--- Add S to the list of starting shapes used for reconstructions.
|
|
||||||
--- apply AddElement(S).
|
|
||||||
---
|
|
||||||
AddElement(me:out;
|
|
||||||
S:Shape from TopoDS)
|
|
||||||
is virtual;
|
|
||||||
---Purpose:
|
|
||||||
--- For each subshape SE of S of type mySubShapeType
|
|
||||||
--- Add subshapes of S to the map of subshapes (mySubShapeMap)
|
|
||||||
--- Add S to the list of shape incident to subshapes of S.
|
|
||||||
---
|
|
||||||
ProcessAddShape(me:out;
|
|
||||||
S:Shape from TopoDS)
|
|
||||||
is static protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal purpose
|
|
||||||
---
|
|
||||||
ProcessAddStartElement(me:out;
|
|
||||||
S:Shape from TopoDS)
|
|
||||||
is static protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal purpose
|
|
||||||
---
|
|
||||||
ProcessAddElement(me:out;
|
|
||||||
S:Shape from TopoDS)
|
|
||||||
is static protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal purpose
|
|
||||||
---
|
|
||||||
StartElements(me)
|
|
||||||
returns ListOfShape from TopTools;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector.
|
|
||||||
---
|
|
||||||
--
|
|
||||||
--
|
|
||||||
-- Iteration on the shapes of AddShape()
|
|
||||||
--
|
|
||||||
InitShapes(me:out);
|
|
||||||
---Purpose:
|
|
||||||
--- Internal purpose
|
|
||||||
---
|
|
||||||
MoreShapes(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal purpose
|
|
||||||
---
|
|
||||||
NextShape(me:in out);
|
|
||||||
---Purpose:
|
|
||||||
--- Internal purpose
|
|
||||||
---
|
|
||||||
Shape(me)
|
|
||||||
returns Shape from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Iteration on the start elements of AddStartElement()
|
|
||||||
--
|
|
||||||
InitStartElements(me:out);
|
|
||||||
|
|
||||||
MoreStartElements(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal purpose
|
|
||||||
---
|
|
||||||
NextStartElement(me:out);
|
|
||||||
---Purpose:
|
|
||||||
--- Internal purpose
|
|
||||||
---
|
|
||||||
StartElement(me)
|
|
||||||
returns Shape;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Iteration on the neighbours of a shape of type myShapeType
|
|
||||||
--- through its subshapes of type mySubShapeType.
|
|
||||||
---
|
|
||||||
InitNeighbours(me:out;
|
|
||||||
S:Shape from TopoDS)
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
MoreNeighbours(me:out)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal purpose
|
|
||||||
---
|
|
||||||
NextNeighbour(me: out);
|
|
||||||
---Purpose:
|
|
||||||
--- Internal purpose
|
|
||||||
---
|
|
||||||
Neighbour(me)
|
|
||||||
returns Shape from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Internal purpose
|
|
||||||
---
|
|
||||||
ChangeStartShapes(me:out)
|
|
||||||
returns ListOfShape from TopTools;
|
|
||||||
---C++: return &
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
|
|
||||||
FindNeighbours(me:in out)
|
|
||||||
is virtual;
|
|
||||||
---Purpose:
|
|
||||||
--- Build the list of neighbour shapes of myCurrentShape
|
|
||||||
--- (neighbour shapes and myCurrentShapes are of type t)
|
|
||||||
--- Initialize myIncidentShapesIter on neighbour shapes.
|
|
||||||
---
|
|
||||||
|
|
||||||
MakeNeighboursList(me:in out;E,V:Shape)
|
|
||||||
returns ListOfShape from TopTools
|
|
||||||
is virtual;
|
|
||||||
---C++: return const &
|
|
||||||
|
|
||||||
MaxNumberSubShape(me:in out;Shape:Shape)
|
|
||||||
returns Integer;
|
|
||||||
|
|
||||||
|
|
||||||
ClearContents(me:out);
|
|
||||||
---Purpose:
|
|
||||||
--- Clears myStartShapes,mySubShapeMap,myShapes
|
|
||||||
---
|
|
||||||
fields
|
|
||||||
|
|
||||||
myShapeType : ShapeEnum from TopAbs is protected;
|
|
||||||
-- shape type : edge
|
|
||||||
|
|
||||||
mySubShapeType : ShapeEnum from TopAbs is protected;
|
|
||||||
-- subshape type : vertex
|
|
||||||
|
|
||||||
--mySubShapeExplorer : ShapeExplorer from BOP is protected;
|
|
||||||
mySubShapeExplorer : Explorer from TopExp is protected;
|
|
||||||
-- explorer of edge vertices
|
|
||||||
|
|
||||||
myStartShapes : ListOfShape from TopTools is protected;
|
|
||||||
-- list of starting edges
|
|
||||||
|
|
||||||
myStartShapesIter : ListIteratorOfListOfShape from TopTools is protected;
|
|
||||||
-- myStartShapes iterator
|
|
||||||
|
|
||||||
mySubShapeMap : IndexedDataMapOfShapeListOfShape from TopTools is protected;
|
|
||||||
-- map of vertices
|
|
||||||
-- mySubShapeMap(vertex) = list of incident edges to a vertex
|
|
||||||
|
|
||||||
myIncidentShapesIter : ListIteratorOfListOfShape from TopTools is protected;
|
|
||||||
-- iter on list L of edges incident to a vertex, L = mySubShapeMap(vertex)
|
|
||||||
|
|
||||||
myShapes : ListOfShape from TopTools is protected;
|
|
||||||
-- list of wires which are not to be reconstructed
|
|
||||||
|
|
||||||
myShapesIter : ListIteratorOfListOfShape from TopTools is protected;
|
|
||||||
-- myShapes iterator
|
|
||||||
|
|
||||||
myCurrentShape : Shape from TopoDS is protected;
|
|
||||||
-- current edge which neighbours are searched, using FindNeighbours()
|
|
||||||
|
|
||||||
myCurrentShapeNeighbours : ListOfShape from TopTools is protected;
|
|
||||||
-- list of edges neighbour of the edge myCurrentShape
|
|
||||||
|
|
||||||
end ShapeSet;
|
|
@ -1,348 +0,0 @@
|
|||||||
// Created on: 1993-06-17
|
|
||||||
// Created by: Jean Yves LEBEY
|
|
||||||
// Copyright (c) 1993-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.
|
|
||||||
|
|
||||||
|
|
||||||
#include <BOP_ShapeSet.ixx>
|
|
||||||
|
|
||||||
#include <Standard_ProgramError.hxx>
|
|
||||||
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
|
|
||||||
#include <TopAbs.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_ShapeSet::BOP_ShapeSet
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_ShapeSet::BOP_ShapeSet(const TopAbs_ShapeEnum SubShapeType)
|
|
||||||
:
|
|
||||||
mySubShapeType(SubShapeType)
|
|
||||||
{
|
|
||||||
switch (SubShapeType) {
|
|
||||||
case TopAbs_EDGE:
|
|
||||||
myShapeType = TopAbs_FACE;
|
|
||||||
break;
|
|
||||||
case TopAbs_VERTEX:
|
|
||||||
myShapeType = TopAbs_EDGE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Standard_ProgramError::Raise("ShapeSet : bad ShapeType");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Delete
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::Delete()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ClearContents
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::ClearContents()
|
|
||||||
{
|
|
||||||
myStartShapes.Clear();
|
|
||||||
mySubShapeMap.Clear();
|
|
||||||
myShapes.Clear();
|
|
||||||
myCurrentShapeNeighbours.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddShape
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::AddShape(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
ProcessAddShape(S);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddStartElement
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::AddStartElement(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
ProcessAddStartElement(S);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddElement
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::AddElement(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
ProcessAddElement(S);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ProcessAddShape
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::ProcessAddShape(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
myShapes.Append(S);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ProcessAddStartElement
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::ProcessAddStartElement(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(myStartShapes);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& aSInner=anIt.Value();
|
|
||||||
if (aSInner==S) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myStartShapes.Append(S);
|
|
||||||
ProcessAddElement(S);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ProcessAddElement
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::ProcessAddElement(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
Standard_Boolean b;
|
|
||||||
TopTools_ListOfShape Lemp;
|
|
||||||
|
|
||||||
TopExp_Explorer Ex(S, mySubShapeType);
|
|
||||||
for (; Ex.More(); Ex.Next()) {
|
|
||||||
const TopoDS_Shape& subshape = Ex.Current();
|
|
||||||
b = ( ! mySubShapeMap.Contains(subshape) );
|
|
||||||
if ( b ) {
|
|
||||||
mySubShapeMap.Add(subshape, Lemp);
|
|
||||||
}
|
|
||||||
mySubShapeMap.ChangeFromKey(subshape).Append(S);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : StartElements
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const TopTools_ListOfShape& BOP_ShapeSet::StartElements()const
|
|
||||||
{
|
|
||||||
return myStartShapes;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : InitShapes
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::InitShapes()
|
|
||||||
{
|
|
||||||
myShapesIter.Initialize(myShapes);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : MoreShapes
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_ShapeSet::MoreShapes()const
|
|
||||||
{
|
|
||||||
Standard_Boolean b = myShapesIter.More();
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NextShape
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::NextShape()
|
|
||||||
{
|
|
||||||
myShapesIter.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Shape
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const TopoDS_Shape& BOP_ShapeSet::Shape()const
|
|
||||||
{
|
|
||||||
const TopoDS_Shape& S = myShapesIter.Value();
|
|
||||||
return S;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : InitStartElements
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::InitStartElements()
|
|
||||||
{
|
|
||||||
myStartShapesIter.Initialize(myStartShapes);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : MoreStartElements
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_ShapeSet::MoreStartElements()const
|
|
||||||
{
|
|
||||||
Standard_Boolean b = myStartShapesIter.More();
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NextStartElement
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::NextStartElement()
|
|
||||||
{
|
|
||||||
myStartShapesIter.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : StartElement
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const TopoDS_Shape& BOP_ShapeSet::StartElement()const
|
|
||||||
{
|
|
||||||
const TopoDS_Shape& S = myStartShapesIter.Value();
|
|
||||||
return S;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : InitNeighbours
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::InitNeighbours(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
mySubShapeExplorer.Init(S, mySubShapeType);
|
|
||||||
myCurrentShape = S;
|
|
||||||
FindNeighbours();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : MoreNeighbours
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_ShapeSet::MoreNeighbours()
|
|
||||||
{
|
|
||||||
Standard_Boolean b = myIncidentShapesIter.More();
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NextNeighbour
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::NextNeighbour()
|
|
||||||
{
|
|
||||||
Standard_Boolean noisimore, ssemore;
|
|
||||||
|
|
||||||
myIncidentShapesIter.Next();
|
|
||||||
noisimore = ! myIncidentShapesIter.More();
|
|
||||||
if ( noisimore ) {
|
|
||||||
ssemore = mySubShapeExplorer.More();
|
|
||||||
if ( ssemore ) {
|
|
||||||
mySubShapeExplorer.Next();
|
|
||||||
FindNeighbours();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Neighbour
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const TopoDS_Shape& BOP_ShapeSet::Neighbour()const
|
|
||||||
{
|
|
||||||
const TopoDS_Shape& S = myIncidentShapesIter.Value();
|
|
||||||
return S;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ChangeStartShapes
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
TopTools_ListOfShape& BOP_ShapeSet::ChangeStartShapes()
|
|
||||||
{
|
|
||||||
return myStartShapes;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FindNeighbours
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShapeSet::FindNeighbours()
|
|
||||||
{
|
|
||||||
while (mySubShapeExplorer.More()) {
|
|
||||||
// l = list of edges neighbour of edge myCurrentShape trough
|
|
||||||
// the vertex mySubShapeExplorer.Current(), which is a vertex of the
|
|
||||||
// edge myCurrentShape.
|
|
||||||
const TopoDS_Shape& V = mySubShapeExplorer.Current();
|
|
||||||
const TopTools_ListOfShape & l = MakeNeighboursList(myCurrentShape,V);
|
|
||||||
// myIncidentShapesIter iterates on the neighbour edges of the edge
|
|
||||||
// given as InitNeighbours() argument (this edge has been stored
|
|
||||||
// in the field myCurrentShape).
|
|
||||||
myIncidentShapesIter.Initialize(l);
|
|
||||||
if (myIncidentShapesIter.More()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mySubShapeExplorer.Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : MakeNeighboursList
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const TopTools_ListOfShape & BOP_ShapeSet::MakeNeighboursList(const TopoDS_Shape& ,//Earg,
|
|
||||||
const TopoDS_Shape& Varg)
|
|
||||||
{
|
|
||||||
const TopTools_ListOfShape& l = mySubShapeMap.FindFromKey(Varg);
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : MaxNumberSubShape
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_ShapeSet::MaxNumberSubShape(const TopoDS_Shape& Shape)
|
|
||||||
{
|
|
||||||
Standard_Integer i, m = 0;
|
|
||||||
|
|
||||||
TopExp_Explorer SE(Shape, mySubShapeType);
|
|
||||||
|
|
||||||
while(SE.More()) {
|
|
||||||
const TopoDS_Shape& SubShape = SE.Current();
|
|
||||||
if(!mySubShapeMap.Contains(SubShape)) {
|
|
||||||
SE.Next();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& l = mySubShapeMap.FindFromKey(SubShape);
|
|
||||||
i=l.Extent();
|
|
||||||
m = Max(m, i);
|
|
||||||
SE.Next();
|
|
||||||
}
|
|
||||||
return m;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,107 +0,0 @@
|
|||||||
-- Created on: 2001-06-25
|
|
||||||
-- Created by: Michael KLOKOV
|
|
||||||
-- Copyright (c) 2001-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 ShellFaceClassifier from BOP inherits CompositeClassifier from BOP
|
|
||||||
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
|
|
||||||
--- The algorithm is to classify loops that
|
|
||||||
-- consist of faces and shells
|
|
||||||
---
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
Shape from TopoDS,
|
|
||||||
Shell from TopoDS,
|
|
||||||
State from TopAbs,
|
|
||||||
Pnt from gp,
|
|
||||||
Builder from BRep,
|
|
||||||
BlockBuilder from BOP,
|
|
||||||
SolidClassifier from BOP,
|
|
||||||
DataMapOfShapeShape from TopTools
|
|
||||||
|
|
||||||
is
|
|
||||||
Create(theBlockBuilder: BlockBuilder from BOP)
|
|
||||||
returns ShellFaceClassifier from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Creates a classifier in 3D space, to compare
|
|
||||||
--- a face with a set of faces,
|
|
||||||
--- a shell with a set of faces,
|
|
||||||
--- a shell with a shell
|
|
||||||
---
|
|
||||||
Clear(me: in out);
|
|
||||||
---Purpose:
|
|
||||||
--- Clears contents of internal state of the object
|
|
||||||
---
|
|
||||||
CompareShapes(me : in out;
|
|
||||||
B1 : Shape from TopoDS;
|
|
||||||
B2 : Shape from TopoDS)
|
|
||||||
returns State from TopAbs
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- Classify shape <B1> with shape <B2>
|
|
||||||
---
|
|
||||||
CompareElementToShape(me : in out;
|
|
||||||
E : Shape from TopoDS;
|
|
||||||
B : Shape from TopoDS)
|
|
||||||
|
|
||||||
returns State from TopAbs
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- Classify element <E> with shape <B>
|
|
||||||
---
|
|
||||||
ResetShape(me : in out;
|
|
||||||
B : Shape from TopoDS)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- Prepare classification involving shape <B>
|
|
||||||
--- Calls ResetElement on first element of <B>
|
|
||||||
---
|
|
||||||
ResetElement(me : in out;
|
|
||||||
E : Shape from TopoDS)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- Prepare classification involving element <E>.
|
|
||||||
---
|
|
||||||
CompareElement(me : in out;
|
|
||||||
E : Shape from TopoDS);
|
|
||||||
---Purpose:
|
|
||||||
--- Add element <E> in the set of elements used in classification.
|
|
||||||
---
|
|
||||||
State(me : in out)
|
|
||||||
returns State from TopAbs
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- Returns state of classification of 2D point, defined by
|
|
||||||
--- ResetElement, with the current set of elements,
|
|
||||||
--- defined by Compare.
|
|
||||||
---
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myFirstCompare: Boolean from Standard;
|
|
||||||
myPoint: Pnt from gp;
|
|
||||||
myShell: Shell from TopoDS;
|
|
||||||
myBuilder: Builder from BRep;
|
|
||||||
mySolidClassifier: SolidClassifier from BOP;
|
|
||||||
myFaceShellMap : DataMapOfShapeShape from TopTools;
|
|
||||||
|
|
||||||
end ShellFaceClassifier from BOP;
|
|
@ -1,179 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
#include <BOP_ShellFaceClassifier.ixx>
|
|
||||||
|
|
||||||
#include <Precision.hxx>
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Vertex.hxx>
|
|
||||||
#include <TopoDS_Face.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
#include <BRepAdaptor_Surface.hxx>
|
|
||||||
#include <Geom_Curve.hxx>
|
|
||||||
#include <IntTools_Tools.hxx>
|
|
||||||
|
|
||||||
// ==================================================================
|
|
||||||
// function: BOP_ShellFaceClassifier::BOP_ShellFaceClassifier
|
|
||||||
// purpose:
|
|
||||||
// ==================================================================
|
|
||||||
BOP_ShellFaceClassifier::BOP_ShellFaceClassifier
|
|
||||||
(const BOP_BlockBuilder& theBlockBuilder)
|
|
||||||
:
|
|
||||||
BOP_CompositeClassifier(theBlockBuilder)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===============================================================================================
|
|
||||||
// function: Clear
|
|
||||||
// purpose:
|
|
||||||
// ===============================================================================================
|
|
||||||
void BOP_ShellFaceClassifier::Clear()
|
|
||||||
{
|
|
||||||
mySolidClassifier.Clear();
|
|
||||||
myFaceShellMap.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===============================================================================================
|
|
||||||
// function: CompareShapes
|
|
||||||
// purpose:
|
|
||||||
// ===============================================================================================
|
|
||||||
TopAbs_State BOP_ShellFaceClassifier::CompareShapes(const TopoDS_Shape& theShape1,
|
|
||||||
const TopoDS_Shape& theShape2)
|
|
||||||
{
|
|
||||||
ResetShape(theShape1);
|
|
||||||
myShell = TopoDS::Shell(theShape2);
|
|
||||||
mySolidClassifier.LoadShell(myShell);
|
|
||||||
TopAbs_State aState = State();
|
|
||||||
return aState;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===============================================================================================
|
|
||||||
// function: CompareElementToShape
|
|
||||||
// purpose:
|
|
||||||
// ===============================================================================================
|
|
||||||
TopAbs_State BOP_ShellFaceClassifier::CompareElementToShape(const TopoDS_Shape& theElement,
|
|
||||||
const TopoDS_Shape& theShape)
|
|
||||||
{
|
|
||||||
ResetElement(theElement);
|
|
||||||
myShell = TopoDS::Shell(theShape);
|
|
||||||
mySolidClassifier.LoadShell(myShell);
|
|
||||||
TopAbs_State aState = State();
|
|
||||||
return aState;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===============================================================================================
|
|
||||||
// function: ResetShape
|
|
||||||
// purpose:
|
|
||||||
// ===============================================================================================
|
|
||||||
void BOP_ShellFaceClassifier::ResetShape(const TopoDS_Shape& theShape)
|
|
||||||
{
|
|
||||||
TopExp_Explorer anExp(theShape, TopAbs_FACE);
|
|
||||||
const TopoDS_Face& aFace = TopoDS::Face(anExp.Current());
|
|
||||||
ResetElement(aFace);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===============================================================================================
|
|
||||||
// function: ResetElement
|
|
||||||
// purpose:
|
|
||||||
// ===============================================================================================
|
|
||||||
void BOP_ShellFaceClassifier::ResetElement(const TopoDS_Shape& theElement)
|
|
||||||
{
|
|
||||||
Standard_Boolean bFound;
|
|
||||||
TopAbs_ShapeEnum aShapeType;
|
|
||||||
TopExp_Explorer anExp;
|
|
||||||
//
|
|
||||||
myFirstCompare=Standard_True;
|
|
||||||
aShapeType=theElement.ShapeType();
|
|
||||||
//
|
|
||||||
bFound=Standard_False;
|
|
||||||
anExp.Init(theElement, TopAbs_EDGE);
|
|
||||||
for(; anExp.More(); anExp.Next()) {
|
|
||||||
const TopoDS_Edge& aE=*((TopoDS_Edge*)&anExp.Current());
|
|
||||||
if (!BRep_Tool::Degenerated(aE)) {
|
|
||||||
Standard_Real aT, aT1, aT2;
|
|
||||||
Handle(Geom_Curve) aC;
|
|
||||||
//
|
|
||||||
aC=BRep_Tool::Curve(aE, aT1, aT2);
|
|
||||||
aT=IntTools_Tools::IntermediatePoint(aT1, aT2);
|
|
||||||
aC->D0(aT, myPoint);
|
|
||||||
bFound=Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (bFound) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// initialize myPoint with first vertex of face <E>
|
|
||||||
anExp.Init(theElement, TopAbs_VERTEX);
|
|
||||||
if(anExp.More()) {
|
|
||||||
const TopoDS_Vertex& aVertex = TopoDS::Vertex(anExp.Current());
|
|
||||||
myPoint = BRep_Tool::Pnt(aVertex);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
if(aShapeType == TopAbs_FACE) {
|
|
||||||
BRepAdaptor_Surface BAS(TopoDS::Face(theElement));
|
|
||||||
myPoint = BAS.Value((BAS.FirstUParameter()+BAS.LastUParameter()) * 0.5,
|
|
||||||
(BAS.FirstVParameter()+BAS.LastVParameter()) * 0.5);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myPoint.SetCoord(0., 0., 0.);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===============================================================================================
|
|
||||||
// function: CompareElement
|
|
||||||
// purpose:
|
|
||||||
// ===============================================================================================
|
|
||||||
void BOP_ShellFaceClassifier::CompareElement(const TopoDS_Shape& theElement)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(myFirstCompare) {
|
|
||||||
Standard_Boolean found = myFaceShellMap.IsBound(theElement);
|
|
||||||
|
|
||||||
if(!found) {
|
|
||||||
myBuilder.MakeShell(myShell);
|
|
||||||
myBuilder.Add(myShell, theElement);
|
|
||||||
myFaceShellMap.Bind(theElement, myShell);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopoDS_Shape sbid = myFaceShellMap.Find(theElement);
|
|
||||||
myShell = TopoDS::Shell(sbid);
|
|
||||||
}
|
|
||||||
myFirstCompare = Standard_False;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myBuilder.Add(myShell, theElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==================================================================
|
|
||||||
// function: State
|
|
||||||
// purpose:
|
|
||||||
// ==================================================================
|
|
||||||
TopAbs_State BOP_ShellFaceClassifier::State()
|
|
||||||
{
|
|
||||||
TopAbs_State aState = TopAbs_UNKNOWN;
|
|
||||||
Standard_Real aTolerance = Precision::Confusion();
|
|
||||||
mySolidClassifier.Classify(myShell, myPoint, aTolerance);
|
|
||||||
aState = mySolidClassifier.State();
|
|
||||||
return aState;
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
|||||||
-- Created on: 2001-06-25
|
|
||||||
-- Created by: Michael KLOKOV
|
|
||||||
-- Copyright (c) 2001-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 ShellFaceSet from BOP inherits ShapeSet from BOP
|
|
||||||
|
|
||||||
---Purpose: class for set of faces and shells
|
|
||||||
---
|
|
||||||
uses
|
|
||||||
Solid from TopoDS
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns ShellFaceSet from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty Consreuctor
|
|
||||||
---
|
|
||||||
Create(theSolid: Solid from TopoDS)
|
|
||||||
returns ShellFaceSet from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Creates the object to build blocks of faces
|
|
||||||
--- connected by edges.
|
|
||||||
---
|
|
||||||
Solid(me)
|
|
||||||
returns Solid from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
---C++: inline
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
mySolid : Solid from TopoDS;
|
|
||||||
|
|
||||||
end ShellFaceSet from BOP;
|
|
@ -1,67 +0,0 @@
|
|||||||
-- Created on: 2001-10-29
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 ShellShell from BOP inherits ShellSolid from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- Performs Boolean Operations (BO)
|
|
||||||
--- Common,Cut,Fuse for arguments that
|
|
||||||
--- are of type shell/shell
|
|
||||||
---
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
DSFiller from BOPTools
|
|
||||||
|
|
||||||
--raises
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns ShellShell from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
DoWithFiller (me:out;
|
|
||||||
aDSF: DSFiller from BOPTools)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- see base classes, please
|
|
||||||
---
|
|
||||||
Destroy (me: in out)
|
|
||||||
is redefined;
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_ShellShell(){Destroy();}"
|
|
||||||
---Purpose:
|
|
||||||
--- Destructor
|
|
||||||
---
|
|
||||||
BuildResult(me: out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- see base classes, please
|
|
||||||
---
|
|
||||||
DoNewFaces(me: out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- see base classes, please
|
|
||||||
---
|
|
||||||
|
|
||||||
--fields
|
|
||||||
|
|
||||||
end ShellShell;
|
|
@ -1,471 +0,0 @@
|
|||||||
// Created on: 2001-10-29
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2001-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 <BOP_ShellShell.ixx>
|
|
||||||
|
|
||||||
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
#include <TopoDS_Face.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
#include <TopoDS_Shell.hxx>
|
|
||||||
#include <TopoDS_Compound.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
#include <BRep_Builder.hxx>
|
|
||||||
|
|
||||||
#include <TopAbs_Orientation.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
|
|
||||||
#include <TopTools_ListOfShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
|
|
||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
|
||||||
|
|
||||||
#include <BOPTColStd_Dump.hxx>
|
|
||||||
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
#include <BooleanOperations_StateOfShape.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_PaveFiller.hxx>
|
|
||||||
#include <BOPTools_InterferencePool.hxx>
|
|
||||||
#include <BOPTools_CArray1OfSSInterference.hxx>
|
|
||||||
#include <BOPTools_CArray1OfInterferenceLine.hxx>
|
|
||||||
#include <BOPTools_InterferenceLine.hxx>
|
|
||||||
|
|
||||||
#include <BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger.hxx>
|
|
||||||
#include <BOPTools_SSInterference.hxx>
|
|
||||||
|
|
||||||
#include <BOP_WireEdgeSet.hxx>
|
|
||||||
#include <BOP_SDFWESFiller.hxx>
|
|
||||||
#include <BOP_FaceBuilder.hxx>
|
|
||||||
#include <BOP_Draw.hxx>
|
|
||||||
#include <BOP_CorrectTolerances.hxx>
|
|
||||||
#include <BOP_BuilderTools.hxx>
|
|
||||||
#include <BOP_Refiner.hxx>
|
|
||||||
#include <Standard_Failure.hxx>
|
|
||||||
#include <Standard_ErrorHandler.hxx>
|
|
||||||
#include <TopTools_DataMapOfShapeInteger.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_ShellShell::BOP_ShellShell
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_ShellShell::BOP_ShellShell()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: Destroy
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellShell::Destroy() {
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoWithFiller
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellShell::DoWithFiller(const BOPTools_DSFiller& aDSFiller)
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
myIsDone=Standard_False;
|
|
||||||
//
|
|
||||||
myResultMap.Clear();
|
|
||||||
myModifiedMap.Clear();
|
|
||||||
//
|
|
||||||
myDSFiller=(BOPTools_DSFiller*) &aDSFiller;
|
|
||||||
//
|
|
||||||
try {
|
|
||||||
OCC_CATCH_SIGNALS
|
|
||||||
|
|
||||||
if(!myDSFiller->IsDone()) {
|
|
||||||
myErrorStatus = 1;
|
|
||||||
BOPTColStd_Dump::PrintMessage("DSFiller is invalid: Can not build result\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
Standard_Boolean bIsNewFiller;
|
|
||||||
bIsNewFiller=aDSFiller.IsNewFiller();
|
|
||||||
|
|
||||||
if (bIsNewFiller) {
|
|
||||||
Prepare();
|
|
||||||
aDSFiller.SetNewFiller(!bIsNewFiller);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
DoNewFaces();
|
|
||||||
//
|
|
||||||
BuildResult();
|
|
||||||
//
|
|
||||||
// Treat of internals
|
|
||||||
CollectInternals();
|
|
||||||
BOP_Refiner aRefiner;
|
|
||||||
aRefiner.SetShape(myResult);
|
|
||||||
aRefiner.SetInternals(myInternals);
|
|
||||||
aRefiner.Do();
|
|
||||||
//
|
|
||||||
BOP_CorrectTolerances::CorrectTolerances(myResult, 0.01);
|
|
||||||
//
|
|
||||||
FillModified();
|
|
||||||
myIsDone=Standard_True;
|
|
||||||
}
|
|
||||||
catch ( Standard_Failure ) {
|
|
||||||
myErrorStatus = 1;
|
|
||||||
BOPTColStd_Dump::PrintMessage("Can not build result\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function: BuildResult
|
|
||||||
// purpose:
|
|
||||||
//=================================================================================
|
|
||||||
void BOP_ShellShell::BuildResult()
|
|
||||||
{
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
|
|
||||||
Standard_Integer i, j, aNb, iRank, aNbFaces;
|
|
||||||
BooleanOperations_StateOfShape aState, aStateToCompare;
|
|
||||||
BRep_Builder aBB;
|
|
||||||
TopoDS_Compound aFCompound, aRes;
|
|
||||||
//
|
|
||||||
Standard_Boolean bHasInterference;
|
|
||||||
BOPTools_InterferencePool* pInterfPool=
|
|
||||||
(BOPTools_InterferencePool*) &myDSFiller->InterfPool();
|
|
||||||
BOPTools_CArray1OfInterferenceLine* pTable=
|
|
||||||
(BOPTools_CArray1OfInterferenceLine*) &pInterfPool->InterferenceTable();
|
|
||||||
//
|
|
||||||
aBB.MakeCompound(aRes);
|
|
||||||
//
|
|
||||||
// 1. Make aCompound containing all faces for thr Result
|
|
||||||
aBB.MakeCompound(aFCompound);
|
|
||||||
//
|
|
||||||
// 1.1. Old Faces with right 3D-state
|
|
||||||
aNb=aDS.NumberOfSourceShapes();
|
|
||||||
for (i=1; i<=aNb; i++) {
|
|
||||||
const TopoDS_Shape& aS=aDS.Shape(i);
|
|
||||||
if (aS.ShapeType()==TopAbs_FACE){
|
|
||||||
//
|
|
||||||
BOPTools_InterferenceLine& anInterfLine=pTable->ChangeValue(i);
|
|
||||||
bHasInterference=anInterfLine.HasInterference();
|
|
||||||
if (bHasInterference) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aState=aDS.GetState(i);
|
|
||||||
if (aState==BooleanOperations_IN ||
|
|
||||||
aState==BooleanOperations_OUT) {
|
|
||||||
iRank=aDS.Rank(i);
|
|
||||||
aStateToCompare=BOP_BuilderTools::StateToCompare(iRank, myOperation);
|
|
||||||
if (aState==aStateToCompare) {
|
|
||||||
aBB.Add(aFCompound, aS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// 1.2. aListOfNewFaces
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(myNewFaces);
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
aBB.Add(aFCompound, anIt.Value());
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// 2.
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aEFMap;
|
|
||||||
TopTools_IndexedMapOfShape aProcessedEdges;
|
|
||||||
|
|
||||||
TopExp::MapShapesAndAncestors(aFCompound, TopAbs_EDGE, TopAbs_FACE, aEFMap);
|
|
||||||
aNb=aEFMap.Extent();
|
|
||||||
for (i=1; i<=aNb; i++) {
|
|
||||||
const TopoDS_Shape& aE=aEFMap.FindKey(i);
|
|
||||||
TopTools_IndexedMapOfShape aFaces;
|
|
||||||
Path (aE, aEFMap, aFaces, aProcessedEdges);
|
|
||||||
|
|
||||||
TopoDS_Shell aShell, aShellNew;
|
|
||||||
aBB.MakeShell(aShell);
|
|
||||||
|
|
||||||
aNbFaces=aFaces.Extent();
|
|
||||||
if (aNbFaces) {
|
|
||||||
for (j=1; j<=aNbFaces; j++) {
|
|
||||||
const TopoDS_Shape& aF=aFaces(j);
|
|
||||||
aBB.Add(aShell, aF);
|
|
||||||
}
|
|
||||||
|
|
||||||
OrientFacesOnShell(aShell, aShellNew);
|
|
||||||
|
|
||||||
aBB.Add(aRes, aShellNew);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myResult=aRes;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoNewFaces
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellShell::DoNewFaces()
|
|
||||||
{
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
|
|
||||||
//
|
|
||||||
// vars
|
|
||||||
Standard_Boolean bIsTouchCase, bIsTouch;
|
|
||||||
Standard_Integer i, aNb, j, aNbj, iFF, nF1, iRank, nF2;
|
|
||||||
TopTools_ListOfShape aListOfNewFaces;
|
|
||||||
TopTools_IndexedMapOfShape anEMap;
|
|
||||||
TopAbs_Orientation anOriF1;
|
|
||||||
//
|
|
||||||
// DoMap
|
|
||||||
BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aFFMap;
|
|
||||||
BOP_BuilderTools::DoMap(aFFs, aFFMap);
|
|
||||||
//
|
|
||||||
aNb=aFFMap.Extent();
|
|
||||||
//
|
|
||||||
for (i=1; i<=aNb; i++) {
|
|
||||||
//
|
|
||||||
// a. Prepare info about the Face nF1 and create WES for nF1
|
|
||||||
nF1=aFFMap.FindKey(i);
|
|
||||||
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF1));
|
|
||||||
|
|
||||||
anOriF1=aF1.Orientation();
|
|
||||||
iRank=aDS.Rank(nF1);
|
|
||||||
|
|
||||||
myFace=aF1;
|
|
||||||
myFace.Orientation(TopAbs_FORWARD);
|
|
||||||
BOP_WireEdgeSet aWES (myFace);
|
|
||||||
|
|
||||||
const TColStd_IndexedMapOfInteger& aFFIndicesMap=aFFMap.FindFromIndex(i);
|
|
||||||
aNbj=aFFIndicesMap.Extent();
|
|
||||||
//
|
|
||||||
// b. The Switch: Same Domain Faces or Non-Same Domain Faces
|
|
||||||
bIsTouchCase=Standard_False;
|
|
||||||
for (j=1; j<=aNbj; j++) {
|
|
||||||
iFF=aFFIndicesMap(j);
|
|
||||||
BOPTools_SSInterference& aFF=aFFs(iFF);
|
|
||||||
bIsTouchCase=aFF.IsTangentFaces();
|
|
||||||
if (bIsTouchCase) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// c. Filling the WES for nF1
|
|
||||||
if (bIsTouchCase) {
|
|
||||||
// 1. Add Split Parts having states in accordance with operation
|
|
||||||
AddSplitPartsINOUT (nF1, aWES);
|
|
||||||
// 2. Add Section Edges to the WES
|
|
||||||
for (j=1; j<=aNbj; j++) {
|
|
||||||
iFF=aFFIndicesMap(j);
|
|
||||||
BOPTools_SSInterference& aFF=aFFs(iFF);
|
|
||||||
bIsTouch=aFF.IsTangentFaces();
|
|
||||||
if (!bIsTouch) {
|
|
||||||
AddSectionPartsSh(nF1, iFF, aWES);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 3. Add IN2D, ON2D Parts to the WES
|
|
||||||
//
|
|
||||||
//modified by NIZNHY-PKV Fri Sep 14 10:00:44 2012f
|
|
||||||
BOP_WireEdgeSet aWES1 (myFace);
|
|
||||||
//
|
|
||||||
for (j=1; j<=aNbj; j++) {
|
|
||||||
iFF=aFFIndicesMap(j);
|
|
||||||
BOPTools_SSInterference& aFF=aFFs(iFF);
|
|
||||||
bIsTouch=aFF.IsTangentFaces();
|
|
||||||
if (bIsTouch) {
|
|
||||||
nF2=aFF.OppositeIndex(nF1);
|
|
||||||
AddINON2DPartsSh(nF1, iFF, aWES1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (iRank==2 || (iRank==1 && myOperation==BOP_CUT)) {
|
|
||||||
// #0023431
|
|
||||||
// Refine WES to remove duplicated edges:
|
|
||||||
// - for the faces of the Object: Cut operation
|
|
||||||
// - for the faces of the Tool: all operations
|
|
||||||
//
|
|
||||||
// The duplications caused by the separated treatment
|
|
||||||
// the faces of an argument for the cases when:
|
|
||||||
// -these faces contain shared edges and
|
|
||||||
// -they are same domain faces with the faces of the other argument.
|
|
||||||
TopTools_DataMapOfShapeInteger aDMSI;
|
|
||||||
|
|
||||||
//--
|
|
||||||
aWES1.InitStartElements();
|
|
||||||
for (; aWES1.MoreStartElements(); aWES1.NextStartElement()) {
|
|
||||||
const TopoDS_Edge& aE=*((TopoDS_Edge*)&aWES1.StartElement());
|
|
||||||
if (!aDMSI.IsBound(aE)) {
|
|
||||||
Standard_Integer iCnt=1;
|
|
||||||
//
|
|
||||||
aDMSI.Bind(aE, iCnt);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Standard_Integer& iCnt=aDMSI.ChangeFind(aE);
|
|
||||||
++iCnt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aWES1.InitStartElements();
|
|
||||||
for (; aWES1.MoreStartElements(); aWES1.NextStartElement()) {
|
|
||||||
const TopoDS_Shape& aE=aWES1.StartElement();
|
|
||||||
const Standard_Integer& iCnt=aDMSI.Find(aE);
|
|
||||||
if (iCnt==1) {
|
|
||||||
aWES.AddStartElement(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aWES1.InitStartElements();
|
|
||||||
for (; aWES1.MoreStartElements(); aWES1.NextStartElement()) {
|
|
||||||
const TopoDS_Shape& aE=aWES1.StartElement();
|
|
||||||
aWES.AddStartElement(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//--
|
|
||||||
/*
|
|
||||||
for (j=1; j<=aNbj; j++) {
|
|
||||||
iFF=aFFIndicesMap(j);
|
|
||||||
BOPTools_SSInterference& aFF=aFFs(iFF);
|
|
||||||
bIsTouch=aFF.IsTangentFaces();
|
|
||||||
if (bIsTouch) {
|
|
||||||
Standard_Integer nF2;
|
|
||||||
nF2=aFF.OppositeIndex(nF1);
|
|
||||||
AddINON2DPartsSh(nF1, iFF, aWES);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//modified by NIZNHY-PKV Fri Sep 14 10:00:48 2012t
|
|
||||||
// 4. Add EF parts (E (from F2) on F1 ),
|
|
||||||
// where F2 is non-same-domain face to F1
|
|
||||||
anEMap.Clear();
|
|
||||||
//
|
|
||||||
// anEMap will contain all Split parts that has already in aWES
|
|
||||||
const TopTools_ListOfShape& aLE=aWES.StartElements();
|
|
||||||
|
|
||||||
Standard_Integer aNbEdges1 = aLE.Extent();
|
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt;
|
|
||||||
anIt.Initialize (aLE);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
TopoDS_Shape& anE=anIt.Value();
|
|
||||||
anEMap.Add(anE);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// IFV's workaround for occ13538:
|
|
||||||
// It is necessary to avoid building SD faces twice in case if SD faces of object and tool
|
|
||||||
// fully coincide and face of object has adjacent faces along all boundaries.
|
|
||||||
// For such cases WES for second SD faces are built from EE edges.
|
|
||||||
// The sence of workarond is to find such situation by checking of number of EF edges.
|
|
||||||
// If number of EF edges == 0, it means that SD faces fully coincide.
|
|
||||||
Standard_Integer aNbEF;
|
|
||||||
for (j=1; j<=aNbj; j++) {
|
|
||||||
iFF=aFFIndicesMap(j);
|
|
||||||
BOPTools_SSInterference& aFF=aFFs(iFF);
|
|
||||||
bIsTouch=aFF.IsTangentFaces();
|
|
||||||
if (!bIsTouch) {
|
|
||||||
AddPartsEFNonSDSh (nF1, iFF, anEMap, aWES);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aNbEF = aWES.StartElements().Extent() - aNbEdges1;
|
|
||||||
//
|
|
||||||
if((aNbEdges1 > 0) && (aNbEF > 0)) {
|
|
||||||
for (j=1; j<=aNbj; j++) {
|
|
||||||
iFF=aFFIndicesMap(j);
|
|
||||||
BOPTools_SSInterference& aFF=aFFs(iFF);
|
|
||||||
bIsTouch=aFF.IsTangentFaces();
|
|
||||||
if (!bIsTouch) {
|
|
||||||
AddPartsEENonSDSh (nF1, iFF, anEMap, aWES);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// IFV's workaround for occ13538 - end
|
|
||||||
//
|
|
||||||
}// end of if (bIsTouchCase)
|
|
||||||
else {
|
|
||||||
// 1. Add Split Parts having states in accordance with operation
|
|
||||||
AddSplitPartsINOUT (nF1, aWES);
|
|
||||||
// 2. Add Split Parts with state ON
|
|
||||||
AddSplitPartsONSh (nF1, aWES);
|
|
||||||
// 3. Add Section Edges to the WES
|
|
||||||
for (j=1; j<=aNbj; j++) {
|
|
||||||
iFF=aFFIndicesMap(j);
|
|
||||||
AddSectionPartsSh(nF1, iFF, aWES);
|
|
||||||
}
|
|
||||||
// 4. Add EF parts (E (from F2) on F1 )
|
|
||||||
anEMap.Clear();
|
|
||||||
for (j=1; j<=aNbj; j++) {
|
|
||||||
iFF=aFFIndicesMap(j);
|
|
||||||
AddPartsEFSh(nF1, iFF, anEMap, aWES);
|
|
||||||
}
|
|
||||||
}// end of (bIsTouchCase)'s else
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// d. Build new Faces from myFace
|
|
||||||
BOP_FaceBuilder aFB;
|
|
||||||
aFB.SetTreatment(0); // 0-Do Internal Edges
|
|
||||||
aFB.SetTreatSDScales(1);
|
|
||||||
aFB.Do(aWES);
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& aLF=aFB.NewFaces();
|
|
||||||
//
|
|
||||||
// e. Do Internal Vertices
|
|
||||||
//
|
|
||||||
DoInternalVertices(nF1, aLF);
|
|
||||||
//
|
|
||||||
// f. Orient new faces
|
|
||||||
TopTools_ListOfShape aLFx;
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt;
|
|
||||||
anIt.Initialize(aLF);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
TopoDS_Shape& aFx=anIt.Value();
|
|
||||||
aFx.Orientation(anOriF1);
|
|
||||||
aListOfNewFaces.Append(aFx);
|
|
||||||
aLFx.Append(aFx);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Fill "Modified"
|
|
||||||
FillModified(aF1, aLFx);
|
|
||||||
//
|
|
||||||
}// for (i=1; i<=aNb; i++)
|
|
||||||
//
|
|
||||||
|
|
||||||
myNewFaces.Clear();
|
|
||||||
myNewFaces.Append(aListOfNewFaces);
|
|
||||||
}
|
|
||||||
/* DEB
|
|
||||||
{
|
|
||||||
TopoDS_Compound aCx;
|
|
||||||
BRep_Builder aBB;
|
|
||||||
//
|
|
||||||
aBB.MakeCompound(aCx);
|
|
||||||
aBB.Add(aCx, myFace);
|
|
||||||
//
|
|
||||||
aWES.InitStartElements();
|
|
||||||
for (; aWES.MoreStartElements(); aWES.NextStartElement()) {
|
|
||||||
const TopoDS_Shape& aE = aWES.StartElement();
|
|
||||||
aBB.Add(aCx, aE);
|
|
||||||
}
|
|
||||||
int a=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
@ -1,329 +0,0 @@
|
|||||||
-- Created on: 2001-11-02
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 ShellSolid from BOP inherits Builder from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- Performs Boolean Operations (BO)
|
|
||||||
-- Common,Cut,Fuse for arguments of
|
|
||||||
-- shell/solid type
|
|
||||||
---
|
|
||||||
uses
|
|
||||||
|
|
||||||
DSFiller from BOPTools,
|
|
||||||
|
|
||||||
WireEdgeSet from BOP,
|
|
||||||
ShellFaceSet from BOP,
|
|
||||||
Operation from BOP,
|
|
||||||
HistoryCollector from BOP,
|
|
||||||
|
|
||||||
Shape from TopoDS,
|
|
||||||
Edge from TopoDS,
|
|
||||||
Face from TopoDS,
|
|
||||||
Shell from TopoDS,
|
|
||||||
|
|
||||||
ListOfShape from TopTools,
|
|
||||||
IndexedDataMapOfShapeListOfShape from TopTools,
|
|
||||||
IndexedMapOfShape from TopTools,
|
|
||||||
DataMapOfShapeInteger from TopTools,
|
|
||||||
|
|
||||||
IndexedMapOfInteger from TColStd,
|
|
||||||
|
|
||||||
StateOfShape from BooleanOperations,
|
|
||||||
State from TopAbs,
|
|
||||||
--modified by NIZHNY-MKK Tue Sep 7 11:37:57 2004
|
|
||||||
ShapeEnum from TopAbs,
|
|
||||||
|
|
||||||
Orientation from TopAbs
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns ShellSolid from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
Do (me:out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- see base classes, please
|
|
||||||
---
|
|
||||||
DoWithFiller (me:out;
|
|
||||||
aDSF: DSFiller from BOPTools)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- see base classes, please
|
|
||||||
---
|
|
||||||
Destroy (me: in out)
|
|
||||||
is redefined;
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_ShellSolid(){Destroy();}"
|
|
||||||
---Purpose:
|
|
||||||
--- Destructor
|
|
||||||
---
|
|
||||||
BuildResult (me:out)
|
|
||||||
is redefined ;
|
|
||||||
---Purpose:
|
|
||||||
--- see base classes, please
|
|
||||||
---
|
|
||||||
DoNewFaces(me: in out)
|
|
||||||
is virtual;
|
|
||||||
---Purpose:
|
|
||||||
--- see base classes, please
|
|
||||||
---
|
|
||||||
Prepare(me:out)
|
|
||||||
--modified by NIZNHY-PKV Wed Sep 11 17:55:29 2002 f
|
|
||||||
is virtual;--protected;
|
|
||||||
--modified by NIZNHY-PKV Wed Sep 11 17:55:32 2002 t
|
|
||||||
---Purpose:
|
|
||||||
--- Provides some preparing steps of algorithm
|
|
||||||
--- 1. Compute the 3D-States
|
|
||||||
--- 2. Compute P-Curves for section- and split- edges
|
|
||||||
--- 3. Treat degenerated edges
|
|
||||||
--- 4 Detect Same Domain faces
|
|
||||||
---
|
|
||||||
DetectSDFaces (me:out)
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- The algo to find SameDomain Faces
|
|
||||||
--- among interferred ones
|
|
||||||
---
|
|
||||||
----------------------------------------------
|
|
||||||
--
|
|
||||||
-- W E S C O M P O N E N T S
|
|
||||||
--
|
|
||||||
-- (for internal usage)
|
|
||||||
--
|
|
||||||
--
|
|
||||||
AddSplitPartsINOUT (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
---
|
|
||||||
--- WES components for an argument of SHELL type
|
|
||||||
---
|
|
||||||
AddSectionPartsSh (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected ;
|
|
||||||
|
|
||||||
AddSplitPartsONSh (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
AddPartsEFSh (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
anEMap : out IndexedMapOfShape from TopTools;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
AddINON2DPartsSh (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
AddINON2DPartsSh (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
aWES :out WireEdgeSet from BOP;
|
|
||||||
anEMap : out IndexedMapOfShape from TopTools)
|
|
||||||
is protected;
|
|
||||||
--
|
|
||||||
AddPartsEFNonSDSh (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
anEMap : out IndexedMapOfShape from TopTools;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
AddPartsEENonSDSh (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
anEMap : out IndexedMapOfShape from TopTools;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
---
|
|
||||||
--- WES components for an argument of SOLID type
|
|
||||||
---
|
|
||||||
AddSectionPartsSo (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
AddSplitPartsON3DSo (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
AddSplitPartsONSo(me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
aMEFObj :IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
aMEFTool:IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
AddPartsEFSo (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
aMEFObj :IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
aMEFTool:IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
anEMap : out IndexedMapOfShape from TopTools;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
AddINON2DPartsSo (me:out;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
nF2 :Integer from Standard;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
AddPartsEFSDSo (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
aMEFObj :IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
aMEFTool:IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
AddPartsEFNonSDSo (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
aMEFObj :IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
aMEFTool:IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
aFFInMap:IndexedMapOfInteger from TColStd;
|
|
||||||
anEMap : out IndexedMapOfShape from TopTools;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
AddPartsEENonSDSo (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
aMEFObj :IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
aMEFTool:IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
aFFInMap:IndexedMapOfInteger from TColStd;
|
|
||||||
anEMap : out IndexedMapOfShape from TopTools;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
AddPartsEESDSo (me:out;
|
|
||||||
nF1 :Integer from Standard;
|
|
||||||
iFF :Integer from Standard;
|
|
||||||
aMEFObj :IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
aMEFTool:IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
aWES :out WireEdgeSet from BOP)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
--modified by NIZHNY-MKK Tue Sep 7 11:38:00 2004
|
|
||||||
CheckArgTypes(myclass; theType1, theType2: ShapeEnum from TopAbs;
|
|
||||||
theOperation: Operation from BOP)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Check the types of arguments.
|
|
||||||
--- Returns FALSE if types of arguments
|
|
||||||
--- are non-valid to be treated by the
|
|
||||||
--- agorithm
|
|
||||||
|
|
||||||
CheckArgTypes(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Check the types of arguments.
|
|
||||||
--- Returns FALSE if types of arguments
|
|
||||||
--- are non-valid to be treated by the
|
|
||||||
--- agorithm
|
|
||||||
---
|
|
||||||
Path(myclass;
|
|
||||||
aE:Shape from TopoDS;
|
|
||||||
aEFMap: IndexedDataMapOfShapeListOfShape from TopTools;
|
|
||||||
aFaces: out IndexedMapOfShape from TopTools;
|
|
||||||
aProcE: out IndexedMapOfShape from TopTools)
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
Orientation(myclass;
|
|
||||||
aE: Edge from TopoDS;
|
|
||||||
aF: Face from TopoDS)
|
|
||||||
returns Orientation from TopAbs
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
OrientFacesOnShell (myclass;
|
|
||||||
aShell: Shell from TopoDS;
|
|
||||||
aShellNew: out Shell from TopoDS)
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
---
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
DoInternalVertices (me:out;
|
|
||||||
nF1:Integer from Standard;
|
|
||||||
aFaces: ListOfShape from TopTools)
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
Internals(me)
|
|
||||||
returns ListOfShape from TopTools
|
|
||||||
is protected;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
CollectInternals(me:out)
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
|
|
||||||
FillSectionEdges(me:out)
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
SplitFace(me; theFaceIndex: Integer from Standard;
|
|
||||||
theMapOfEdgeIndex: out DataMapOfShapeInteger from TopTools;
|
|
||||||
theListOfFace: out ListOfShape from TopTools)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
SetHistoryCollector(me: in out; theHistory: HistoryCollector from BOP)
|
|
||||||
is redefined virtual;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myFace : Face from TopoDS
|
|
||||||
is protected;
|
|
||||||
myNewFaces : ListOfShape from TopTools
|
|
||||||
is protected;
|
|
||||||
myInternals : ListOfShape from TopTools
|
|
||||||
is protected;
|
|
||||||
myRank : Integer from Standard
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
end ShellSolid;
|
|
File diff suppressed because it is too large
Load Diff
@ -1,51 +0,0 @@
|
|||||||
-- Created on: 2003-03-24
|
|
||||||
-- Created by: Michael KLOKOV
|
|
||||||
-- Copyright (c) 2003-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 ShellSolidHistoryCollector from BOP
|
|
||||||
inherits HistoryCollector from BOP
|
|
||||||
|
|
||||||
uses
|
|
||||||
Shape from TopoDS,
|
|
||||||
PDSFiller from BOPTools,
|
|
||||||
Operation from BOP,
|
|
||||||
ListOfShape from TopTools
|
|
||||||
|
|
||||||
is
|
|
||||||
Create(theShape1 : Shape from TopoDS;
|
|
||||||
theShape2 : Shape from TopoDS;
|
|
||||||
theOperation: Operation from BOP)
|
|
||||||
returns ShellSolidHistoryCollector from BOP;
|
|
||||||
|
|
||||||
AddNewFace(me: mutable; theOldShape: Shape from TopoDS;
|
|
||||||
theNewShape: Shape from TopoDS;
|
|
||||||
theDSFiller: PDSFiller from BOPTools);
|
|
||||||
|
|
||||||
SetResult(me: mutable; theResult: Shape from TopoDS;
|
|
||||||
theDSFiller: PDSFiller from BOPTools)
|
|
||||||
is redefined virtual;
|
|
||||||
|
|
||||||
--- private
|
|
||||||
FillSection(me: mutable; theDSFiller: PDSFiller from BOPTools)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
FillEdgeHistory(me: mutable; theDSFiller: PDSFiller from BOPTools)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
end ShellSolidHistoryCollector from BOP;
|
|
@ -1,408 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
#include <BOP_ShellSolidHistoryCollector.ixx>
|
|
||||||
|
|
||||||
#include <TopAbs.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
#include <BooleanOperations_IndexedDataMapOfShapeInteger.hxx>
|
|
||||||
#include <BOPTools_SSInterference.hxx>
|
|
||||||
#include <BOPTools_InterferencePool.hxx>
|
|
||||||
#include <BOPTools_CArray1OfSSInterference.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_Curve.hxx>
|
|
||||||
#include <BOPTools_PaveBlock.hxx>
|
|
||||||
#include <BOPTools_DSFiller.hxx>
|
|
||||||
#include <BOPTools_PaveFiller.hxx>
|
|
||||||
#include <BOPTools_CommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListOfCommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPave.hxx>
|
|
||||||
#include <BOP_BuilderTools.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
|
|
||||||
// ====================================================================================================
|
|
||||||
// function: Constructor
|
|
||||||
// purpose:
|
|
||||||
// ====================================================================================================
|
|
||||||
BOP_ShellSolidHistoryCollector::BOP_ShellSolidHistoryCollector(const TopoDS_Shape& theShape1,
|
|
||||||
const TopoDS_Shape& theShape2,
|
|
||||||
const BOP_Operation theOperation) :
|
|
||||||
BOP_HistoryCollector(theShape1, theShape2, theOperation)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ====================================================================================================
|
|
||||||
// function: AddNewFace
|
|
||||||
// purpose:
|
|
||||||
// ====================================================================================================
|
|
||||||
void BOP_ShellSolidHistoryCollector::AddNewFace(const TopoDS_Shape& theOldShape,
|
|
||||||
const TopoDS_Shape& theNewShape,
|
|
||||||
const BOPTools_PDSFiller& theDSFiller)
|
|
||||||
{
|
|
||||||
Standard_Boolean bAddAsGenerated = Standard_True;
|
|
||||||
|
|
||||||
if(theOldShape.ShapeType() != theNewShape.ShapeType())
|
|
||||||
return;
|
|
||||||
|
|
||||||
const BooleanOperations_IndexedDataMapOfShapeInteger& aMap = theDSFiller->DS().ShapeIndexMap(1);
|
|
||||||
Standard_Boolean bIsObject = (myS1.ShapeType() == TopAbs_SHELL) ? aMap.Contains(theOldShape) : !aMap.Contains(theOldShape);
|
|
||||||
|
|
||||||
if(bIsObject) {
|
|
||||||
bAddAsGenerated = Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopTools_DataMapOfShapeListOfShape& aHistoryMap = (bAddAsGenerated) ? myGenMap : myModifMap;
|
|
||||||
|
|
||||||
if(aHistoryMap.IsBound(theOldShape)) {
|
|
||||||
aHistoryMap.ChangeFind(theOldShape).Append(theNewShape);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape aShapeList;
|
|
||||||
aShapeList.Append(theNewShape);
|
|
||||||
aHistoryMap.Bind(theOldShape, aShapeList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ====================================================================================================
|
|
||||||
// function: SetResult
|
|
||||||
// purpose:
|
|
||||||
// ====================================================================================================
|
|
||||||
void BOP_ShellSolidHistoryCollector::SetResult(const TopoDS_Shape& theResult,
|
|
||||||
const BOPTools_PDSFiller& theDSFiller)
|
|
||||||
{
|
|
||||||
myResult = theResult;
|
|
||||||
FillSection(theDSFiller);
|
|
||||||
FillEdgeHistory(theDSFiller);
|
|
||||||
|
|
||||||
myHasDeleted = Standard_False;
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
|
|
||||||
TopTools_IndexedMapOfShape aFreeBoundaryMap;
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aEFMap;
|
|
||||||
|
|
||||||
if(myS1.ShapeType() == TopAbs_SHELL) {
|
|
||||||
TopExp::MapShapesAndAncestors(myS1, TopAbs_EDGE, TopAbs_FACE, aEFMap);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopExp::MapShapesAndAncestors(myS2, TopAbs_EDGE, TopAbs_FACE, aEFMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 1; i <= aEFMap.Extent(); i++) {
|
|
||||||
if(aEFMap.FindFromIndex(i).Extent() < 2)
|
|
||||||
aFreeBoundaryMap.Add(aEFMap.FindKey(i));
|
|
||||||
}
|
|
||||||
aEFMap.Clear();
|
|
||||||
|
|
||||||
for(i = (Standard_Integer)TopAbs_FACE; !myHasDeleted && (i < (Standard_Integer)TopAbs_EDGE); i++) {
|
|
||||||
if(i == (Standard_Integer)TopAbs_WIRE)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
TopAbs_ShapeEnum aType = (TopAbs_ShapeEnum) i;
|
|
||||||
TopTools_IndexedMapOfShape aMap;
|
|
||||||
TopExp::MapShapes(myResult, aType, aMap);
|
|
||||||
|
|
||||||
TopExp_Explorer anExpObj(myS1, aType);
|
|
||||||
|
|
||||||
for(; anExpObj.More(); anExpObj.Next()) {
|
|
||||||
const TopoDS_Shape& aS = anExpObj.Current();
|
|
||||||
|
|
||||||
if((i == (Standard_Integer)TopAbs_EDGE) && !aFreeBoundaryMap.Contains(aS))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(!aMap.Contains(aS)) {
|
|
||||||
|
|
||||||
if((!myModifMap.IsBound(aS) || myModifMap(aS).IsEmpty()) &&
|
|
||||||
(!myGenMap.IsBound(aS) || myGenMap(aS).IsEmpty())) {
|
|
||||||
myHasDeleted = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TopExp_Explorer anExpTool(myS2, aType);
|
|
||||||
|
|
||||||
for(; anExpTool.More(); anExpTool.Next()) {
|
|
||||||
const TopoDS_Shape& aS = anExpTool.Current();
|
|
||||||
|
|
||||||
if(!aMap.Contains(aS)) {
|
|
||||||
if((!myModifMap.IsBound(aS) || myModifMap(aS).IsEmpty()) &&
|
|
||||||
(!myGenMap.IsBound(aS) || myGenMap(aS).IsEmpty())) {
|
|
||||||
myHasDeleted = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ====================================================================================================
|
|
||||||
// function: FillSection
|
|
||||||
// purpose:
|
|
||||||
// ====================================================================================================
|
|
||||||
void BOP_ShellSolidHistoryCollector::FillSection(const BOPTools_PDSFiller& theDSFiller)
|
|
||||||
{
|
|
||||||
BOPTools_InterferencePool* pIntrPool = (BOPTools_InterferencePool*)&theDSFiller->InterfPool();
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs = pIntrPool->SSInterferences();
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aResultMap;
|
|
||||||
|
|
||||||
if(!myResult.IsNull()) {
|
|
||||||
TopExp::MapShapesAndAncestors(myResult, TopAbs_EDGE, TopAbs_FACE, aResultMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 1; i <= aFFs.Extent(); i++) {
|
|
||||||
BOPTools_SSInterference& aFF = aFFs(i);
|
|
||||||
Standard_Integer nF1 = aFF.Index1();
|
|
||||||
Standard_Integer nF2 = aFF.Index2();
|
|
||||||
|
|
||||||
if(aFF.IsTangentFaces())
|
|
||||||
continue;
|
|
||||||
TopoDS_Shape aF1 = theDSFiller->DS().Shape(nF1);
|
|
||||||
TopoDS_Shape aF2 = theDSFiller->DS().Shape(nF2);
|
|
||||||
|
|
||||||
|
|
||||||
BOPTools_SequenceOfCurves& aSeqOfCurves = aFF.Curves();
|
|
||||||
Standard_Integer j = 0;
|
|
||||||
|
|
||||||
for(j = 1; j <= aSeqOfCurves.Length(); j++) {
|
|
||||||
const BOPTools_Curve& aCurve = aSeqOfCurves.Value(j);
|
|
||||||
|
|
||||||
const BOPTools_ListOfPaveBlock& aPBList = aCurve.NewPaveBlocks();
|
|
||||||
BOPTools_ListIteratorOfListOfPaveBlock anIt(aPBList);
|
|
||||||
|
|
||||||
for (; anIt.More();anIt.Next()) {
|
|
||||||
const BOPTools_PaveBlock& aPB = anIt.Value();
|
|
||||||
Standard_Integer anindex = aPB.Edge();
|
|
||||||
const TopoDS_Shape& aS = theDSFiller->DS().GetShape(anindex);
|
|
||||||
|
|
||||||
if(aResultMap.Contains(aS)) {
|
|
||||||
TopTools_ListOfShape thelist;
|
|
||||||
if(!myGenMap.IsBound(aF1))
|
|
||||||
myGenMap.Bind(aF1, thelist);
|
|
||||||
myGenMap.ChangeFind(aF1).Append(aS);
|
|
||||||
|
|
||||||
if(!myGenMap.IsBound(aF2))
|
|
||||||
myGenMap.Bind(aF2, thelist);
|
|
||||||
myGenMap.ChangeFind(aF2).Append(aS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Old Section Edges
|
|
||||||
const BOPTools_ListOfPaveBlock& aSectList = aFF.PaveBlocks();
|
|
||||||
BOPTools_ListIteratorOfListOfPaveBlock anIt(aSectList);
|
|
||||||
|
|
||||||
for (; anIt.More();anIt.Next()) {
|
|
||||||
const BOPTools_PaveBlock& aPB=anIt.Value();
|
|
||||||
Standard_Integer nSect = aPB.Edge();
|
|
||||||
const TopoDS_Shape& aS = theDSFiller->DS().GetShape(nSect);
|
|
||||||
|
|
||||||
if(aResultMap.Contains(aS)) {
|
|
||||||
if(aResultMap.FindFromKey(aS).Extent() >= 2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Standard_Boolean add1 = Standard_True;
|
|
||||||
TopTools_ListOfShape thelist1;
|
|
||||||
if(!myGenMap.IsBound(aF1))
|
|
||||||
myGenMap.Bind(aF1, thelist1);
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape& aList = myGenMap.ChangeFind(aF1);
|
|
||||||
TopTools_ListIteratorOfListOfShape anItF1(aList);
|
|
||||||
|
|
||||||
for(; anItF1.More(); anItF1.Next()) {
|
|
||||||
if(aS.IsSame(anItF1.Value())) {
|
|
||||||
add1 = Standard_False;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(add1) {
|
|
||||||
myGenMap.ChangeFind(aF1).Append(aS);
|
|
||||||
}
|
|
||||||
Standard_Boolean add2 = Standard_True;
|
|
||||||
TopTools_ListOfShape thelist2;
|
|
||||||
if(!myGenMap.IsBound(aF2))
|
|
||||||
myGenMap.Bind(aF2, thelist2);
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape& aList = myGenMap.ChangeFind(aF2);
|
|
||||||
TopTools_ListIteratorOfListOfShape anItF2(aList);
|
|
||||||
|
|
||||||
for(; anItF2.More(); anItF2.Next()) {
|
|
||||||
if(aS.IsSame(anItF2.Value())) {
|
|
||||||
add2 = Standard_False;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(add2) {
|
|
||||||
myGenMap.ChangeFind(aF2).Append(aS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
aResultMap.Clear();
|
|
||||||
TopTools_IndexedMapOfShape aResultMapV;
|
|
||||||
|
|
||||||
if(!myResult.IsNull()) {
|
|
||||||
TopExp::MapShapes(myResult, TopAbs_VERTEX, aResultMapV);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 1; i <= aFFs.Extent(); i++) {
|
|
||||||
BOPTools_SSInterference& aFF = aFFs(i);
|
|
||||||
Standard_Integer nF1 = aFF.Index1();
|
|
||||||
Standard_Integer nF2 = aFF.Index2();
|
|
||||||
|
|
||||||
if(aFF.IsTangentFaces())
|
|
||||||
continue;
|
|
||||||
TopoDS_Shape aF1 = theDSFiller->DS().Shape(nF1);
|
|
||||||
TopoDS_Shape aF2 = theDSFiller->DS().Shape(nF2);
|
|
||||||
|
|
||||||
TColStd_ListIteratorOfListOfInteger anIt(aFF.AloneVertices());
|
|
||||||
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
TopoDS_Shape aNewVertex = theDSFiller->DS().Shape(anIt.Value());
|
|
||||||
|
|
||||||
if(aResultMapV.Contains(aNewVertex)) {
|
|
||||||
TopTools_ListOfShape thelist3;
|
|
||||||
if(!myGenMap.IsBound(aF1))
|
|
||||||
myGenMap.Bind(aF1, thelist3);
|
|
||||||
myGenMap.ChangeFind(aF1).Append(aNewVertex);
|
|
||||||
|
|
||||||
if(!myGenMap.IsBound(aF2))
|
|
||||||
myGenMap.Bind(aF2, thelist3);
|
|
||||||
myGenMap.ChangeFind(aF2).Append(aNewVertex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ====================================================================================================
|
|
||||||
// function: FillEdgeHistory
|
|
||||||
// purpose:
|
|
||||||
// ====================================================================================================
|
|
||||||
void BOP_ShellSolidHistoryCollector::FillEdgeHistory(const BOPTools_PDSFiller& theDSFiller)
|
|
||||||
{
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS = theDSFiller->DS();
|
|
||||||
const BOPTools_PaveFiller& aPaveFiller = theDSFiller->PaveFiller();
|
|
||||||
const BOPTools_SplitShapesPool& aSplitShapesPool = aPaveFiller.SplitShapesPool();
|
|
||||||
TopTools_IndexedMapOfShape aResultMap, aFreeBoundaryMap;
|
|
||||||
|
|
||||||
if(!myResult.IsNull()) {
|
|
||||||
TopExp::MapShapes(myResult, TopAbs_EDGE, aResultMap);
|
|
||||||
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aEFMap;
|
|
||||||
|
|
||||||
if(myS1.ShapeType() == TopAbs_SHELL) {
|
|
||||||
TopExp::MapShapesAndAncestors(myS1, TopAbs_EDGE, TopAbs_FACE, aEFMap);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopExp::MapShapesAndAncestors(myS2, TopAbs_EDGE, TopAbs_FACE, aEFMap);
|
|
||||||
}
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
|
|
||||||
for(i = 1; i <= aEFMap.Extent(); i++) {
|
|
||||||
if(aEFMap.FindFromIndex(i).Extent() < 2)
|
|
||||||
aFreeBoundaryMap.Add(aEFMap.FindKey(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer iRank = 1;
|
|
||||||
|
|
||||||
for(; iRank <= 2; iRank++) {
|
|
||||||
BooleanOperations_StateOfShape aStateCmp, aState;
|
|
||||||
aStateCmp = BOP_BuilderTools::StateToCompare(iRank, myOp);
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
Standard_Integer nb = aDS.NumberOfShapesOfTheObject();
|
|
||||||
nb = (iRank == 1) ? nb : (nb + aDS.NumberOfShapesOfTheTool());
|
|
||||||
Standard_Integer startindex = (iRank == 1) ? 1 : (aDS.NumberOfShapesOfTheObject() + 1);
|
|
||||||
|
|
||||||
for(i = startindex; i <= nb; i++) {
|
|
||||||
if(aDS.GetShapeType(i) != TopAbs_EDGE)
|
|
||||||
continue;
|
|
||||||
const BOPTools_ListOfPaveBlock& aLPB = aSplitShapesPool(aDS.RefEdge(i));
|
|
||||||
const TopoDS_Shape& anOldShape = aDS.Shape(i);
|
|
||||||
|
|
||||||
if(!aFreeBoundaryMap.Contains(anOldShape)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!aLPB.IsEmpty()) {
|
|
||||||
BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aLPB);
|
|
||||||
|
|
||||||
for(; aPBIt.More(); aPBIt.Next()) {
|
|
||||||
const BOPTools_PaveBlock& aPB = aPBIt.Value();
|
|
||||||
Standard_Integer nSp = aPB.Edge();
|
|
||||||
|
|
||||||
if(nSp == i)
|
|
||||||
continue;
|
|
||||||
aState=aDS.GetState(nSp);
|
|
||||||
|
|
||||||
if (aState == aStateCmp) {
|
|
||||||
const TopoDS_Shape& aNewShape = aDS.Shape(nSp);
|
|
||||||
|
|
||||||
if(aResultMap.Contains(aNewShape)) {
|
|
||||||
TopTools_DataMapOfShapeListOfShape& aHistoryMap = myModifMap;
|
|
||||||
|
|
||||||
if(aHistoryMap.IsBound(anOldShape)) {
|
|
||||||
aHistoryMap.ChangeFind(anOldShape).Append(aNewShape);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape aShapeList;
|
|
||||||
aShapeList.Append(aNewShape);
|
|
||||||
aHistoryMap.Bind(anOldShape, aShapeList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//end if(!aLPB.IsEmpty...
|
|
||||||
|
|
||||||
const BOPTools_CommonBlockPool& aCBPool = aPaveFiller.CommonBlockPool();
|
|
||||||
const BOPTools_ListOfCommonBlock& aLCB = aCBPool(aDS.RefEdge(i));
|
|
||||||
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
|
|
||||||
|
|
||||||
for (; anItCB.More(); anItCB.Next()) {
|
|
||||||
const BOPTools_CommonBlock& aCB = anItCB.Value();
|
|
||||||
const BOPTools_PaveBlock& aPB = aCB.PaveBlock1();
|
|
||||||
Standard_Integer nSp = aPB.Edge();
|
|
||||||
TopoDS_Shape aNewShape = aDS.Shape(nSp);
|
|
||||||
|
|
||||||
if(aResultMap.Contains(aNewShape)) {
|
|
||||||
TopTools_DataMapOfShapeListOfShape& aHistoryMap = myModifMap;
|
|
||||||
|
|
||||||
if(aHistoryMap.IsBound(anOldShape)) {
|
|
||||||
aHistoryMap.ChangeFind(anOldShape).Append(aNewShape);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape aShapeList;
|
|
||||||
aShapeList.Append(aNewShape);
|
|
||||||
aHistoryMap.Bind(anOldShape, aShapeList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// end for (; anItCB.More...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,933 +0,0 @@
|
|||||||
// Created on: 2001-11-02
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2001-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 <BOP_ShellSolid.ixx>
|
|
||||||
|
|
||||||
#include <TColStd_ListOfInteger.hxx>
|
|
||||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
|
||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS_Face.hxx>
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
|
|
||||||
#include <TopAbs_Orientation.hxx>
|
|
||||||
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
#include <TopTools_ListOfShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfOrientedShape.hxx>
|
|
||||||
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
#include <BooleanOperations_IndexedDataMapOfShapeInteger.hxx>
|
|
||||||
|
|
||||||
#include <IntTools_Context.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_InterferencePool.hxx>
|
|
||||||
#include <BOPTools_CArray1OfSSInterference.hxx>
|
|
||||||
#include <BOPTools_SSInterference.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_SequenceOfCurves.hxx>
|
|
||||||
#include <BOPTools_Curve.hxx>
|
|
||||||
#include <BOPTools_ListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_PaveBlock.hxx>
|
|
||||||
#include <BOPTools_PaveFiller.hxx>
|
|
||||||
#include <BOPTools_CommonBlockPool.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_ListOfCommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
|
|
||||||
#include <BOPTools_CommonBlock.hxx>
|
|
||||||
#include <BOPTools_Tools3D.hxx>
|
|
||||||
#include <BOPTools_InterferencePool.hxx>
|
|
||||||
#include <BOPTools_CArray1OfSSInterference.hxx>
|
|
||||||
|
|
||||||
#include <BOP_SDFWESFiller.hxx>
|
|
||||||
|
|
||||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
|
|
||||||
static
|
|
||||||
Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit,
|
|
||||||
const BOPTools_CommonBlock& theCB,
|
|
||||||
const Standard_Integer theEdgeIndex,
|
|
||||||
const Standard_Integer theFaceIndex,
|
|
||||||
const BOPTools_PDSFiller& theDSFiller,
|
|
||||||
const BOP_Operation& theOperation,
|
|
||||||
const Handle(IntTools_Context)& theContext);
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//
|
|
||||||
// the WES components for a shell
|
|
||||||
//
|
|
||||||
//=======================================================================
|
|
||||||
// function: AddSectionPartsSh
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellSolid::AddSectionPartsSh (const Standard_Integer nF1,
|
|
||||||
const Standard_Integer iFF,
|
|
||||||
BOP_WireEdgeSet& aWES)
|
|
||||||
{
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
|
|
||||||
//
|
|
||||||
Standard_Integer i, aNbCurves, nF2, nE, iRankF1;
|
|
||||||
//
|
|
||||||
iRankF1=aDS.Rank(nF1);
|
|
||||||
//
|
|
||||||
BOPTools_SSInterference& aFF=aFFs(iFF);
|
|
||||||
nF2=aFF.OppositeIndex(nF1);
|
|
||||||
//
|
|
||||||
BOPTools_SequenceOfCurves& aSC=aFF.Curves();
|
|
||||||
aNbCurves=aSC.Length();
|
|
||||||
for (i=1; i<=aNbCurves; i++) {
|
|
||||||
const BOPTools_Curve& aBC=aSC(i);
|
|
||||||
const BOPTools_ListOfPaveBlock& aLPB=aBC.NewPaveBlocks();
|
|
||||||
BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const BOPTools_PaveBlock& aPB=anIt.Value();
|
|
||||||
nE=aPB.Edge();
|
|
||||||
const TopoDS_Edge& aE=TopoDS::Edge(aDS.Shape(nE));
|
|
||||||
|
|
||||||
TopoDS_Edge aES=aE;
|
|
||||||
|
|
||||||
if (myOperation==BOP_FUSE) {
|
|
||||||
aWES.AddStartElement (aES);
|
|
||||||
aES.Reverse();
|
|
||||||
aWES.AddStartElement (aES);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: AddSplitPartsONSh
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellSolid::AddSplitPartsONSh(const Standard_Integer nF1,
|
|
||||||
BOP_WireEdgeSet& aWES)
|
|
||||||
{
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
|
|
||||||
|
|
||||||
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPaveFiller;
|
|
||||||
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool();
|
|
||||||
//
|
|
||||||
const Handle(IntTools_Context)& aContext=pPaveFiller->Context();
|
|
||||||
//
|
|
||||||
Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, iRankF1;
|
|
||||||
Standard_Boolean bToReverse;
|
|
||||||
TopAbs_Orientation anOrEF1, anOrEF2;
|
|
||||||
TopExp_Explorer anExp;
|
|
||||||
TopTools_IndexedMapOfShape aM;
|
|
||||||
TopoDS_Edge aSSF1, aSSF2;
|
|
||||||
//
|
|
||||||
iRankF1=aDS.Rank(nF1);
|
|
||||||
//
|
|
||||||
anExp.Init(myFace, TopAbs_EDGE);
|
|
||||||
for (; anExp.More(); anExp.Next()) {
|
|
||||||
const TopoDS_Edge& anEF1=TopoDS::Edge(anExp.Current());
|
|
||||||
anOrEF1=anEF1.Orientation();
|
|
||||||
nEF1=aDS.ShapeIndex(anEF1, iRankF1);
|
|
||||||
|
|
||||||
BOPTools_ListOfCommonBlock& aLCB=aCBPool(aDS.RefEdge(nEF1));
|
|
||||||
|
|
||||||
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
|
|
||||||
for (; anItCB.More(); anItCB.Next()) {
|
|
||||||
BOPTools_CommonBlock& aCB=anItCB.Value();
|
|
||||||
|
|
||||||
BOPTools_PaveBlock& aPBEF1=aCB.PaveBlock1(nEF1);
|
|
||||||
BOPTools_PaveBlock& aPBEF2=aCB.PaveBlock2(nEF1);
|
|
||||||
nF2=aCB.Face();
|
|
||||||
if (nF2) {
|
|
||||||
// Splits that are ON (IN 2D) for other Face (aF2)
|
|
||||||
nSpF1=aPBEF1.Edge();
|
|
||||||
const TopoDS_Shape& aSplit=aDS.Shape(nSpF1);
|
|
||||||
aSSF1=TopoDS::Edge(aSplit);
|
|
||||||
//
|
|
||||||
//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
|
||||||
// Internal edges treatment
|
|
||||||
{
|
|
||||||
if (anOrEF1==TopAbs_INTERNAL) {
|
|
||||||
if (myOperation==BOP_FUSE) {
|
|
||||||
aSSF1.Orientation(TopAbs_FORWARD);
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
aSSF1.Reverse();
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
}
|
|
||||||
else if (myOperation==BOP_CUT) {
|
|
||||||
if (iRankF1==1) {
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (myOperation==BOP_CUT21) {
|
|
||||||
if (iRankF1==2) {
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
|
||||||
//
|
|
||||||
aSSF1.Orientation(anOrEF1);
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
// Splits that are ON other Edge from other Face
|
|
||||||
nSpF1=aPBEF1.Edge();
|
|
||||||
nSpF2=aPBEF2.Edge();
|
|
||||||
nEF2=aPBEF2.OriginalEdge();
|
|
||||||
|
|
||||||
const TopoDS_Edge& anEF2=TopoDS::Edge(aDS.Shape(nEF2));
|
|
||||||
anOrEF2=anEF2.Orientation();
|
|
||||||
|
|
||||||
const TopoDS_Shape& aSpF1=aDS.Shape(nSpF1);
|
|
||||||
const TopoDS_Shape& aSpF2=aDS.Shape(nSpF2);
|
|
||||||
//
|
|
||||||
// Pave Block from which new edge will be taken
|
|
||||||
const BOPTools_PaveBlock& aPB=aCB.PaveBlock1();
|
|
||||||
nSpTaken=aPB.Edge();
|
|
||||||
//
|
|
||||||
//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
|
||||||
// Internal edges treatment
|
|
||||||
{
|
|
||||||
Standard_Boolean bInternal1, bInternal2;
|
|
||||||
bInternal1=(anOrEF1==TopAbs_INTERNAL);
|
|
||||||
bInternal2=(anOrEF2==TopAbs_INTERNAL);
|
|
||||||
|
|
||||||
if (bInternal1) {
|
|
||||||
aSSF1=TopoDS::Edge(aDS.Shape(nSpTaken));
|
|
||||||
|
|
||||||
if (myOperation==BOP_FUSE) {
|
|
||||||
aSSF1.Orientation(TopAbs_FORWARD);
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
aSSF1.Reverse();
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myOperation==BOP_CUT && iRankF1==1) {
|
|
||||||
aSSF1.Orientation(TopAbs_INTERNAL);
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myOperation==BOP_CUT21 && iRankF1==2) {
|
|
||||||
aSSF1.Orientation(TopAbs_INTERNAL);
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (!bInternal1 && bInternal2) {
|
|
||||||
if (nSpTaken!=nSpF1) {
|
|
||||||
|
|
||||||
if ((myOperation==BOP_FUSE)||
|
|
||||||
(myOperation==BOP_CUT && iRankF1==1) ||
|
|
||||||
(myOperation==BOP_CUT21 && iRankF1==2)) {
|
|
||||||
|
|
||||||
aSSF1=TopoDS::Edge(aSpF1);
|
|
||||||
aSSF1.Orientation(anOrEF1);
|
|
||||||
|
|
||||||
aSSF2=TopoDS::Edge(aSpF2);
|
|
||||||
|
|
||||||
aSSF2.Orientation(TopAbs_FORWARD);
|
|
||||||
bToReverse=BOPTools_Tools3D::IsSplitToReverse1 (aSSF1, aSSF2, aContext);
|
|
||||||
if (bToReverse) {
|
|
||||||
aSSF2.Reverse();
|
|
||||||
}
|
|
||||||
|
|
||||||
aWES.AddStartElement (aSSF2);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aSSF1=TopoDS::Edge(aSpF1);
|
|
||||||
aSSF1.Orientation(anOrEF1);
|
|
||||||
|
|
||||||
if (nSpTaken==nSpF1) {
|
|
||||||
// Common Edge is from nEF1
|
|
||||||
if(CheckSplitToAvoid(aSSF1, aCB, nEF1, nF1, myDSFiller, myOperation, aContext)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
// Common Edge is from nEF2 nSpTaken!=nSpF2
|
|
||||||
aSSF2=TopoDS::Edge(aSpF2);
|
|
||||||
|
|
||||||
bToReverse=BOPTools_Tools3D::IsSplitToReverse1 (aSSF1, aSSF2, aContext);
|
|
||||||
if (bToReverse) {
|
|
||||||
aSSF2.Reverse();
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (BRep_Tool::IsClosed(aSSF1, myFace)) {
|
|
||||||
if (aM.Contains(aSSF2)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
aM.Add(aSSF2);
|
|
||||||
//
|
|
||||||
if (!BRep_Tool::IsClosed(aSSF2, myFace)) {
|
|
||||||
BOPTools_Tools3D::DoSplitSEAMOnFace (aSSF2, myFace);
|
|
||||||
}
|
|
||||||
|
|
||||||
aWES.AddStartElement (aSSF2);
|
|
||||||
aSSF2.Reverse();
|
|
||||||
aWES.AddStartElement (aSSF2);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if(CheckSplitToAvoid(aSSF2, aCB, nEF1, nF1, myDSFiller, myOperation, aContext)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
aWES.AddStartElement (aSSF2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: AddPartsEFSh
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellSolid::AddPartsEFSh (const Standard_Integer nF1,
|
|
||||||
const Standard_Integer iFF,
|
|
||||||
TopTools_IndexedMapOfShape& anEMap,
|
|
||||||
BOP_WireEdgeSet& aWES)
|
|
||||||
{
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
|
|
||||||
|
|
||||||
const BOPTools_PaveFiller& aPF=myDSFiller->PaveFiller();
|
|
||||||
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF;
|
|
||||||
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool();
|
|
||||||
//
|
|
||||||
Standard_Integer iRankF1, iRankF2, nF2, nSpEF2, nEF2, nFace;
|
|
||||||
TopExp_Explorer anExp2;
|
|
||||||
TopAbs_Orientation anOrEF2;
|
|
||||||
//
|
|
||||||
BOPTools_SSInterference& aFF=aFFs(iFF);
|
|
||||||
nF2=aFF.OppositeIndex(nF1);
|
|
||||||
//
|
|
||||||
const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape(nF2));
|
|
||||||
//
|
|
||||||
iRankF1=aDS.Rank(nF1);
|
|
||||||
iRankF2=aDS.Rank(nF2);
|
|
||||||
//
|
|
||||||
// EF2\F1 Processing
|
|
||||||
anExp2.Init (aF2, TopAbs_EDGE);
|
|
||||||
for (; anExp2.More(); anExp2.Next()) {
|
|
||||||
const TopoDS_Edge& aEF2= TopoDS::Edge(anExp2.Current());
|
|
||||||
anOrEF2=aEF2.Orientation();
|
|
||||||
|
|
||||||
nEF2=aDS.ShapeIndex (aEF2, iRankF2);
|
|
||||||
|
|
||||||
BOPTools_ListOfCommonBlock& aLCB=aCBPool(aDS.RefEdge(nEF2));
|
|
||||||
|
|
||||||
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
|
|
||||||
for (; anItCB.More(); anItCB.Next()) {
|
|
||||||
BOPTools_CommonBlock& aCB=anItCB.Value();
|
|
||||||
nFace=aCB.Face();
|
|
||||||
if (nFace==nF1) {
|
|
||||||
BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nEF2);
|
|
||||||
|
|
||||||
nSpEF2=aPB.Edge();
|
|
||||||
const TopoDS_Shape& aSpEF2=aDS.Shape(nSpEF2);
|
|
||||||
|
|
||||||
if (anEMap.Contains(aSpEF2)) {
|
|
||||||
continue;// next CB
|
|
||||||
}
|
|
||||||
anEMap.Add(aSpEF2);
|
|
||||||
|
|
||||||
TopoDS_Edge aSS=TopoDS::Edge(aSpEF2);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
|
||||||
// Internal edges treatment
|
|
||||||
{
|
|
||||||
if (anOrEF2==TopAbs_INTERNAL) {
|
|
||||||
aSS.Orientation(TopAbs_FORWARD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
|
||||||
//
|
|
||||||
if (myOperation== BOP_FUSE) {
|
|
||||||
aWES.AddStartElement (aSS);
|
|
||||||
aSS.Reverse();
|
|
||||||
aWES.AddStartElement (aSS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // next CB on nEF2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//xf
|
|
||||||
//=======================================================================
|
|
||||||
// function: AddINON2DPartsSh
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellSolid::AddINON2DPartsSh(const Standard_Integer nF1,
|
|
||||||
const Standard_Integer iFF,
|
|
||||||
BOP_WireEdgeSet& aWES)
|
|
||||||
{
|
|
||||||
TopTools_IndexedMapOfShape anEMap;
|
|
||||||
AddINON2DPartsSh(nF1, iFF, aWES, anEMap);
|
|
||||||
}
|
|
||||||
//xt
|
|
||||||
//=======================================================================
|
|
||||||
// function: AddINON2DPartsSh
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellSolid::AddINON2DPartsSh(const Standard_Integer nF1,
|
|
||||||
const Standard_Integer iFF,
|
|
||||||
BOP_WireEdgeSet& aWES,
|
|
||||||
TopTools_IndexedMapOfShape& anEMap) //xft
|
|
||||||
{
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
|
|
||||||
//
|
|
||||||
Standard_Integer iRankF1, nF2, iSenseFlag;
|
|
||||||
|
|
||||||
iRankF1=aDS.Rank(nF1);
|
|
||||||
|
|
||||||
BOPTools_SSInterference& aFF=aFFs(iFF);
|
|
||||||
nF2=aFF.OppositeIndex(nF1);
|
|
||||||
//
|
|
||||||
iSenseFlag=aFF.SenseFlag();
|
|
||||||
//
|
|
||||||
BOP_SDFWESFiller aWESFiller;
|
|
||||||
|
|
||||||
aWESFiller.SetDSFiller(*myDSFiller);
|
|
||||||
aWESFiller.SetFaces(nF1, nF2);
|
|
||||||
aWESFiller.SetStatesMap(aFF.StatesMap());
|
|
||||||
//
|
|
||||||
aWESFiller.SetSenseFlag(iSenseFlag);
|
|
||||||
|
|
||||||
switch (myOperation) {
|
|
||||||
|
|
||||||
case BOP_FUSE:
|
|
||||||
if (myRank==2) {
|
|
||||||
//shell\solid case when the solid is the first arg.
|
|
||||||
iRankF1=1;
|
|
||||||
}
|
|
||||||
if (iRankF1==1) {
|
|
||||||
aWESFiller.SetOperation(BOP_CUT);
|
|
||||||
aWESFiller.Do(aWES);
|
|
||||||
aWESFiller.SetOperation(BOP_COMMON);
|
|
||||||
aWESFiller.Do(aWES);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aWESFiller.SetOperation(BOP_CUT);
|
|
||||||
aWESFiller.Do(aWES);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BOP_COMMON:
|
|
||||||
if (myRank==2) {
|
|
||||||
//shell\solid case when the solid is the first arg.
|
|
||||||
iRankF1=1;
|
|
||||||
}
|
|
||||||
if (iRankF1==1) {
|
|
||||||
aWESFiller.SetOperation(BOP_COMMON);
|
|
||||||
aWESFiller.Do(aWES);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BOP_CUT:
|
|
||||||
if (iRankF1==1) {
|
|
||||||
aWESFiller.SetOperation(BOP_CUT);
|
|
||||||
aWESFiller.Do(aWES);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BOP_CUT21:
|
|
||||||
if (iRankF1==2) {
|
|
||||||
aWESFiller.SetOperation(BOP_CUT);
|
|
||||||
aWESFiller.Do(aWES);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
//xf
|
|
||||||
// Collect all split edges of nF1 that are CB with
|
|
||||||
// splis of all SD faces to nFx,
|
|
||||||
// but not included in aWES (RejectedOnParts).
|
|
||||||
// This is necessary to prevent inclusion these splits in
|
|
||||||
// AddPartsEENonSDSh(...)
|
|
||||||
// see BOP_SDFWESFiller, BOP_ShellSolid::DoNewFaces()
|
|
||||||
// for more details;
|
|
||||||
TopTools_ListIteratorOfListOfShape aIt;
|
|
||||||
//
|
|
||||||
const TopTools_ListOfShape& aLRE=aWESFiller.RejectedOnParts();
|
|
||||||
aIt.Initialize(aLRE);
|
|
||||||
for(; aIt.More(); aIt.Next()) {
|
|
||||||
const TopoDS_Shape& aE=aIt.Value();
|
|
||||||
anEMap.Add(aE);
|
|
||||||
}
|
|
||||||
//xt
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: AddPartsEFNonSDSh
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellSolid::AddPartsEFNonSDSh (const Standard_Integer nF1,
|
|
||||||
const Standard_Integer iFF,
|
|
||||||
TopTools_IndexedMapOfShape& anEMap,
|
|
||||||
BOP_WireEdgeSet& aWES)
|
|
||||||
{
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
|
|
||||||
|
|
||||||
const BOPTools_PaveFiller& aPF=myDSFiller->PaveFiller();
|
|
||||||
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF;
|
|
||||||
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool();
|
|
||||||
//
|
|
||||||
Standard_Integer nF2, nSpEF2, nEF2, nFace, iRankF2;
|
|
||||||
TopExp_Explorer anExp2;
|
|
||||||
TopAbs_Orientation anOrEF2 = TopAbs_FORWARD;
|
|
||||||
//
|
|
||||||
BOPTools_SSInterference& aFF=aFFs(iFF);
|
|
||||||
nF2=aFF.OppositeIndex(nF1);
|
|
||||||
//
|
|
||||||
const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape(nF2));
|
|
||||||
|
|
||||||
iRankF2=aDS.Rank(nF2);
|
|
||||||
//
|
|
||||||
TopTools_IndexedMapOfOrientedShape aWESMap;
|
|
||||||
{
|
|
||||||
const TopTools_ListOfShape& aWESList=aWES.StartElements();
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aWESList);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& aS=anIt.Value();
|
|
||||||
aWESMap.Add(aS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// EF2\F1 Processing
|
|
||||||
anExp2.Init (aF2, TopAbs_EDGE);
|
|
||||||
for (; anExp2.More(); anExp2.Next()) {
|
|
||||||
const TopoDS_Edge& aEF2= TopoDS::Edge(anExp2.Current());
|
|
||||||
|
|
||||||
nEF2=aDS.ShapeIndex(aEF2, iRankF2);
|
|
||||||
|
|
||||||
BOPTools_ListOfCommonBlock& aLCB=aCBPool(aDS.RefEdge(nEF2));
|
|
||||||
|
|
||||||
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
|
|
||||||
for (; anItCB.More(); anItCB.Next()) {
|
|
||||||
BOPTools_CommonBlock& aCB=anItCB.Value();
|
|
||||||
nFace=aCB.Face();
|
|
||||||
|
|
||||||
if (nFace==nF1) {
|
|
||||||
BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nEF2);
|
|
||||||
|
|
||||||
nSpEF2=aPB.Edge();
|
|
||||||
const TopoDS_Shape& aSpEF2=aDS.Shape(nSpEF2);
|
|
||||||
//
|
|
||||||
if (anEMap.Contains(aSpEF2)) {
|
|
||||||
continue;// next CB
|
|
||||||
}
|
|
||||||
anEMap.Add(aSpEF2);
|
|
||||||
//
|
|
||||||
if (aWESMap.Contains(aSpEF2)) {
|
|
||||||
continue;// next CB
|
|
||||||
}
|
|
||||||
aWESMap.Add(aSpEF2);
|
|
||||||
//
|
|
||||||
TopoDS_Edge aSS=TopoDS::Edge(aSpEF2);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
|
||||||
// Internal edges treatment
|
|
||||||
{
|
|
||||||
if (anOrEF2==TopAbs_INTERNAL) {
|
|
||||||
aSS.Orientation(TopAbs_FORWARD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
|
||||||
//
|
|
||||||
if (myOperation==BOP_FUSE) {
|
|
||||||
aWES.AddStartElement(aSS);
|
|
||||||
aSS.Reverse();
|
|
||||||
aWES.AddStartElement(aSS);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
} //if (nFace==nF1) {
|
|
||||||
} // next CB on nEF2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: AddPartsEENonSDSh
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellSolid::AddPartsEENonSDSh (const Standard_Integer nF1,
|
|
||||||
const Standard_Integer iFF,
|
|
||||||
TopTools_IndexedMapOfShape& anEMap,
|
|
||||||
BOP_WireEdgeSet& aWES)
|
|
||||||
{
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
|
|
||||||
|
|
||||||
const BOPTools_PaveFiller& aPF=myDSFiller->PaveFiller();
|
|
||||||
BOPTools_PaveFiller* pPaveFiller=(BOPTools_PaveFiller*)&aPF;
|
|
||||||
BOPTools_CommonBlockPool& aCBPool=pPaveFiller->ChangeCommonBlockPool();
|
|
||||||
//
|
|
||||||
const Handle(IntTools_Context)& aContext=pPaveFiller->Context();
|
|
||||||
//
|
|
||||||
Standard_Integer nEF1, nF2, nSpF1, nSpF2, nEF2, nSpTaken, nF2x, iRankF1;
|
|
||||||
Standard_Boolean bToReverse;
|
|
||||||
TopAbs_Orientation anOrEF1, anOrEF2;
|
|
||||||
TopExp_Explorer anExp;
|
|
||||||
TopTools_IndexedMapOfShape aM;
|
|
||||||
TColStd_ListOfInteger aSplitsOnF1;
|
|
||||||
TColStd_ListIteratorOfListOfInteger anItSp;
|
|
||||||
TColStd_IndexedMapOfInteger aMSplitsOnF1;
|
|
||||||
TopoDS_Edge aSSF1, aSSF2;
|
|
||||||
//
|
|
||||||
// nF1
|
|
||||||
iRankF1=aDS.Rank(nF1);
|
|
||||||
//
|
|
||||||
// nF2
|
|
||||||
BOPTools_SSInterference& aFF=aFFs(iFF);
|
|
||||||
nF2=aFF.OppositeIndex(nF1);
|
|
||||||
//
|
|
||||||
pPaveFiller->SplitsOnFace(0, nF1, nF2, aSplitsOnF1);
|
|
||||||
anItSp.Initialize(aSplitsOnF1);
|
|
||||||
for (; anItSp.More(); anItSp.Next()) {
|
|
||||||
nSpF1=anItSp.Value();
|
|
||||||
aMSplitsOnF1.Add(nSpF1);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
TopTools_IndexedMapOfOrientedShape aWESMap;
|
|
||||||
{
|
|
||||||
const TopTools_ListOfShape& aWESList=aWES.StartElements();
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aWESList);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& aS=anIt.Value();
|
|
||||||
aWESMap.Add(aS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
anExp.Init(myFace, TopAbs_EDGE);
|
|
||||||
for (; anExp.More(); anExp.Next()) {
|
|
||||||
const TopoDS_Edge& anEF1=TopoDS::Edge(anExp.Current());
|
|
||||||
anOrEF1=anEF1.Orientation();
|
|
||||||
nEF1=aDS.ShapeIndex(anEF1, iRankF1);
|
|
||||||
|
|
||||||
BOPTools_ListOfCommonBlock& aLCB=aCBPool(aDS.RefEdge(nEF1));
|
|
||||||
|
|
||||||
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
|
|
||||||
for (; anItCB.More(); anItCB.Next()) {
|
|
||||||
BOPTools_CommonBlock& aCB=anItCB.Value();
|
|
||||||
|
|
||||||
BOPTools_PaveBlock& aPBEF1=aCB.PaveBlock1(nEF1);
|
|
||||||
BOPTools_PaveBlock& aPBEF2=aCB.PaveBlock2(nEF1);
|
|
||||||
|
|
||||||
nF2x=aCB.Face();
|
|
||||||
if (nF2x) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// Splits that are ON other Edge from other Face
|
|
||||||
nSpF1=aPBEF1.Edge();
|
|
||||||
//
|
|
||||||
if (!aMSplitsOnF1.Contains(nSpF1)) {
|
|
||||||
continue;// next CB
|
|
||||||
}
|
|
||||||
//
|
|
||||||
nSpF2=aPBEF2.Edge();
|
|
||||||
nEF2=aPBEF2.OriginalEdge();
|
|
||||||
|
|
||||||
const TopoDS_Edge& anEF2=TopoDS::Edge(aDS.Shape(nEF2));
|
|
||||||
anOrEF2=anEF2.Orientation();
|
|
||||||
|
|
||||||
const TopoDS_Shape& aSpF1=aDS.Shape(nSpF1);
|
|
||||||
const TopoDS_Shape& aSpF2=aDS.Shape(nSpF2);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (anEMap.Contains(aSpF1)) {
|
|
||||||
continue;// next CB
|
|
||||||
}
|
|
||||||
anEMap.Add(aSpF1);
|
|
||||||
//
|
|
||||||
if (anEMap.Contains(aSpF2)) {
|
|
||||||
continue;// next CB
|
|
||||||
}
|
|
||||||
anEMap.Add(aSpF2);
|
|
||||||
//
|
|
||||||
|
|
||||||
// Pave Block from which new edge will be taken
|
|
||||||
const BOPTools_PaveBlock& aPB=aCB.PaveBlock1();
|
|
||||||
nSpTaken=aPB.Edge();
|
|
||||||
//
|
|
||||||
//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
|
||||||
// Internal edges treatment
|
|
||||||
{
|
|
||||||
Standard_Boolean bInternal1, bInternal2;
|
|
||||||
bInternal1=(anOrEF1==TopAbs_INTERNAL);
|
|
||||||
bInternal2=(anOrEF2==TopAbs_INTERNAL);
|
|
||||||
|
|
||||||
if (bInternal1) {
|
|
||||||
aSSF1=TopoDS::Edge(aDS.Shape(nSpTaken));
|
|
||||||
|
|
||||||
if (myOperation==BOP_FUSE) {
|
|
||||||
aSSF1.Orientation(TopAbs_FORWARD);
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
aSSF1.Reverse();
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myOperation==BOP_CUT && iRankF1==1) {
|
|
||||||
aSSF1.Orientation(TopAbs_INTERNAL);
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myOperation==BOP_CUT21 && iRankF1==2) {
|
|
||||||
aSSF1.Orientation(TopAbs_INTERNAL);
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (!bInternal1 && bInternal2) {
|
|
||||||
if (nSpTaken!=nSpF1) {
|
|
||||||
|
|
||||||
if ((myOperation==BOP_FUSE)||
|
|
||||||
(myOperation==BOP_CUT && iRankF1==1) ||
|
|
||||||
(myOperation==BOP_CUT21 && iRankF1==2)) {
|
|
||||||
|
|
||||||
aSSF1=TopoDS::Edge(aSpF1);
|
|
||||||
aSSF1.Orientation(anOrEF1);
|
|
||||||
|
|
||||||
aSSF2=TopoDS::Edge(aSpF2);
|
|
||||||
|
|
||||||
aSSF2.Orientation(TopAbs_FORWARD);
|
|
||||||
bToReverse=BOPTools_Tools3D::IsSplitToReverse1 (aSSF1, aSSF2, aContext);
|
|
||||||
if (bToReverse) {
|
|
||||||
aSSF2.Reverse();
|
|
||||||
}
|
|
||||||
|
|
||||||
aWES.AddStartElement (aSSF2);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
|
||||||
//
|
|
||||||
aSSF1=TopoDS::Edge(aSpF1);
|
|
||||||
aSSF1.Orientation(anOrEF1);
|
|
||||||
|
|
||||||
if (nSpTaken==nSpF1) {
|
|
||||||
// Common Edge is from nEF1
|
|
||||||
aWES.AddStartElement (aSSF1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Common Edge is from nEF2 nSpTaken!=nSpF2
|
|
||||||
aSSF2=TopoDS::Edge(aSpF2);
|
|
||||||
|
|
||||||
bToReverse=BOPTools_Tools3D::IsSplitToReverse1 (aSSF1, aSSF2, aContext);
|
|
||||||
if (bToReverse) {
|
|
||||||
aSSF2.Reverse();
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (BRep_Tool::IsClosed(aSSF1, myFace)) {
|
|
||||||
if (aM.Contains(aSSF2)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
aM.Add(aSSF2);
|
|
||||||
//
|
|
||||||
if (!BRep_Tool::IsClosed(aSSF2, myFace)) {
|
|
||||||
BOPTools_Tools3D::DoSplitSEAMOnFace (aSSF2, myFace);
|
|
||||||
}
|
|
||||||
aWES.AddStartElement (aSSF2);
|
|
||||||
aSSF2.Reverse();
|
|
||||||
aWES.AddStartElement (aSSF2);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aWES.AddStartElement (aSSF2);
|
|
||||||
}// else /*if (nSpTaken==nSpF2)*/ {
|
|
||||||
}// for (; anItCB.More(); anItCB.Next())
|
|
||||||
}// for (; anExp.More(); anExp.Next())
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : CheckSplitToAvoid
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean CheckSplitToAvoid(const TopoDS_Edge& theSplit,
|
|
||||||
const BOPTools_CommonBlock& theCB,
|
|
||||||
const Standard_Integer theEdgeIndex,
|
|
||||||
const Standard_Integer theFaceIndex,
|
|
||||||
const BOPTools_PDSFiller& theDSFiller,
|
|
||||||
const BOP_Operation& theOperation,
|
|
||||||
const Handle(IntTools_Context)& theContext) {
|
|
||||||
|
|
||||||
Standard_Integer anE = -1;
|
|
||||||
|
|
||||||
if(theCB.PaveBlock1().OriginalEdge() == theEdgeIndex) {
|
|
||||||
anE = theCB.PaveBlock2().OriginalEdge();
|
|
||||||
}
|
|
||||||
else if(theCB.PaveBlock2().OriginalEdge() == theEdgeIndex) {
|
|
||||||
anE = theCB.PaveBlock1().OriginalEdge();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(anE >= 0) {
|
|
||||||
const TopoDS_Shape& anEdge = theDSFiller->DS().Shape(anE);
|
|
||||||
TopoDS_Face aFaceCur = TopoDS::Face(theDSFiller->DS().Shape(theFaceIndex));
|
|
||||||
aFaceCur.Orientation(TopAbs_FORWARD);
|
|
||||||
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aMapEF;
|
|
||||||
Standard_Integer aRank = theDSFiller->DS().Rank(anE);
|
|
||||||
TopoDS_Shape aSource = (aRank == 1) ? theDSFiller->Shape1() : theDSFiller->Shape2();
|
|
||||||
TopExp::MapShapesAndAncestors(aSource, TopAbs_EDGE, TopAbs_FACE, aMapEF);
|
|
||||||
|
|
||||||
if(aMapEF.Contains(anEdge)) {
|
|
||||||
const TopTools_ListOfShape& aLF = aMapEF.FindFromKey(anEdge);
|
|
||||||
|
|
||||||
if(!aLF.IsEmpty()) {
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aLF);
|
|
||||||
Standard_Boolean avoid = Standard_True;
|
|
||||||
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Face& aFace = TopoDS::Face(anIt.Value());
|
|
||||||
Standard_Real f = 0., l = 0.;
|
|
||||||
Handle(Geom2d_Curve) aCurve = BRep_Tool::CurveOnSurface(theSplit, aFaceCur, f, l);
|
|
||||||
|
|
||||||
if(!aCurve.IsNull()) {
|
|
||||||
Standard_Real amidpar = (f + l) * 0.5;
|
|
||||||
|
|
||||||
if(theOperation == BOP_COMMON) {
|
|
||||||
gp_Pnt2d aPoint2d;
|
|
||||||
gp_Pnt aPoint3d;
|
|
||||||
Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //???
|
|
||||||
BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d);
|
|
||||||
GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace);
|
|
||||||
aProjector.Perform(aPoint3d);
|
|
||||||
|
|
||||||
if(aProjector.IsDone()) {
|
|
||||||
Standard_Real U = 0., V = 0.;
|
|
||||||
Standard_Real adist = aProjector.LowerDistance();
|
|
||||||
|
|
||||||
if(adist < BRep_Tool::Tolerance(aFace)) {
|
|
||||||
aProjector.LowerDistanceParameters(U, V);
|
|
||||||
|
|
||||||
if(theContext->IsPointInFace(aFace, gp_Pnt2d(U, V))) {
|
|
||||||
avoid = Standard_False;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(theOperation == BOP_CUT) {
|
|
||||||
if(theDSFiller->DS().Rank(theFaceIndex) != 2) {
|
|
||||||
avoid = Standard_False;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
gp_Pnt2d aPoint2d;
|
|
||||||
gp_Pnt aPoint3d;
|
|
||||||
Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //???
|
|
||||||
BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d);
|
|
||||||
GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace);
|
|
||||||
aProjector.Perform(aPoint3d);
|
|
||||||
|
|
||||||
if(aProjector.IsDone()) {
|
|
||||||
Standard_Real U = 0., V = 0.;
|
|
||||||
Standard_Real adist = aProjector.LowerDistance();
|
|
||||||
|
|
||||||
if(adist < BRep_Tool::Tolerance(aFace)) {
|
|
||||||
aProjector.LowerDistanceParameters(U, V);
|
|
||||||
|
|
||||||
if(theContext->IsPointInFace(aFace, gp_Pnt2d(U, V))) {
|
|
||||||
avoid = Standard_False;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(theOperation == BOP_CUT21) {
|
|
||||||
if(theDSFiller->DS().Rank(theFaceIndex) != 1) {
|
|
||||||
avoid = Standard_False;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
gp_Pnt2d aPoint2d;
|
|
||||||
gp_Pnt aPoint3d;
|
|
||||||
Standard_Real aTolerance = BRep_Tool::Tolerance(theSplit); //???
|
|
||||||
BOPTools_Tools3D::PointNearEdge(theSplit, aFaceCur, amidpar, aTolerance, aPoint2d, aPoint3d);
|
|
||||||
GeomAPI_ProjectPointOnSurf& aProjector = theContext->ProjPS(aFace);
|
|
||||||
aProjector.Perform(aPoint3d);
|
|
||||||
|
|
||||||
if(aProjector.IsDone()) {
|
|
||||||
Standard_Real U = 0., V = 0.;
|
|
||||||
Standard_Real adist = aProjector.LowerDistance();
|
|
||||||
|
|
||||||
if(adist < BRep_Tool::Tolerance(aFace)) {
|
|
||||||
aProjector.LowerDistanceParameters(U, V);
|
|
||||||
|
|
||||||
if(theContext->IsPointInFace(aFace, gp_Pnt2d(U, V))) {
|
|
||||||
avoid = Standard_False;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// end if(theOperation == BOP_CUT21...
|
|
||||||
else {
|
|
||||||
avoid = Standard_False;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(avoid) {
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// end if(!aLF.IsEmpty...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,551 +0,0 @@
|
|||||||
// Created on: 2004-06-09
|
|
||||||
// Created by: Mikhail KLOKOV
|
|
||||||
// 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 <BOP_ShellSolid.ixx>
|
|
||||||
|
|
||||||
#include <TopAbs_Orientation.hxx>
|
|
||||||
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
#include <TopoDS_Vertex.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
#include <TopoDS_Face.hxx>
|
|
||||||
#include <TopoDS_Compound.hxx>
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
|
|
||||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
|
||||||
#include <TopTools_MapOfShape.hxx>
|
|
||||||
#include <TopTools_ListOfShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
|
|
||||||
#include <Geom_Surface.hxx>
|
|
||||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
|
||||||
|
|
||||||
#include <BRepClass3d_SolidClassifier.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Builder.hxx>
|
|
||||||
#include <BRepTools.hxx>
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_InterferencePool.hxx>
|
|
||||||
#include <BOPTools_CArray1OfSSInterference.hxx>
|
|
||||||
#include <BOPTools_SSInterference.hxx>
|
|
||||||
#include <BOPTools_SequenceOfCurves.hxx>
|
|
||||||
#include <BOPTools_Curve.hxx>
|
|
||||||
#include <BOPTools_ListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_PaveBlock.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_Tools3D.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_PaveFiller.hxx>
|
|
||||||
#include <BOPTools_CommonBlockPool.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_ListOfCommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
|
|
||||||
#include <BOPTools_CommonBlock.hxx>
|
|
||||||
|
|
||||||
#include <BOP_BuilderTools.hxx>
|
|
||||||
|
|
||||||
#include <BOP_FaceBuilder.hxx>
|
|
||||||
#include <BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger.hxx>
|
|
||||||
|
|
||||||
// =====================================================================================================================
|
|
||||||
// function: SplitFace
|
|
||||||
// purpose:
|
|
||||||
// =====================================================================================================================
|
|
||||||
Standard_Boolean BOP_ShellSolid::SplitFace(const Standard_Integer theFaceIndex,
|
|
||||||
TopTools_DataMapOfShapeInteger& theMapOfEdgeIndex,
|
|
||||||
TopTools_ListOfShape& theListOfFace) const
|
|
||||||
{
|
|
||||||
theListOfFace.Clear();
|
|
||||||
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS = myDSFiller->DS();
|
|
||||||
const BOPTools_PaveFiller& aPaveFiller = myDSFiller->PaveFiller();
|
|
||||||
BOPTools_PaveFiller* pPaveFiller = (BOPTools_PaveFiller*)&aPaveFiller;
|
|
||||||
BOPTools_CommonBlockPool& aCBPool = pPaveFiller->ChangeCommonBlockPool();
|
|
||||||
const BOPTools_SplitShapesPool& aSplitShapesPool = aPaveFiller.SplitShapesPool();
|
|
||||||
|
|
||||||
BOPTools_InterferencePool* pIntrPool=
|
|
||||||
(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
|
|
||||||
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs = pIntrPool->SSInterferences();
|
|
||||||
|
|
||||||
TopoDS_Face aFace = TopoDS::Face(aDS.Shape(theFaceIndex));
|
|
||||||
aFace.Orientation(TopAbs_FORWARD);
|
|
||||||
|
|
||||||
BOP_WireEdgeSet aWES (aFace);
|
|
||||||
|
|
||||||
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
|
|
||||||
for(i = 1; i <= aFFs.Length(); i++) {
|
|
||||||
BOPTools_SSInterference& aFF = aFFs(i);
|
|
||||||
|
|
||||||
if((aFF.Index1() != theFaceIndex) && (aFF.Index2() != theFaceIndex))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
BOPTools_SequenceOfCurves& aSC = aFF.Curves();
|
|
||||||
Standard_Integer aNbCurves = aSC.Length();
|
|
||||||
Standard_Integer j = 0;
|
|
||||||
|
|
||||||
for(j = 1; j <= aNbCurves; j++) {
|
|
||||||
const BOPTools_Curve& aBC = aSC(j);
|
|
||||||
const BOPTools_ListOfPaveBlock& aLPB = aBC.NewPaveBlocks();
|
|
||||||
BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
|
|
||||||
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const BOPTools_PaveBlock& aPB = anIt.Value();
|
|
||||||
Standard_Integer nE = aPB.Edge();
|
|
||||||
const TopoDS_Shape& aE = aDS.Shape(nE);
|
|
||||||
TopoDS_Edge aES = TopoDS::Edge(aE);
|
|
||||||
aWES.AddStartElement(aES);
|
|
||||||
aES.Reverse();
|
|
||||||
aWES.AddStartElement(aES);
|
|
||||||
|
|
||||||
if(!theMapOfEdgeIndex.IsBound(aES)) {
|
|
||||||
theMapOfEdgeIndex.Bind(aES, nE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer aFaceRank = aDS.Rank(theFaceIndex);
|
|
||||||
TopExp_Explorer anExpE(aFace, TopAbs_EDGE);
|
|
||||||
|
|
||||||
for(; anExpE.More(); anExpE.Next()) {
|
|
||||||
const TopoDS_Shape& anOldEdge = anExpE.Current();
|
|
||||||
TopAbs_Orientation anOr = anOldEdge.Orientation();
|
|
||||||
Standard_Integer anEdgeIndex = aDS.ShapeIndex(anOldEdge, aFaceRank);
|
|
||||||
|
|
||||||
if(anEdgeIndex <= 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const BOPTools_ListOfPaveBlock& aLPB = aSplitShapesPool(aDS.RefEdge(anEdgeIndex));
|
|
||||||
|
|
||||||
if(aLPB.IsEmpty()) {
|
|
||||||
TopoDS_Edge aSS = TopoDS::Edge(anOldEdge);
|
|
||||||
//
|
|
||||||
aWES.AddStartElement (aSS);
|
|
||||||
|
|
||||||
if(!theMapOfEdgeIndex.IsBound(aSS)) {
|
|
||||||
theMapOfEdgeIndex.Bind(aSS, anEdgeIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aLPB);
|
|
||||||
|
|
||||||
for (; aPBIt.More(); aPBIt.Next()) {
|
|
||||||
const BOPTools_PaveBlock& aPB = aPBIt.Value();
|
|
||||||
Standard_Integer nSp = aPB.Edge();
|
|
||||||
Standard_Integer nSpToAdd = nSp;
|
|
||||||
|
|
||||||
BooleanOperations_StateOfShape aState = aDS.GetState(nSp);
|
|
||||||
Standard_Boolean bAddToWes = ((aState == BooleanOperations_IN) ||
|
|
||||||
(aState == BooleanOperations_OUT));
|
|
||||||
|
|
||||||
if(aState == BooleanOperations_ON) {
|
|
||||||
bAddToWes = Standard_True;
|
|
||||||
|
|
||||||
BOPTools_ListOfCommonBlock& aLCB = aCBPool(aDS.RefEdge(anEdgeIndex));
|
|
||||||
|
|
||||||
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
|
|
||||||
|
|
||||||
for (; anItCB.More(); anItCB.Next()) {
|
|
||||||
BOPTools_CommonBlock& aCB = anItCB.Value();
|
|
||||||
Standard_Integer iCBFace = aCB.Face();
|
|
||||||
|
|
||||||
if(iCBFace == 0) {
|
|
||||||
BOPTools_PaveBlock& aPBEF1 = aCB.PaveBlock1(anEdgeIndex);
|
|
||||||
BOPTools_PaveBlock& aPBEF2 = aCB.PaveBlock2(anEdgeIndex);
|
|
||||||
|
|
||||||
const BOPTools_PaveBlock& aPB1 = aCB.PaveBlock1();
|
|
||||||
Standard_Integer nSpTaken = aPB1.Edge();
|
|
||||||
|
|
||||||
if((nSp == aPBEF1.Edge()) || (nSp == aPBEF2.Edge())) {
|
|
||||||
nSpToAdd = nSpTaken;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bAddToWes) {
|
|
||||||
const TopoDS_Shape& aSplit = aDS.Shape(nSpToAdd);
|
|
||||||
TopoDS_Edge aSS=TopoDS::Edge(aSplit);
|
|
||||||
aSS.Orientation(anOr);
|
|
||||||
|
|
||||||
if(nSpToAdd != nSp) {
|
|
||||||
const TopoDS_Shape& aSp1=aDS.Shape(nSp);
|
|
||||||
TopoDS_Edge aSpF1=TopoDS::Edge(aSp1);
|
|
||||||
aSpF1.Orientation(anOr);
|
|
||||||
|
|
||||||
const TopoDS_Shape& aSp2 = aDS.Shape(nSpToAdd);
|
|
||||||
TopoDS_Edge aSpF2 = TopoDS::Edge(aSp2);
|
|
||||||
|
|
||||||
Standard_Boolean bToReverse=
|
|
||||||
BOPTools_Tools3D::IsSplitToReverse1 (aSpF1, aSpF2, pPaveFiller->Context());
|
|
||||||
|
|
||||||
if (bToReverse) {
|
|
||||||
aSpF2.Reverse();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BRep_Tool::IsClosed(TopoDS::Edge(anOldEdge), aFace) &&
|
|
||||||
!BRep_Tool::IsClosed(aSpF2, aFace)) {
|
|
||||||
Standard_Boolean bIsReversed = Standard_False;
|
|
||||||
|
|
||||||
if(!BOPTools_Tools3D::DoSplitSEAMOnFace(aSpF2, aSpF1, aFace, bIsReversed))
|
|
||||||
BOPTools_Tools3D::DoSplitSEAMOnFace (aSpF2, aFace);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
aSS = aSpF2;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aWES.AddStartElement (aSS);
|
|
||||||
|
|
||||||
if(!theMapOfEdgeIndex.IsBound(aSS)) {
|
|
||||||
theMapOfEdgeIndex.Bind(aSS, nSpToAdd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aFFMap;
|
|
||||||
BOP_BuilderTools::DoMap(aFFs, aFFMap);
|
|
||||||
|
|
||||||
Standard_Integer aNb = aFFMap.Extent();
|
|
||||||
|
|
||||||
for (i = 1; i <= aNb; i++) {
|
|
||||||
Standard_Integer nF1 = aFFMap.FindKey(i);
|
|
||||||
|
|
||||||
if(nF1 != theFaceIndex)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const TColStd_IndexedMapOfInteger& aFFIndicesMap=aFFMap.FindFromIndex(i);
|
|
||||||
Standard_Integer aNbj = aFFIndicesMap.Extent();
|
|
||||||
Standard_Integer j = 0;
|
|
||||||
|
|
||||||
for (j = 1; j <= aNbj; j++) {
|
|
||||||
Standard_Integer iFF = aFFIndicesMap(j);
|
|
||||||
BOPTools_SSInterference& aFF = aFFs(iFF);
|
|
||||||
//
|
|
||||||
Standard_Integer nF2 = aFF.OppositeIndex(nF1);
|
|
||||||
|
|
||||||
if(nF2 <= 0)
|
|
||||||
continue;
|
|
||||||
//
|
|
||||||
Standard_Integer iRankF2 = aDS.Rank(nF2);
|
|
||||||
TopoDS_Shape aFace2 = aDS.Shape(nF2);
|
|
||||||
|
|
||||||
anExpE.Init(aFace2, TopAbs_EDGE);
|
|
||||||
|
|
||||||
for(; anExpE.More(); anExpE.Next()) {
|
|
||||||
Standard_Integer anEdgeIndex2 = aDS.ShapeIndex(anExpE.Current(), iRankF2);
|
|
||||||
|
|
||||||
if(anEdgeIndex2 <= 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
BOPTools_ListOfCommonBlock& aLCB = aCBPool(aDS.RefEdge(anEdgeIndex2));
|
|
||||||
|
|
||||||
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
|
|
||||||
|
|
||||||
for (; anItCB.More(); anItCB.Next()) {
|
|
||||||
BOPTools_CommonBlock& aCB = anItCB.Value();
|
|
||||||
Standard_Integer iCBFace = aCB.Face();
|
|
||||||
|
|
||||||
if(iCBFace == theFaceIndex) {
|
|
||||||
BOPTools_PaveBlock& aPB = aCB.PaveBlock1(anEdgeIndex2);
|
|
||||||
Standard_Integer nSpEF2 = aPB.Edge();
|
|
||||||
const TopoDS_Shape& aSpEF2 = aDS.Shape(nSpEF2);
|
|
||||||
|
|
||||||
TopoDS_Edge aEF = TopoDS::Edge(aSpEF2);
|
|
||||||
|
|
||||||
if(!theMapOfEdgeIndex.IsBound(aEF)) {
|
|
||||||
theMapOfEdgeIndex.Bind(aEF, nSpEF2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(aEF.Orientation() == TopAbs_INTERNAL) {
|
|
||||||
aWES.AddStartElement(aEF);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aEF.Orientation(TopAbs_FORWARD);
|
|
||||||
aWES.AddStartElement(aEF);
|
|
||||||
aEF.Reverse();
|
|
||||||
aWES.AddStartElement(aEF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// process internal edges
|
|
||||||
BOP_WireEdgeSet aFilteredWES (aFace);
|
|
||||||
TopoDS_Compound aComp;
|
|
||||||
BRep_Builder aBB;
|
|
||||||
aBB.MakeCompound(aComp);
|
|
||||||
|
|
||||||
for(aWES.InitStartElements(); aWES.MoreStartElements(); aWES.NextStartElement()) {
|
|
||||||
aBB.Add(aComp, aWES.StartElement());
|
|
||||||
}
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
|
|
||||||
TopExp::MapShapesAndAncestors(aComp, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
|
|
||||||
|
|
||||||
for(aWES.InitStartElements(); aWES.MoreStartElements(); aWES.NextStartElement()) {
|
|
||||||
const TopoDS_Shape& anEdge = aWES.StartElement();
|
|
||||||
|
|
||||||
if(anEdge.Orientation() != TopAbs_INTERNAL) {
|
|
||||||
aFilteredWES.AddStartElement(anEdge);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopoDS_Vertex aV1, aV2, aV;
|
|
||||||
|
|
||||||
Standard_Boolean bFound1 = Standard_False;
|
|
||||||
Standard_Boolean bFound2 = Standard_False;
|
|
||||||
Standard_Boolean bIsClosed = Standard_False;
|
|
||||||
Standard_Integer vcounter = 0;
|
|
||||||
TopTools_IndexedMapOfShape aMapOfEInternal;
|
|
||||||
aMapOfEInternal.Add(anEdge);
|
|
||||||
|
|
||||||
TopExp::Vertices(TopoDS::Edge(anEdge), aV1, aV2);
|
|
||||||
|
|
||||||
if(!aV1.IsNull() && aV1.IsSame(aV2)) {
|
|
||||||
bIsClosed = Standard_True;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopExp_Explorer anExpV(anEdge, TopAbs_VERTEX);
|
|
||||||
|
|
||||||
for(; anExpV.More(); anExpV.Next(), vcounter++) {
|
|
||||||
aV = TopoDS::Vertex(anExpV.Current());
|
|
||||||
TopTools_MapOfShape aMapOfV;
|
|
||||||
|
|
||||||
while(!aV.IsNull()) {
|
|
||||||
if(!aMapVE.Contains(aV))
|
|
||||||
aV.Nullify();
|
|
||||||
|
|
||||||
if(aMapOfV.Contains(aV))
|
|
||||||
break;
|
|
||||||
aMapOfV.Add(aV);
|
|
||||||
const TopTools_ListOfShape& aListOfE = aMapVE.FindFromKey(aV);
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aListOfE);
|
|
||||||
Standard_Boolean bFound = Standard_False;
|
|
||||||
aV.Nullify();
|
|
||||||
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& anAdjE = anIt.Value();
|
|
||||||
|
|
||||||
if(anEdge.IsSame(anAdjE))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(anAdjE.Orientation() != TopAbs_INTERNAL) {
|
|
||||||
if(vcounter == 0)
|
|
||||||
bFound1 = Standard_True;
|
|
||||||
else
|
|
||||||
bFound2 = Standard_True;
|
|
||||||
bFound = Standard_True;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aMapOfEInternal.Add(anAdjE);
|
|
||||||
}
|
|
||||||
} // end for
|
|
||||||
|
|
||||||
if(!bFound) {
|
|
||||||
anIt.Initialize(aListOfE);
|
|
||||||
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& anAdjE = anIt.Value();
|
|
||||||
|
|
||||||
if(anEdge.IsSame(anAdjE))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(anAdjE.Orientation() == TopAbs_INTERNAL) {
|
|
||||||
//
|
|
||||||
aMapOfEInternal.Add(anAdjE);
|
|
||||||
//
|
|
||||||
|
|
||||||
TopExp_Explorer anExpV2(anAdjE, TopAbs_VERTEX);
|
|
||||||
|
|
||||||
for(; anExpV2.More(); anExpV2.Next()) {
|
|
||||||
if(aMapOfV.Contains(anExpV2.Current()))
|
|
||||||
continue;
|
|
||||||
aV = TopoDS::Vertex(anExpV2.Current());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// end if
|
|
||||||
}
|
|
||||||
// end while
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bIsClosed ||
|
|
||||||
((vcounter > 1) && bFound1 && bFound2) ||
|
|
||||||
((vcounter == 1) && bFound1)) {
|
|
||||||
TopoDS_Shape anOrientedEdge = anEdge;
|
|
||||||
anOrientedEdge.Orientation(TopAbs_FORWARD);
|
|
||||||
|
|
||||||
aFilteredWES.AddStartElement(anOrientedEdge);
|
|
||||||
anOrientedEdge.Reverse();
|
|
||||||
aFilteredWES.AddStartElement(anOrientedEdge);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Standard_Integer aMapIt = 1, nbv = 0, nbe = 0;
|
|
||||||
TopTools_IndexedMapOfShape aMapOfFoundV;
|
|
||||||
|
|
||||||
for(aMapIt = 1; aMapIt <= aMapOfEInternal.Extent(); aMapIt++) {
|
|
||||||
const TopoDS_Shape& aShape = aMapOfEInternal(aMapIt);
|
|
||||||
TopExp::MapShapes(aShape, TopAbs_VERTEX, aMapOfFoundV);
|
|
||||||
}
|
|
||||||
nbe = aMapOfEInternal.Extent();
|
|
||||||
nbv = aMapOfFoundV.Extent();
|
|
||||||
|
|
||||||
if((nbe != 0) && (nbe == nbv)) {
|
|
||||||
TopoDS_Shape anOrientedEdge = anEdge;
|
|
||||||
anOrientedEdge.Orientation(TopAbs_FORWARD);
|
|
||||||
|
|
||||||
aFilteredWES.AddStartElement(anOrientedEdge);
|
|
||||||
anOrientedEdge.Reverse();
|
|
||||||
aFilteredWES.AddStartElement(anOrientedEdge);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aFilteredWES.AddStartElement(anEdge);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BOP_FaceBuilder aFB;
|
|
||||||
aFB.Do(aFilteredWES);
|
|
||||||
const TopTools_ListOfShape& aLF = aFB.NewFaces();
|
|
||||||
|
|
||||||
theListOfFace = aLF;
|
|
||||||
|
|
||||||
Standard_Integer nbstartedges = aFilteredWES.StartElements().Extent();
|
|
||||||
Standard_Integer nbedgeused = 0;
|
|
||||||
TopTools_ListIteratorOfListOfShape anItNewF(aLF);
|
|
||||||
|
|
||||||
// was:
|
|
||||||
// -----------------------------------------------------------
|
|
||||||
// for(; anItNewF.More(); anItNewF.Next()) {
|
|
||||||
// TopExp_Explorer anExp(anItNewF.Value(), TopAbs_EDGE);
|
|
||||||
// for(; anExp.More(); anExp.Next(), nbedgeused++);
|
|
||||||
// }
|
|
||||||
// if(nbedgeused != nbstartedges) {
|
|
||||||
// return Standard_False;
|
|
||||||
// }
|
|
||||||
// -----------------------------------------------------------
|
|
||||||
//
|
|
||||||
// modified 6841:
|
|
||||||
//
|
|
||||||
if(aLF.Extent() != 2) {
|
|
||||||
for(; anItNewF.More(); anItNewF.Next()) {
|
|
||||||
TopExp_Explorer anExp(anItNewF.Value(), TopAbs_EDGE);
|
|
||||||
for(; anExp.More(); anExp.Next(), nbedgeused++);
|
|
||||||
}
|
|
||||||
if(nbedgeused != nbstartedges) {
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { // two faces analysis
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape amFLIE;
|
|
||||||
TopTools_ListOfShape aLIntAll;
|
|
||||||
for(; anItNewF.More(); anItNewF.Next()) {
|
|
||||||
const TopoDS_Face & anF = TopoDS::Face(anItNewF.Value());
|
|
||||||
TopExp_Explorer anExp(anItNewF.Value(), TopAbs_EDGE);
|
|
||||||
TopTools_ListOfShape aLInt;
|
|
||||||
for(; anExp.More(); anExp.Next(), nbedgeused++) {
|
|
||||||
const TopoDS_Edge & anE = TopoDS::Edge(anExp.Current());
|
|
||||||
if(anE.Orientation() == TopAbs_INTERNAL) {
|
|
||||||
aLIntAll.Append(anE);
|
|
||||||
aLInt.Append(anE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
amFLIE.Add(anF,aLInt);
|
|
||||||
}
|
|
||||||
if(nbedgeused != nbstartedges) {
|
|
||||||
if(!aLIntAll.IsEmpty()) {
|
|
||||||
Standard_Integer nbUsed = nbedgeused;
|
|
||||||
TopTools_ListIteratorOfListOfShape anItInt(aLIntAll);
|
|
||||||
for(; anItInt.More(); anItInt.Next()) {
|
|
||||||
const TopoDS_Edge & aEInt = TopoDS::Edge(anItInt.Value());
|
|
||||||
Standard_Integer nbFRE = 0;
|
|
||||||
TopTools_ListIteratorOfListOfShape anItWes(aFilteredWES.StartElements());
|
|
||||||
for(; anItWes.More(); anItWes.Next()) {
|
|
||||||
const TopoDS_Edge & aEWes = TopoDS::Edge(anItWes.Value());
|
|
||||||
if(aEWes.Orientation() != TopAbs_INTERNAL) {
|
|
||||||
if(aEInt.IsSame(aEWes))
|
|
||||||
nbFRE++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(nbFRE > 1)
|
|
||||||
nbUsed += (nbFRE - 1);
|
|
||||||
}
|
|
||||||
if(nbUsed == nbstartedges && Abs(nbstartedges-nbedgeused) == 1) {
|
|
||||||
Standard_Integer iF = 0, nbFI = 0;
|
|
||||||
for(iF = 1; iF <= amFLIE.Extent(); iF++) {
|
|
||||||
const TopTools_ListOfShape& aLOfIE = amFLIE.FindFromIndex(iF);
|
|
||||||
if(!aLOfIE.IsEmpty()) nbFI++;
|
|
||||||
}
|
|
||||||
if(nbFI == 1) {
|
|
||||||
anItNewF.Initialize(aLF);
|
|
||||||
Standard_Boolean checkOk = Standard_False;
|
|
||||||
for(; anItNewF.More(); anItNewF.Next()) {
|
|
||||||
const TopoDS_Face & anF = TopoDS::Face(anItNewF.Value());
|
|
||||||
const TopTools_ListOfShape& aLOfIE = amFLIE.FindFromKey(anF);
|
|
||||||
if(!aLOfIE.IsEmpty() && aLOfIE.Extent() == 1) {
|
|
||||||
const TopoDS_Edge & anIntE = TopoDS::Edge(aLOfIE.First());
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
|
|
||||||
TopExp::MapShapesAndAncestors(anF,TopAbs_VERTEX,TopAbs_EDGE,aMapVE);
|
|
||||||
TopoDS_Vertex v1,v2;
|
|
||||||
TopExp::Vertices(anIntE,v1,v2);
|
|
||||||
Standard_Boolean hasSingle = Standard_False;
|
|
||||||
if(!v1.IsNull() && !v2.IsNull()) {
|
|
||||||
const TopTools_ListOfShape& aL1E = aMapVE.FindFromKey(v1);
|
|
||||||
const TopTools_ListOfShape& aL2E = aMapVE.FindFromKey(v2);
|
|
||||||
if((aL1E.Extent() == 1 && aL2E.Extent() != 1) ||
|
|
||||||
(aL2E.Extent() == 1 && aL1E.Extent() != 1))
|
|
||||||
hasSingle = Standard_True;
|
|
||||||
}
|
|
||||||
if(hasSingle) {
|
|
||||||
checkOk = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(checkOk) {
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // all edges are really used
|
|
||||||
} // has internals
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
} // two faces analysis
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
@ -1,111 +0,0 @@
|
|||||||
-- Created on: 2001-04-09
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 ShellSplitter from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- the algorithm to split (multiconnexed)
|
|
||||||
--- shells on a solid onto biconnexed shells
|
|
||||||
--- when each edge is shared by only two or one
|
|
||||||
-- faces
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
Shell from TopoDS,
|
|
||||||
ListOfShape from TopTools,
|
|
||||||
|
|
||||||
ListOfListOfShape from BOPTColStd,
|
|
||||||
|
|
||||||
EdgeInfo from BOP,
|
|
||||||
IndexedDataMapOfEdgeListFaceInfo from BOP
|
|
||||||
|
|
||||||
--raises
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns ShellSplitter from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
DoWithListOfEdges(me:out;
|
|
||||||
aLE:ListOfShape from TopTools);
|
|
||||||
---Purpose:
|
|
||||||
--- Perform the algorithm using the list of shapes <aLE> as data
|
|
||||||
---
|
|
||||||
SetShell (me:out;
|
|
||||||
aShell:Shell from TopoDS);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
Shell (me)
|
|
||||||
returns Shell from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
DoWithShell (me:out);
|
|
||||||
---Purpose:
|
|
||||||
--- Perform the algorithm using the shell as data
|
|
||||||
---
|
|
||||||
Do (me:out)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Perform the algorithm
|
|
||||||
---
|
|
||||||
IsNothingToDo (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Returns TRUE if the source shell is valid and
|
|
||||||
--- there is nothing to correct
|
|
||||||
---
|
|
||||||
IsDone (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Returns TRUE if the algorithm was performed
|
|
||||||
--- successfuly
|
|
||||||
---
|
|
||||||
Shapes (me)
|
|
||||||
returns ListOfListOfShape from BOPTColStd;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
fields
|
|
||||||
myShell : Shell from TopoDS;
|
|
||||||
myIsDone : Boolean from Standard;
|
|
||||||
myNothingToDo: Boolean from Standard;
|
|
||||||
myShapes : ListOfListOfShape from BOPTColStd;
|
|
||||||
mySmartMap : IndexedDataMapOfEdgeListFaceInfo from BOP;
|
|
||||||
myFaces : ListOfShape from TopTools;
|
|
||||||
|
|
||||||
end ShellSplitter;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,914 +0,0 @@
|
|||||||
// Created on: 2001-04-09
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2001-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 <BOP_ShellSplitter.ixx>
|
|
||||||
|
|
||||||
#include <TColStd_SequenceOfInteger.hxx>
|
|
||||||
|
|
||||||
#include <Geom_Surface.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
#include <TopoDS_Face.hxx>
|
|
||||||
#include <TopoDS_Shell.hxx>
|
|
||||||
#include <TopoDS_Vertex.hxx>
|
|
||||||
#include <TopoDS_Wire.hxx>
|
|
||||||
#include <TopoDS_Iterator.hxx>
|
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
#include <TopoDS_Compound.hxx>
|
|
||||||
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
#include <TopLoc_Location.hxx>
|
|
||||||
|
|
||||||
#include <TopTools_ListOfShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
|
|
||||||
#include <TopTools_SequenceOfShape.hxx>
|
|
||||||
#include <TopTools_MapOfShape.hxx>
|
|
||||||
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
|
||||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
|
||||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
#include <BRep_Builder.hxx>
|
|
||||||
|
|
||||||
static
|
|
||||||
void RemoveInternals(const TopoDS_Face& ,
|
|
||||||
TopoDS_Face& );
|
|
||||||
|
|
||||||
static
|
|
||||||
Standard_Boolean GetShells(TopTools_SequenceOfShape& ,
|
|
||||||
const TopTools_MapOfShape& ,
|
|
||||||
TopTools_SequenceOfShape& ,
|
|
||||||
TopTools_DataMapOfShapeShape& ,
|
|
||||||
TopTools_SequenceOfShape& ) ;
|
|
||||||
|
|
||||||
static
|
|
||||||
Standard_Boolean AddMultiConexityFaces(TopTools_SequenceOfShape& ,
|
|
||||||
const TopTools_MapOfShape& ,
|
|
||||||
TopTools_SequenceOfShape& ,
|
|
||||||
const TopTools_DataMapOfShapeShape& ,
|
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape& ,
|
|
||||||
TopTools_SequenceOfShape& );
|
|
||||||
|
|
||||||
static
|
|
||||||
Standard_Boolean SplitShell(const TopoDS_Shell& ,
|
|
||||||
TopoDS_Shape& );
|
|
||||||
static
|
|
||||||
void CreateClosedShell(TopTools_SequenceOfShape& ,
|
|
||||||
const TopTools_MapOfShape& ,
|
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape& );
|
|
||||||
//
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_ShellSplitter::BOP_ShellSplitter
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_ShellSplitter::BOP_ShellSplitter()
|
|
||||||
:
|
|
||||||
myIsDone(Standard_False),
|
|
||||||
myNothingToDo(Standard_False)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: IsNothingToDo
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_ShellSplitter::IsNothingToDo()const
|
|
||||||
{
|
|
||||||
return myNothingToDo;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: IsDone
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_ShellSplitter::IsDone()const
|
|
||||||
{
|
|
||||||
return myIsDone;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: Shapes
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
const BOPTColStd_ListOfListOfShape& BOP_ShellSplitter::Shapes()const
|
|
||||||
{
|
|
||||||
return myShapes;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetShell
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellSplitter::SetShell(const TopoDS_Shell& aShell)
|
|
||||||
{
|
|
||||||
myShell=aShell;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Shell
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
const TopoDS_Shell& BOP_ShellSplitter::Shell()const
|
|
||||||
{
|
|
||||||
return myShell;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoWithShell
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellSplitter::DoWithShell ()
|
|
||||||
{
|
|
||||||
myFaces.Clear();
|
|
||||||
|
|
||||||
TopExp_Explorer anExpFaces (myShell, TopAbs_FACE);
|
|
||||||
for (; anExpFaces.More(); anExpFaces.Next()) {
|
|
||||||
const TopoDS_Face& aF = TopoDS::Face(anExpFaces.Current());
|
|
||||||
myFaces.Append(aF);
|
|
||||||
}
|
|
||||||
Do();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoWithListOfEdges
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellSplitter::DoWithListOfEdges(const TopTools_ListOfShape& aLE)
|
|
||||||
{
|
|
||||||
myFaces.Clear();
|
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape anItList;
|
|
||||||
|
|
||||||
anItList.Initialize(aLE);
|
|
||||||
for (; anItList.More(); anItList.Next()) {
|
|
||||||
const TopoDS_Face& aF = TopoDS::Face(anItList.Value());
|
|
||||||
myFaces.Append(aF);
|
|
||||||
}
|
|
||||||
Do();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: Do
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_ShellSplitter::Do()
|
|
||||||
{
|
|
||||||
myIsDone=Standard_False;
|
|
||||||
myNothingToDo=Standard_False;
|
|
||||||
//
|
|
||||||
TopTools_ListIteratorOfListOfShape anItList;
|
|
||||||
TopTools_IndexedDataMapOfShapeShape aMFNewOld;
|
|
||||||
TopoDS_Shell aShell;
|
|
||||||
BRep_Builder aBB;
|
|
||||||
//
|
|
||||||
// insert the code about myNothingToDo
|
|
||||||
//
|
|
||||||
// 1. Make the formal shell
|
|
||||||
aBB.MakeShell(aShell);
|
|
||||||
//
|
|
||||||
anItList.Initialize(myFaces);
|
|
||||||
for (; anItList.More(); anItList.Next()) {
|
|
||||||
const TopoDS_Face& aF = TopoDS::Face(anItList.Value());
|
|
||||||
TopoDS_Face aFNew;
|
|
||||||
RemoveInternals (aF, aFNew);
|
|
||||||
aMFNewOld.Add (aFNew, aF);
|
|
||||||
|
|
||||||
aBB.Add(aShell, aFNew);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// 2. Split the Shell
|
|
||||||
|
|
||||||
TopoDS_Shape aShape;
|
|
||||||
SplitShell (aShell, aShape);
|
|
||||||
//
|
|
||||||
// 3. Post-pro the result aShape
|
|
||||||
// and filling the myShapes field .
|
|
||||||
TopExp_Explorer aShellExp(aShape, TopAbs_SHELL);
|
|
||||||
for (; aShellExp.More(); aShellExp.Next()) {
|
|
||||||
const TopoDS_Shape& aSh= aShellExp.Current();
|
|
||||||
|
|
||||||
TopTools_ListOfShape aLF;
|
|
||||||
TopExp_Explorer aFaceExp(aSh, TopAbs_FACE);
|
|
||||||
for (; aFaceExp.More(); aFaceExp.Next()) {
|
|
||||||
const TopoDS_Shape& aFNew= aFaceExp.Current();
|
|
||||||
|
|
||||||
const TopoDS_Shape& aFOld=aMFNewOld.FindFromKey(aFNew);
|
|
||||||
aLF.Append(aFOld);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aLF.Extent()) {
|
|
||||||
myShapes.Append(aLF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
myIsDone=Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: RemoveInternals
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void RemoveInternals(const TopoDS_Face& aF,
|
|
||||||
TopoDS_Face& aFNew)
|
|
||||||
{
|
|
||||||
BRep_Builder aBB;
|
|
||||||
Standard_Integer iCnt;
|
|
||||||
Standard_Real aTol;
|
|
||||||
|
|
||||||
|
|
||||||
TopLoc_Location aLoc;
|
|
||||||
Handle(Geom_Surface) aSurface=BRep_Tool::Surface(aF, aLoc);
|
|
||||||
aTol=BRep_Tool::Tolerance(aF);
|
|
||||||
aBB.MakeFace (aFNew, aSurface, aLoc, aTol);
|
|
||||||
aFNew.Orientation(aF.Orientation());
|
|
||||||
|
|
||||||
TopExp_Explorer aFExp(aF, TopAbs_WIRE);
|
|
||||||
for (; aFExp.More(); aFExp.Next()) {
|
|
||||||
const TopoDS_Wire& aW= TopoDS::Wire(aFExp.Current());
|
|
||||||
TopoDS_Wire aWNew;
|
|
||||||
aBB.MakeWire(aWNew);
|
|
||||||
aWNew.Orientation(aW.Orientation());
|
|
||||||
|
|
||||||
iCnt=0;
|
|
||||||
TopExp_Explorer aWExp(aW, TopAbs_EDGE);
|
|
||||||
for (; aWExp.More(); aWExp.Next()) {
|
|
||||||
const TopoDS_Edge& aE=TopoDS::Edge(aWExp.Current());
|
|
||||||
if (aE.Orientation()!=TopAbs_INTERNAL) {
|
|
||||||
aBB.Add(aWNew, aE);
|
|
||||||
iCnt++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (iCnt) {
|
|
||||||
aBB.Add(aFNew, aWNew);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////
|
|
||||||
//
|
|
||||||
//=======================================================================
|
|
||||||
// function : SplitShell
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean SplitShell (const TopoDS_Shell& aShellIn,
|
|
||||||
TopoDS_Shape& aShellsOut)
|
|
||||||
{
|
|
||||||
Standard_Boolean done;
|
|
||||||
Standard_Integer i, j, aNumMultShell;
|
|
||||||
|
|
||||||
TopTools_SequenceOfShape aSeqShells, aErrFaces, Lface;
|
|
||||||
TopTools_DataMapOfShapeShape aMapFaceShells;
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
|
|
||||||
TopTools_MapOfShape aMapMultiConnectEdges;
|
|
||||||
TopoDS_Compound aCmpErrFaces;
|
|
||||||
//
|
|
||||||
done = Standard_False;
|
|
||||||
aNumMultShell =0;
|
|
||||||
aShellsOut = aShellIn;
|
|
||||||
|
|
||||||
TopoDS_Iterator iter(aShellIn);
|
|
||||||
for (; iter.More(); iter.Next()) {
|
|
||||||
Lface.Append(iter.Value());
|
|
||||||
}
|
|
||||||
//
|
|
||||||
TopExp::MapShapesAndAncestors(aShellIn, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
|
|
||||||
//
|
|
||||||
//Finds multishared edges
|
|
||||||
Standard_Integer aNbEdges, aNbFaces;
|
|
||||||
aNbEdges=aMapEdgeFaces.Extent();
|
|
||||||
for(j=1; j<=aNbEdges; j++) {
|
|
||||||
const TopTools_ListOfShape& aLF=aMapEdgeFaces(j);
|
|
||||||
aNbFaces=aLF.Extent();
|
|
||||||
if(aNbFaces>2) {
|
|
||||||
const TopoDS_Shape& aE=aMapEdgeFaces.FindKey(j);
|
|
||||||
aMapMultiConnectEdges.Add(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
//Gets shells without taking in account of multiconnexity.
|
|
||||||
Standard_Boolean isGetShells = Standard_True;
|
|
||||||
|
|
||||||
while(isGetShells && Lface.Length()) {
|
|
||||||
TopTools_SequenceOfShape aTmpSeqShells;
|
|
||||||
Standard_Boolean bGetShells;
|
|
||||||
|
|
||||||
bGetShells=GetShells(Lface,
|
|
||||||
aMapMultiConnectEdges,
|
|
||||||
aTmpSeqShells,
|
|
||||||
aMapFaceShells,
|
|
||||||
aErrFaces);
|
|
||||||
if(bGetShells) {
|
|
||||||
done = Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
isGetShells = !aTmpSeqShells.IsEmpty();
|
|
||||||
if(isGetShells) {
|
|
||||||
aSeqShells.Append(aTmpSeqShells);
|
|
||||||
}
|
|
||||||
} // while(...)
|
|
||||||
//
|
|
||||||
//
|
|
||||||
Standard_Boolean aIsDone = Standard_False;
|
|
||||||
Standard_Integer aLfaceLength, aErrFacesLength;
|
|
||||||
|
|
||||||
aLfaceLength=Lface.Length();
|
|
||||||
aNumMultShell=aSeqShells.Length();
|
|
||||||
|
|
||||||
if(aLfaceLength && aNumMultShell) {
|
|
||||||
//Crating shells in the case of compsolid
|
|
||||||
aIsDone = AddMultiConexityFaces(Lface,
|
|
||||||
aMapMultiConnectEdges,
|
|
||||||
aSeqShells,
|
|
||||||
aMapFaceShells,
|
|
||||||
aMapEdgeFaces,
|
|
||||||
aErrFaces);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aNumMultShell = aSeqShells.Length();
|
|
||||||
aErrFacesLength=aErrFaces.Length();
|
|
||||||
//
|
|
||||||
if (aErrFacesLength) {
|
|
||||||
BRep_Builder B;
|
|
||||||
TopoDS_Compound aCompShells;
|
|
||||||
|
|
||||||
B.MakeCompound (aCmpErrFaces);
|
|
||||||
B.MakeCompound(aCompShells);
|
|
||||||
|
|
||||||
for(j =1; j <= aErrFacesLength; j++){
|
|
||||||
B.Add(aCmpErrFaces, aErrFaces.Value(j));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(aNumMultShell) {
|
|
||||||
|
|
||||||
if(aNumMultShell == 1) {
|
|
||||||
aShellsOut = aSeqShells.Value(1);
|
|
||||||
B.Add(aCompShells, aSeqShells.Value(1));
|
|
||||||
|
|
||||||
for(j=1; j <= aErrFacesLength; j++) {
|
|
||||||
TopoDS_Shell aSh;
|
|
||||||
B.MakeShell(aSh);
|
|
||||||
B.Add(aSh, aErrFaces.Value(j));
|
|
||||||
B.Add(aCompShells, aSh);
|
|
||||||
}
|
|
||||||
aShellsOut = aCompShells;
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
for(i=1; i <= aNumMultShell; i++) {
|
|
||||||
B.Add(aCompShells, aSeqShells.Value(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
for(j=1; j<= aErrFacesLength; j++) {
|
|
||||||
TopoDS_Shell aSh;
|
|
||||||
B.MakeShell(aSh);
|
|
||||||
B.Add(aSh,aErrFaces.Value(j));
|
|
||||||
B.Add(aCompShells, aSh);
|
|
||||||
}
|
|
||||||
aShellsOut = aCompShells;
|
|
||||||
}
|
|
||||||
} //if(aNumMultShell)
|
|
||||||
|
|
||||||
done = Standard_True;
|
|
||||||
return done;
|
|
||||||
} // if (aErrFacesLength)
|
|
||||||
//
|
|
||||||
//
|
|
||||||
if(aNumMultShell>1) {
|
|
||||||
TopTools_SequenceOfShape OpenShells;
|
|
||||||
|
|
||||||
for(i=1; i <= aSeqShells.Length(); i++) {
|
|
||||||
TopoDS_Shape aShell = aSeqShells.Value(i);
|
|
||||||
if(!BRep_Tool::IsClosed(aShell)) {
|
|
||||||
OpenShells.Append(aShell);
|
|
||||||
aSeqShells.Remove(i--);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
j=OpenShells.Length();
|
|
||||||
if(j>1) {
|
|
||||||
// Attempt of creation closed shell from open shells
|
|
||||||
// with taking into account multiconnexity.
|
|
||||||
//
|
|
||||||
CreateClosedShell(OpenShells, aMapMultiConnectEdges, aMapEdgeFaces);
|
|
||||||
aSeqShells.Append(OpenShells);
|
|
||||||
}
|
|
||||||
} //if(aNumMultShell>1)
|
|
||||||
//
|
|
||||||
//
|
|
||||||
j=Lface.Length();
|
|
||||||
if(j) {
|
|
||||||
for(i=1; i <= j; i++) {
|
|
||||||
BRep_Builder aB;
|
|
||||||
TopoDS_Shell OneShell;
|
|
||||||
aB.MakeShell(OneShell);
|
|
||||||
aB.Add(OneShell, Lface.Value(i));
|
|
||||||
aSeqShells.Append(OneShell);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
aNumMultShell = aSeqShells.Length();
|
|
||||||
if(!done) {
|
|
||||||
done = (aNumMultShell>1 || aIsDone);
|
|
||||||
}
|
|
||||||
|
|
||||||
BRep_Builder B;
|
|
||||||
TopoDS_Compound aCompShells;
|
|
||||||
B.MakeCompound(aCompShells);
|
|
||||||
for(i=1; i <= aNumMultShell; i++){
|
|
||||||
B.Add(aCompShells, aSeqShells.Value(i));
|
|
||||||
}
|
|
||||||
aShellsOut = aCompShells;
|
|
||||||
//
|
|
||||||
return done;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : GetShells
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean GetShells(TopTools_SequenceOfShape& Lface,
|
|
||||||
const TopTools_MapOfShape& aMapMultiConnectEdges,
|
|
||||||
TopTools_SequenceOfShape& aSeqShells,
|
|
||||||
TopTools_DataMapOfShapeShape& aMapFaceShells,
|
|
||||||
TopTools_SequenceOfShape& ErrFaces)
|
|
||||||
{
|
|
||||||
Standard_Boolean done = Standard_False;
|
|
||||||
Standard_Integer i, j, aNbLfaceLength;
|
|
||||||
|
|
||||||
j=Lface.Length();
|
|
||||||
if(!j) {
|
|
||||||
return done;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean isMultiConnex;
|
|
||||||
TopoDS_Shell nshell;
|
|
||||||
TopTools_MapOfShape dire, reve;
|
|
||||||
BRep_Builder B;
|
|
||||||
TopTools_SequenceOfShape aSeqUnconnectFaces;
|
|
||||||
|
|
||||||
B.MakeShell(nshell);
|
|
||||||
isMultiConnex = !aMapMultiConnectEdges.IsEmpty();
|
|
||||||
i=1;
|
|
||||||
j=1;
|
|
||||||
//
|
|
||||||
for(; i<=Lface.Length(); i++) {
|
|
||||||
aNbLfaceLength=Lface.Length();
|
|
||||||
TopTools_MapOfShape dtemp, rtemp;
|
|
||||||
Standard_Integer nbbe=0, nbe = 0;
|
|
||||||
|
|
||||||
TopoDS_Face aF = TopoDS::Face(Lface.Value(i));
|
|
||||||
|
|
||||||
TopExp_Explorer anExpe(aF, TopAbs_EDGE);
|
|
||||||
for(; anExpe.More(); anExpe.Next()) {
|
|
||||||
const TopoDS_Edge& aE = TopoDS::Edge(anExpe.Current());
|
|
||||||
|
|
||||||
if(isMultiConnex && aMapMultiConnectEdges.Contains(aE)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BRep_Tool::Degenerated (aE)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BRep_Tool::IsClosed(aE, aF)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopAbs_Orientation anEOr;
|
|
||||||
anEOr=aE.Orientation();
|
|
||||||
|
|
||||||
Standard_Boolean bDireContains, bReveContains;
|
|
||||||
|
|
||||||
bDireContains=dire.Contains(aE);
|
|
||||||
bReveContains=reve.Contains(aE);
|
|
||||||
|
|
||||||
if((anEOr == TopAbs_FORWARD && bDireContains) ||
|
|
||||||
(anEOr == TopAbs_REVERSED && bReveContains)) {
|
|
||||||
nbbe++;
|
|
||||||
}
|
|
||||||
else if((anEOr == TopAbs_FORWARD && bReveContains) ||
|
|
||||||
(anEOr == TopAbs_REVERSED && bDireContains)) {
|
|
||||||
nbe++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bDireContains) {
|
|
||||||
dire.Remove(aE);
|
|
||||||
}
|
|
||||||
else if(bReveContains) {
|
|
||||||
reve.Remove(aE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(anEOr == TopAbs_FORWARD) {
|
|
||||||
dtemp.Add(aE);
|
|
||||||
}
|
|
||||||
if(anEOr == TopAbs_REVERSED) {
|
|
||||||
rtemp.Add(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // for(; expe.More(); expe.Next())
|
|
||||||
//
|
|
||||||
//
|
|
||||||
if(!nbbe && !nbe && dtemp.IsEmpty() && rtemp.IsEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if( nbe != 0 && nbbe != 0) {
|
|
||||||
ErrFaces.Append(aF);
|
|
||||||
Lface.Remove(i);
|
|
||||||
aNbLfaceLength=Lface.Length();
|
|
||||||
j++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if((nbe != 0 || nbbe != 0) || j == 1) {
|
|
||||||
TopTools_MapIteratorOfMapOfShape ite;
|
|
||||||
if(nbbe != 0) {
|
|
||||||
aF.Reverse();
|
|
||||||
|
|
||||||
ite.Initialize(dtemp);
|
|
||||||
for(; ite.More(); ite.Next()) {
|
|
||||||
reve.Add(ite.Key());
|
|
||||||
}
|
|
||||||
|
|
||||||
ite.Initialize(rtemp);
|
|
||||||
for(; ite.More(); ite.Next()){
|
|
||||||
dire.Add(ite.Key());
|
|
||||||
}
|
|
||||||
done = Standard_True;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ite.Initialize(dtemp);
|
|
||||||
for(; ite.More(); ite.Next()) {
|
|
||||||
dire.Add(ite.Key());
|
|
||||||
}
|
|
||||||
|
|
||||||
ite.Initialize(rtemp);
|
|
||||||
for(; ite.More(); ite.Next()){
|
|
||||||
reve.Add(ite.Key());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
j++;
|
|
||||||
B.Add(nshell, aF);
|
|
||||||
aMapFaceShells.Bind(aF, nshell);
|
|
||||||
Lface.Remove(i);
|
|
||||||
aNbLfaceLength=Lface.Length();
|
|
||||||
if(isMultiConnex && BRep_Tool::IsClosed(nshell)) {
|
|
||||||
aSeqShells.Append(nshell);
|
|
||||||
TopoDS_Shell nshellnext;
|
|
||||||
B.MakeShell(nshellnext);
|
|
||||||
nshell = nshellnext;
|
|
||||||
j=1;
|
|
||||||
}
|
|
||||||
i=0;
|
|
||||||
} // if((nbe != 0 || nbbe != 0) || j == 1)
|
|
||||||
//
|
|
||||||
//
|
|
||||||
if(Lface.Length() && i == Lface.Length() && j <=2) {
|
|
||||||
TopoDS_Iterator aItf(nshell,Standard_False);
|
|
||||||
if(aItf.More()){
|
|
||||||
aSeqUnconnectFaces.Append(aItf.Value());
|
|
||||||
}
|
|
||||||
TopoDS_Shell nshellnext;
|
|
||||||
B.MakeShell(nshellnext);
|
|
||||||
nshell = nshellnext;
|
|
||||||
i=0;
|
|
||||||
j=1;
|
|
||||||
}
|
|
||||||
}//for(; i<=Lface.Length(); i++)
|
|
||||||
|
|
||||||
Standard_Boolean isContains = Standard_False;
|
|
||||||
j=aSeqShells.Length();
|
|
||||||
for(i=1 ; i <= j; i++){
|
|
||||||
isContains = nshell.IsSame(aSeqShells.Value(i));
|
|
||||||
if (isContains) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!isContains) {
|
|
||||||
Standard_Integer numFace =0;
|
|
||||||
TopoDS_Shape aFace;
|
|
||||||
|
|
||||||
TopoDS_Iterator aItf(nshell, Standard_False) ;
|
|
||||||
for(; aItf.More(); aItf.Next()) {
|
|
||||||
aFace = aItf.Value();
|
|
||||||
numFace++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(numFace >1) {
|
|
||||||
aSeqShells.Append(nshell);
|
|
||||||
}
|
|
||||||
else if(numFace == 1) {
|
|
||||||
Lface.Append(aFace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i=1; i<= aSeqUnconnectFaces.Length(); i++){
|
|
||||||
Lface.Append(aSeqUnconnectFaces);
|
|
||||||
}
|
|
||||||
return done;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : AddMultiConexityFaces
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean AddMultiConexityFaces(TopTools_SequenceOfShape& Lface,
|
|
||||||
const TopTools_MapOfShape& aMapMultiConnectEdges,
|
|
||||||
TopTools_SequenceOfShape& SeqShells,
|
|
||||||
const TopTools_DataMapOfShapeShape& aMapFaceShells,
|
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape& aMapEdgeFaces,
|
|
||||||
TopTools_SequenceOfShape& ErrFaces)
|
|
||||||
{
|
|
||||||
Standard_Boolean done = Standard_False;
|
|
||||||
BRep_Builder aB;
|
|
||||||
Standard_Integer i1;
|
|
||||||
|
|
||||||
for(i1 = 1 ; i1<=Lface.Length(); ) {
|
|
||||||
TopTools_MapOfShape dire, reve;
|
|
||||||
TopTools_IndexedMapOfShape MapOtherShells;
|
|
||||||
Standard_Integer aNbOtherShells;
|
|
||||||
|
|
||||||
const TopoDS_Face& aFace = TopoDS::Face(Lface.Value(i1));
|
|
||||||
//
|
|
||||||
//Finds shells containg multishared edges from this face
|
|
||||||
TopExp_Explorer aExpEdges(aFace, TopAbs_EDGE);
|
|
||||||
for(; aExpEdges.More(); aExpEdges.Next()) {
|
|
||||||
const TopoDS_Shape& aE = aExpEdges.Current();
|
|
||||||
|
|
||||||
if(!aMapMultiConnectEdges.Contains(aE)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( aE.Orientation() == TopAbs_FORWARD) {
|
|
||||||
dire.Add(aE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
reve.Add(aE);
|
|
||||||
}
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& aLF = aMapEdgeFaces.FindFromKey(aE);
|
|
||||||
TopTools_ListIteratorOfListOfShape aItl(aLF);
|
|
||||||
for(; aItl.More(); aItl.Next()) {
|
|
||||||
const TopoDS_Shape& aF = aItl.Value();
|
|
||||||
|
|
||||||
if(aF.IsSame(aFace)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopoDS_Shape aOthershell;
|
|
||||||
if(aMapFaceShells.IsBound(aF)) {
|
|
||||||
aOthershell = aMapFaceShells.Find(aF);
|
|
||||||
if(!MapOtherShells.Contains(aOthershell)) {
|
|
||||||
MapOtherShells.Add(aOthershell);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//for(; aExpEdges.More(); aExpEdges.Next())
|
|
||||||
//
|
|
||||||
//
|
|
||||||
aNbOtherShells=MapOtherShells.Extent();
|
|
||||||
//
|
|
||||||
if(!aNbOtherShells) {
|
|
||||||
i1++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
//Adds face to open shells containg the same multishared edges.
|
|
||||||
//For nonmanifold mode creation ine shell from face and shells
|
|
||||||
// containing the same multishared edges.
|
|
||||||
done = Standard_True;
|
|
||||||
|
|
||||||
Standard_Integer j, k;
|
|
||||||
|
|
||||||
TColStd_SequenceOfInteger SeqOtherShells;
|
|
||||||
for(j =1; j <= aNbOtherShells; j++) {
|
|
||||||
Standard_Integer index=0;
|
|
||||||
for(k =1; k <= SeqShells.Length() && !index; k++) {
|
|
||||||
if(SeqShells.Value(k) == MapOtherShells.FindKey(j)){
|
|
||||||
index = k;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SeqOtherShells.Append(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
aNbOtherShells= SeqOtherShells.Length();
|
|
||||||
|
|
||||||
for(j =1; j <= aNbOtherShells; j++) {
|
|
||||||
Standard_Integer nbdir =0,nbrev =0;
|
|
||||||
TopTools_MapOfShape mapEdges;
|
|
||||||
|
|
||||||
k = SeqOtherShells.Value(j);
|
|
||||||
const TopoDS_Shape& aShk=SeqShells.Value(k);
|
|
||||||
|
|
||||||
TopExp_Explorer aExpF(aShk, TopAbs_FACE);
|
|
||||||
for(; aExpF.More(); aExpF.Next()) {
|
|
||||||
const TopoDS_Shape& aFC=aExpF.Current();
|
|
||||||
|
|
||||||
TopExp_Explorer aExpE(aFC,TopAbs_EDGE);
|
|
||||||
for(; aExpE.More(); aExpE.Next()) {
|
|
||||||
|
|
||||||
const TopoDS_Shape& aEC = aExpE.Current();
|
|
||||||
if(!mapEdges.Contains(aEC)){
|
|
||||||
mapEdges.Add(aEC);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mapEdges.Remove(aEC);
|
|
||||||
}
|
|
||||||
|
|
||||||
}// for(; aExpE.More(); aExpE.Next())
|
|
||||||
}// for(; aExpF.More(); aExpF.Next()) {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
TopTools_MapIteratorOfMapOfShape aIte(mapEdges);
|
|
||||||
for(;aIte.More(); aIte.Next()) {
|
|
||||||
const TopoDS_Shape& aEC = aIte.Key();
|
|
||||||
TopAbs_Orientation anOrEC=aEC.Orientation();
|
|
||||||
|
|
||||||
Standard_Boolean bDireContains, bReveContains;
|
|
||||||
|
|
||||||
bDireContains=dire.Contains(aEC);
|
|
||||||
bReveContains=reve.Contains(aEC);
|
|
||||||
|
|
||||||
if((anOrEC == TopAbs_FORWARD && bDireContains) ||
|
|
||||||
(anOrEC == TopAbs_REVERSED && bReveContains)) {
|
|
||||||
nbrev++;
|
|
||||||
}
|
|
||||||
else if((anOrEC == TopAbs_FORWARD && bReveContains)||
|
|
||||||
(anOrEC == TopAbs_REVERSED && bDireContains)) {
|
|
||||||
nbdir++;
|
|
||||||
}
|
|
||||||
}// for(;aIte.More(); aIte.Next())
|
|
||||||
|
|
||||||
if(nbdir && nbrev) {
|
|
||||||
ErrFaces.Append(aFace);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(nbdir || nbrev) {
|
|
||||||
// for manifold mode face containing multiconnexity
|
|
||||||
// edges will be added in the each shell
|
|
||||||
// containing the same edges. ???
|
|
||||||
|
|
||||||
TopoDS_Shape aShell;
|
|
||||||
aShell = SeqShells.Value(k);
|
|
||||||
if (!nbrev) {
|
|
||||||
aB.Add(aShell, aFace);
|
|
||||||
SeqShells.ChangeValue(k) = aShell;
|
|
||||||
}
|
|
||||||
}// else if(nbdir || nbrev)
|
|
||||||
}// for(j =1; j <= aNbOtherShells; j++)
|
|
||||||
//
|
|
||||||
dire.Clear();
|
|
||||||
reve.Clear();
|
|
||||||
Lface.Remove(i1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return done;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function : CreateClosedShell
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void CreateClosedShell(TopTools_SequenceOfShape& OpenShells,
|
|
||||||
const TopTools_MapOfShape& aMapMultiConnectEdges,
|
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape& aMapEdgeFaces)
|
|
||||||
{
|
|
||||||
TopTools_MapOfShape amapFaces;
|
|
||||||
|
|
||||||
TopTools_MapIteratorOfMapOfShape aItEdg(aMapMultiConnectEdges);
|
|
||||||
for(; aItEdg.More(); aItEdg.Next()) {
|
|
||||||
const TopTools_ListOfShape& aLF = aMapEdgeFaces.FindFromKey(aItEdg.Key());
|
|
||||||
TopTools_ListIteratorOfListOfShape aItF(aLF);
|
|
||||||
for(; aItF.More(); aItF.Next()) {
|
|
||||||
amapFaces.Add(aItF.Value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Creating new shells if some open shells contain the same edges.
|
|
||||||
Standard_Integer i, j;
|
|
||||||
Standard_Boolean isClosedShell;
|
|
||||||
|
|
||||||
for(i=1; i <= OpenShells.Length(); i++) {
|
|
||||||
TopTools_MapOfShape dire, reve;
|
|
||||||
|
|
||||||
isClosedShell = Standard_False;
|
|
||||||
const TopoDS_Shape& anOpenShelli=OpenShells.Value(i);
|
|
||||||
TopExp_Explorer aExpF(anOpenShelli, TopAbs_FACE);
|
|
||||||
|
|
||||||
for(; aExpF.More(); aExpF.Next()) {
|
|
||||||
const TopoDS_Shape& aFace = aExpF.Current();
|
|
||||||
|
|
||||||
if(!amapFaces.Contains(aFace)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopExp_Explorer aExpEdges(aFace, TopAbs_EDGE);
|
|
||||||
for(; aExpEdges.More(); aExpEdges.Next()) {
|
|
||||||
const TopoDS_Shape& aE = aExpEdges.Current();
|
|
||||||
|
|
||||||
if(!aMapMultiConnectEdges.Contains(aE)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopAbs_Orientation anOrE;
|
|
||||||
anOrE=aE.Orientation();
|
|
||||||
|
|
||||||
if(anOrE == TopAbs_FORWARD) {
|
|
||||||
dire.Add(aE);
|
|
||||||
}
|
|
||||||
else if(anOrE == TopAbs_REVERSED) {
|
|
||||||
reve.Add(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}// for(; aExpF.More(); aExpF.Next())
|
|
||||||
//
|
|
||||||
//
|
|
||||||
for(j=i+1; j<=OpenShells.Length(); j++) {
|
|
||||||
Standard_Integer nbedge =0;
|
|
||||||
Standard_Boolean isReversed = Standard_False;
|
|
||||||
|
|
||||||
const TopoDS_Shape& anOpenShellj=OpenShells.Value(j);
|
|
||||||
|
|
||||||
TopExp_Explorer aExpF2(anOpenShellj, TopAbs_FACE);
|
|
||||||
for(; aExpF2.More() && !nbedge; aExpF2.Next()) {
|
|
||||||
|
|
||||||
const TopoDS_Shape& aFace2 = aExpF2.Current();
|
|
||||||
|
|
||||||
if(!amapFaces.Contains(aFace2)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopExp_Explorer aExpEdges2(aFace2, TopAbs_EDGE);
|
|
||||||
for(; aExpEdges2.More()&& !nbedge; aExpEdges2.Next()) {
|
|
||||||
const TopoDS_Shape& aE2 = aExpEdges2.Current();
|
|
||||||
|
|
||||||
if(!aMapMultiConnectEdges.Contains(aE2)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean bDireContains, bReveContains;
|
|
||||||
|
|
||||||
bDireContains=dire.Contains(aE2);
|
|
||||||
bReveContains=reve.Contains(aE2);
|
|
||||||
|
|
||||||
if(!bDireContains && !bReveContains) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
isClosedShell = Standard_True;
|
|
||||||
|
|
||||||
TopAbs_Orientation anOrE2;
|
|
||||||
anOrE2=aE2.Orientation();
|
|
||||||
if((anOrE2 == TopAbs_FORWARD && bDireContains) ||
|
|
||||||
(anOrE2 == TopAbs_REVERSED && bReveContains)) {
|
|
||||||
isReversed = Standard_True;
|
|
||||||
}
|
|
||||||
nbedge++;
|
|
||||||
}
|
|
||||||
}// for(; aExpF2.More() && !nbedge; aExpF2.Next())
|
|
||||||
|
|
||||||
if(!isClosedShell){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
BRep_Builder aB;
|
|
||||||
TopoDS_Shape aShell = OpenShells.Value(i);
|
|
||||||
|
|
||||||
TopExp_Explorer aExpF21(anOpenShellj, TopAbs_FACE);
|
|
||||||
for(; aExpF21.More(); aExpF21.Next()) {
|
|
||||||
const TopoDS_Shape& aFace = aExpF21.Current();
|
|
||||||
//if(isReversed) {
|
|
||||||
// aFace.Reverse();
|
|
||||||
//}
|
|
||||||
aB.Add(aShell, aFace);
|
|
||||||
}
|
|
||||||
|
|
||||||
OpenShells.ChangeValue(i) = aShell;
|
|
||||||
OpenShells.Remove(j--);
|
|
||||||
}// for(j=i+1 ; j<=OpenShells.Length();j++ )
|
|
||||||
}//for(i=1; i <= OpenShells.Length(); i++)
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
-- Created on: 2001-06-25
|
|
||||||
-- Created by: Michael KLOKOV
|
|
||||||
-- Copyright (c) 2001-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 SolidAreaBuilder from BOP inherits Area3dBuilder from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- construct Areas for Solids from a Shell Faces Set
|
|
||||||
---
|
|
||||||
uses
|
|
||||||
LoopSet from BOP,
|
|
||||||
LoopClassifier from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
Create returns SolidAreaBuilder from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
Create(LS:out LoopSet from BOP;
|
|
||||||
LC:out LoopClassifier from BOP;
|
|
||||||
ForceClassFlag: Boolean from Standard = Standard_False)
|
|
||||||
returns SolidAreaBuilder from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Creates an object to build solids on
|
|
||||||
--- the (shells, blocks of faces) of <LS>,
|
|
||||||
--- using the classifier <LC>.
|
|
||||||
|
|
||||||
InitSolidAreaBuilder(me: in out;
|
|
||||||
LS:out LoopSet from BOP;
|
|
||||||
LC:out LoopClassifier from BOP;
|
|
||||||
ForceClassFlag: Boolean from Standard);
|
|
||||||
---Purpose:
|
|
||||||
---Purpose:
|
|
||||||
--- Initialize the object to find the areas of
|
|
||||||
--- the shapes described by <LS>,
|
|
||||||
--- using the classifier <LC>.
|
|
||||||
---
|
|
||||||
end SolidAreaBuilder from BOP;
|
|
@ -1,49 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
#include <BOP_SolidAreaBuilder.ixx>
|
|
||||||
|
|
||||||
// =====================================================================
|
|
||||||
// function: BOP_SolidAreaBuilder::BOP_SolidAreaBuilder
|
|
||||||
// purpose:
|
|
||||||
// =====================================================================
|
|
||||||
BOP_SolidAreaBuilder::BOP_SolidAreaBuilder()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// =====================================================================
|
|
||||||
// function: BOP_SolidAreaBuilder
|
|
||||||
// purpose:
|
|
||||||
// =====================================================================
|
|
||||||
BOP_SolidAreaBuilder::BOP_SolidAreaBuilder(BOP_LoopSet& theLS,
|
|
||||||
BOP_LoopClassifier& theLC,
|
|
||||||
const Standard_Boolean theForceClassFlag)
|
|
||||||
{
|
|
||||||
InitSolidAreaBuilder(theLS, theLC, theForceClassFlag);
|
|
||||||
}
|
|
||||||
|
|
||||||
// =====================================================================
|
|
||||||
// function: InitSolidAreaBuilder
|
|
||||||
// purpose:
|
|
||||||
// =====================================================================
|
|
||||||
void BOP_SolidAreaBuilder::InitSolidAreaBuilder(BOP_LoopSet& theLS,
|
|
||||||
BOP_LoopClassifier& theLC,
|
|
||||||
const Standard_Boolean theForceClassFlag)
|
|
||||||
{
|
|
||||||
InitAreaBuilder(theLS, theLC, theForceClassFlag);
|
|
||||||
}
|
|
||||||
|
|
@ -1,119 +0,0 @@
|
|||||||
-- Created on: 2001-06-25
|
|
||||||
-- Created by: Michael KLOKOV
|
|
||||||
-- Copyright (c) 2001-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 SolidBuilder from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- Construct Solids from a Shell Faces Set (SFS)
|
|
||||||
---
|
|
||||||
uses
|
|
||||||
|
|
||||||
Shell from TopoDS,
|
|
||||||
Face from TopoDS,
|
|
||||||
ShapeSet from BOP,
|
|
||||||
LoopSet from BOP,
|
|
||||||
ShellFaceSet from BOP,
|
|
||||||
BlockBuilder from BOP,
|
|
||||||
BlockIterator from BOP,
|
|
||||||
SolidAreaBuilder from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns SolidBuilder from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
Create(theSFS: in out ShellFaceSet from BOP;
|
|
||||||
theForceClassFlag: Boolean from Standard = Standard_False)
|
|
||||||
returns SolidBuilder from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- The constructor that just calls the method
|
|
||||||
--- InitSolidBuilder() below
|
|
||||||
---
|
|
||||||
InitSolidBuilder(me : in out;
|
|
||||||
theSFS: in out ShellFaceSet from BOP;
|
|
||||||
theForceClassFlag: Boolean from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Launches the algorithm consisting of four steps
|
|
||||||
--- 1. Split the SFS on shells ( BOP_SFSCorrector object)
|
|
||||||
--- 2. Make Loops from shells ( this->MakeLoops() )
|
|
||||||
--- 3. Make Areas from Loops ( BOP_SolidAreaBuilder object)
|
|
||||||
--- 4. Make Solids from Areas ( see methods below )
|
|
||||||
---
|
|
||||||
|
|
||||||
---
|
|
||||||
--- O u t p u t m e t h o d s
|
|
||||||
---
|
|
||||||
--- Iterator on Solids
|
|
||||||
---
|
|
||||||
InitSolid(me: in out)
|
|
||||||
returns Integer from Standard;
|
|
||||||
|
|
||||||
MoreSolid(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
NextSolid(me : in out);
|
|
||||||
---
|
|
||||||
--- Iterator on Shells
|
|
||||||
---
|
|
||||||
InitShell(me : in out)
|
|
||||||
returns Integer from Standard;
|
|
||||||
|
|
||||||
MoreShell(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
NextShell(me : in out);
|
|
||||||
|
|
||||||
IsOldShell(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
OldShell(me) returns Shell from TopoDS;
|
|
||||||
---
|
|
||||||
--- Iterator on Shells
|
|
||||||
---
|
|
||||||
InitFace(me : in out)
|
|
||||||
returns Integer from Standard;
|
|
||||||
|
|
||||||
MoreFace(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
NextFace(me : in out);
|
|
||||||
|
|
||||||
Face(me)
|
|
||||||
returns Face from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Returns current new face of current new shell.
|
|
||||||
---
|
|
||||||
|
|
||||||
------------------------------------------------------
|
|
||||||
-- P r i v a t e b l o c k
|
|
||||||
--
|
|
||||||
MakeLoops(me: in out; theSFS: in out ShapeSet from BOP)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myLoopSet : LoopSet from BOP;
|
|
||||||
myBlockIterator : BlockIterator from BOP;
|
|
||||||
myBlockBuilder : BlockBuilder from BOP;
|
|
||||||
mySolidAreaBuilder: SolidAreaBuilder from BOP;
|
|
||||||
|
|
||||||
end SolidBuilder from BOP;
|
|
@ -1,212 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
#include <BOP_SolidBuilder.ixx>
|
|
||||||
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
|
|
||||||
#include <BOP_ShellFaceClassifier.hxx>
|
|
||||||
#include <BOP_Loop.hxx>
|
|
||||||
#include <BOP_SFSCorrector.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: BOP_SolidBuilder
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
BOP_SolidBuilder::BOP_SolidBuilder()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: BOP_SolidBuilder
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
BOP_SolidBuilder::BOP_SolidBuilder(BOP_ShellFaceSet& theSFS,
|
|
||||||
const Standard_Boolean theForceClassFlag)
|
|
||||||
{
|
|
||||||
InitSolidBuilder(theSFS, theForceClassFlag);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: InitSolidBuilder
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
void BOP_SolidBuilder::InitSolidBuilder(BOP_ShellFaceSet& theSFS,
|
|
||||||
const Standard_Boolean theForceClassFlag)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
BOP_SFSCorrector aSFSCor;
|
|
||||||
aSFSCor.SetSFS(theSFS);
|
|
||||||
aSFSCor.Do();
|
|
||||||
BOP_ShellFaceSet& aNewSFS=aSFSCor.NewSFS();
|
|
||||||
//
|
|
||||||
//MakeLoops(theSFS);
|
|
||||||
|
|
||||||
MakeLoops(aNewSFS);
|
|
||||||
BOP_ShellFaceClassifier SFC(myBlockBuilder);
|
|
||||||
//
|
|
||||||
mySolidAreaBuilder.InitSolidAreaBuilder(myLoopSet, SFC, theForceClassFlag);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: InitSolid
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
Standard_Integer BOP_SolidBuilder::InitSolid()
|
|
||||||
{
|
|
||||||
return mySolidAreaBuilder.InitArea();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: MoreSolid
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
Standard_Boolean BOP_SolidBuilder::MoreSolid() const
|
|
||||||
{
|
|
||||||
return mySolidAreaBuilder.MoreArea();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: NextSolid
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
void BOP_SolidBuilder::NextSolid()
|
|
||||||
{
|
|
||||||
mySolidAreaBuilder.NextArea();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: InitShell
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
Standard_Integer BOP_SolidBuilder::InitShell()
|
|
||||||
{
|
|
||||||
return mySolidAreaBuilder.InitLoop();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: MoreShell
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
Standard_Boolean BOP_SolidBuilder::MoreShell() const
|
|
||||||
{
|
|
||||||
return mySolidAreaBuilder.MoreLoop();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: NextShell
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
void BOP_SolidBuilder::NextShell()
|
|
||||||
{
|
|
||||||
mySolidAreaBuilder.NextLoop();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: IsOldShell
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
Standard_Boolean BOP_SolidBuilder::IsOldShell() const
|
|
||||||
{
|
|
||||||
return mySolidAreaBuilder.Loop()->IsShape();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: OldShell
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
TopoDS_Shell BOP_SolidBuilder::OldShell() const
|
|
||||||
{
|
|
||||||
if(!IsOldShell()) {
|
|
||||||
Standard_DomainError::Raise("BOP_SolidBuilder::OldShell");
|
|
||||||
}
|
|
||||||
|
|
||||||
return TopoDS::Shell(mySolidAreaBuilder.Loop()->Shape());
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: InitFace
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
Standard_Integer BOP_SolidBuilder::InitFace()
|
|
||||||
{
|
|
||||||
const Handle(BOP_Loop)& aLoop = mySolidAreaBuilder.Loop();
|
|
||||||
|
|
||||||
if(aLoop->IsShape())
|
|
||||||
Standard_DomainError::Raise("BOP_SolidBuilder::InitFace");
|
|
||||||
else {
|
|
||||||
myBlockIterator = aLoop->BlockIterator();
|
|
||||||
myBlockIterator.Initialize();
|
|
||||||
}
|
|
||||||
return myBlockIterator.Extent();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: MoreFace
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
Standard_Boolean BOP_SolidBuilder::MoreFace() const
|
|
||||||
{
|
|
||||||
return myBlockIterator.More();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: NextFace
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
void BOP_SolidBuilder::NextFace()
|
|
||||||
{
|
|
||||||
myBlockIterator.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: Face
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
const TopoDS_Face& BOP_SolidBuilder::Face() const
|
|
||||||
{
|
|
||||||
const TopoDS_Shape& aShape = myBlockBuilder.Element(myBlockIterator);
|
|
||||||
return TopoDS::Face(aShape);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==============================================================
|
|
||||||
// function: MakeLoops
|
|
||||||
// purpose:
|
|
||||||
// ==============================================================
|
|
||||||
void BOP_SolidBuilder::MakeLoops(BOP_ShapeSet& theSFS)
|
|
||||||
{
|
|
||||||
myBlockBuilder.MakeBlock(theSFS);
|
|
||||||
|
|
||||||
BOP_ListOfLoop& aList = myLoopSet.ChangeListOfLoop();
|
|
||||||
aList.Clear();
|
|
||||||
|
|
||||||
// Add shapes of theSFS as shape loops
|
|
||||||
for(theSFS.InitShapes(); theSFS.MoreShapes(); theSFS.NextShape()) {
|
|
||||||
Handle(BOP_Loop) aShapeLoop = new BOP_Loop(theSFS.Shape());
|
|
||||||
aList.Append(aShapeLoop);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add blocks of myBlockBuilder as block loops
|
|
||||||
for(myBlockBuilder.InitBlock(); myBlockBuilder.MoreBlock(); myBlockBuilder.NextBlock()) {
|
|
||||||
BOP_BlockIterator aBlockIterator = myBlockBuilder.BlockIterator();
|
|
||||||
Handle(BOP_Loop) aShapeLoop = new BOP_Loop(aBlockIterator);
|
|
||||||
aList.Append(aShapeLoop);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,102 +0,0 @@
|
|||||||
-- 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 SolidClassifier from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
-- The auxiliary class to classify points with
|
|
||||||
-- a solid
|
|
||||||
--
|
|
||||||
uses
|
|
||||||
|
|
||||||
State from TopAbs,
|
|
||||||
Shell from TopoDS,
|
|
||||||
Solid from TopoDS,
|
|
||||||
Pnt from gp,
|
|
||||||
PSoClassif from BOP,
|
|
||||||
IndexedDataMapOfSolidClassifier from BOP,
|
|
||||||
Builder from BRep
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns SolidClassifier from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty Constructor
|
|
||||||
---
|
|
||||||
Clear(me:out)
|
|
||||||
is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Clear internal state
|
|
||||||
---
|
|
||||||
LoadSolid(me: out;
|
|
||||||
aS : Solid from TopoDS)
|
|
||||||
is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
Classify(me:out;
|
|
||||||
aS : Solid from TopoDS;
|
|
||||||
aP : Pnt from gp;
|
|
||||||
aTol: Real from Standard)
|
|
||||||
returns State from TopAbs
|
|
||||||
is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Compute the position of point <P> regarding with the
|
|
||||||
--- geometric domain of the solid <S>.
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
LoadShell(me:out;
|
|
||||||
S : Shell from TopoDS)
|
|
||||||
is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
Classify(me:out;
|
|
||||||
aS : Shell from TopoDS;
|
|
||||||
aP : Pnt from gp;
|
|
||||||
aTol : Real from Standard)
|
|
||||||
returns State from TopAbs
|
|
||||||
is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Compute the position of point <P> regarding with the
|
|
||||||
--- geometric domain of the shell <S>.
|
|
||||||
---
|
|
||||||
State(me)
|
|
||||||
returns State from TopAbs
|
|
||||||
is static;
|
|
||||||
---Purpose:
|
|
||||||
--- Returns computed 3D-State
|
|
||||||
---
|
|
||||||
Destroy (me:out);
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_SolidClassifier(){Destroy();}"
|
|
||||||
---Purpose:
|
|
||||||
--- Destructor
|
|
||||||
---
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myPClassifier : PSoClassif from BOP;
|
|
||||||
myClassifierMap : IndexedDataMapOfSolidClassifier from BOP;
|
|
||||||
myState : State from TopAbs;
|
|
||||||
myShell : Shell from TopoDS;
|
|
||||||
mySolid : Solid from TopoDS;
|
|
||||||
myBuilder : Builder from BRep;
|
|
||||||
|
|
||||||
end SolidClassifier from BOP;
|
|
@ -1,197 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
// NIZNHY-PKV Thu Apr 11 10:42:14 2002
|
|
||||||
|
|
||||||
#include <BOP_SolidClassifier.ixx>
|
|
||||||
|
|
||||||
#include <BRepClass3d_SolidClassifier.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function :
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_SolidClassifier::BOP_SolidClassifier()
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Clear
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_SolidClassifier::Clear()
|
|
||||||
{
|
|
||||||
myPClassifier = NULL;
|
|
||||||
myClassifierMap.Clear();
|
|
||||||
myState = TopAbs_UNKNOWN;
|
|
||||||
myShell.Nullify();
|
|
||||||
mySolid.Nullify();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : LoadSolid
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_SolidClassifier::LoadSolid(const TopoDS_Solid& SOL)
|
|
||||||
{
|
|
||||||
Standard_Boolean found;
|
|
||||||
|
|
||||||
found = myClassifierMap.Contains(SOL);
|
|
||||||
if ( !found ) {
|
|
||||||
myPClassifier = new BRepClass3d_SolidClassifier(SOL);
|
|
||||||
myClassifierMap.Add(SOL, myPClassifier);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myPClassifier = myClassifierMap.ChangeFromKey(SOL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Classify
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
TopAbs_State BOP_SolidClassifier::Classify (const TopoDS_Solid& SOL,
|
|
||||||
const gp_Pnt& P,
|
|
||||||
const Standard_Real Tol)
|
|
||||||
{
|
|
||||||
myPClassifier = NULL;
|
|
||||||
myState = TopAbs_UNKNOWN;
|
|
||||||
|
|
||||||
LoadSolid(SOL);
|
|
||||||
|
|
||||||
if (myPClassifier == NULL) {
|
|
||||||
return myState;
|
|
||||||
}
|
|
||||||
|
|
||||||
myPClassifier->Perform(P,Tol);
|
|
||||||
myState = myPClassifier->State();
|
|
||||||
const TopoDS_Shape& fres = myPClassifier->Face();
|
|
||||||
if (fres.IsNull()) {
|
|
||||||
// NYI : in case of removal of EXTERNAL and INTERNAL faces by the
|
|
||||||
// classifier BRepClass3d_SolidClassifier, process these faces
|
|
||||||
// to generate state ON/Solid when the point is IN/face INTERNAL or EXTERNAL
|
|
||||||
return myState;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopAbs_Orientation ofres;
|
|
||||||
|
|
||||||
ofres = fres.Orientation();
|
|
||||||
|
|
||||||
if ( ofres == TopAbs_EXTERNAL ) {
|
|
||||||
if ( myState == TopAbs_IN ) {
|
|
||||||
myState = TopAbs_OUT;
|
|
||||||
}
|
|
||||||
else if ( myState == TopAbs_OUT ){
|
|
||||||
myState = TopAbs_OUT;
|
|
||||||
}
|
|
||||||
else if ( myState == TopAbs_ON ){
|
|
||||||
myState = TopAbs_ON;
|
|
||||||
}
|
|
||||||
else if ( myState == TopAbs_UNKNOWN ){
|
|
||||||
myState = TopAbs_OUT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ( ofres == TopAbs_INTERNAL ) {
|
|
||||||
if ( myState == TopAbs_IN ) {
|
|
||||||
myState = TopAbs_IN;
|
|
||||||
}
|
|
||||||
else if ( myState == TopAbs_OUT) {
|
|
||||||
myState = TopAbs_IN;
|
|
||||||
}
|
|
||||||
else if ( myState == TopAbs_ON ) {
|
|
||||||
myState = TopAbs_ON;
|
|
||||||
}
|
|
||||||
else if ( myState == TopAbs_UNKNOWN ) {
|
|
||||||
myState = TopAbs_IN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return myState;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : LoadShell
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_SolidClassifier::LoadShell(const TopoDS_Shell& SHE)
|
|
||||||
{
|
|
||||||
Standard_Boolean found;
|
|
||||||
|
|
||||||
found = myClassifierMap.Contains (SHE);
|
|
||||||
|
|
||||||
if ( !found ) {
|
|
||||||
myBuilder.MakeSolid(mySolid);
|
|
||||||
myBuilder.Add(mySolid,SHE);
|
|
||||||
TopoDS_Shell* pshe = (TopoDS_Shell*)&SHE;
|
|
||||||
(*pshe).Free(Standard_True);
|
|
||||||
|
|
||||||
myPClassifier = new BRepClass3d_SolidClassifier(mySolid);
|
|
||||||
myClassifierMap.Add(SHE, myPClassifier);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myPClassifier = myClassifierMap.ChangeFromKey(SHE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Classify
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
TopAbs_State BOP_SolidClassifier::Classify (const TopoDS_Shell& SHE,
|
|
||||||
const gp_Pnt& P,
|
|
||||||
const Standard_Real Tol)
|
|
||||||
{
|
|
||||||
myPClassifier = NULL;
|
|
||||||
myState = TopAbs_UNKNOWN;
|
|
||||||
|
|
||||||
LoadShell(SHE);
|
|
||||||
//
|
|
||||||
if (myPClassifier == NULL) {
|
|
||||||
return myState;
|
|
||||||
}
|
|
||||||
|
|
||||||
myPClassifier->Perform(P,Tol);
|
|
||||||
myState = myPClassifier->State();
|
|
||||||
return myState;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : State
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
TopAbs_State BOP_SolidClassifier::State() const
|
|
||||||
{
|
|
||||||
return myState;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Destroy
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_SolidClassifier::Destroy()
|
|
||||||
{
|
|
||||||
Standard_Integer i, aNb;
|
|
||||||
|
|
||||||
aNb=myClassifierMap.Extent();
|
|
||||||
for (i=1; i<=aNb; ++i) {
|
|
||||||
BRepClass3d_SolidClassifier* pC=myClassifierMap(i);
|
|
||||||
delete pC;
|
|
||||||
}
|
|
||||||
myClassifierMap.Clear();
|
|
||||||
}
|
|
@ -1,114 +0,0 @@
|
|||||||
-- Created on: 2001-05-25
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 SolidSolid from BOP inherits ShellSolid from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- Performs Boolean Operations (BO)
|
|
||||||
--- Common,Cut,Fuse for solids as
|
|
||||||
--- arguments
|
|
||||||
---
|
|
||||||
uses
|
|
||||||
DSFiller from BOPTools,
|
|
||||||
|
|
||||||
WireEdgeSet from BOP,
|
|
||||||
ShellFaceSet from BOP,
|
|
||||||
|
|
||||||
HistoryCollector from BOP,
|
|
||||||
IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd,
|
|
||||||
DataMapOfShapeInteger from TopTools,
|
|
||||||
Shape from TopoDS,
|
|
||||||
Solid from TopoDS,
|
|
||||||
State from TopAbs,
|
|
||||||
|
|
||||||
ListOfShape from TopTools
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns SolidSolid from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
DoWithFiller (me:out;
|
|
||||||
aDSF: DSFiller from BOPTools)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- See base classes, please
|
|
||||||
---
|
|
||||||
Destroy (me: in out)
|
|
||||||
is redefined;
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_SolidSolid(){Destroy();}"
|
|
||||||
---Purpose:
|
|
||||||
--- Destructor
|
|
||||||
---
|
|
||||||
DoNewFaces(me: out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- See base classes, please
|
|
||||||
---
|
|
||||||
BuildResult (me: out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- See base classes, please
|
|
||||||
---
|
|
||||||
|
|
||||||
SetHistoryCollector(me: in out; theHistory: HistoryCollector from BOP)
|
|
||||||
is redefined virtual;
|
|
||||||
|
|
||||||
---
|
|
||||||
--- P r i v a t e b l o c k
|
|
||||||
---
|
|
||||||
PrepareSFS (me:out;
|
|
||||||
aFaces: ListOfShape from TopTools;
|
|
||||||
aSFS : out ShellFaceSet from BOP)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
PrepareFaceSplits(me: out)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
PropagateFaceStateByEdges(me: in out; theFace: Shape from TopoDS;
|
|
||||||
theMapOfEdgeIndex: DataMapOfShapeInteger from TopTools;
|
|
||||||
theState: out State from TopAbs)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is private;
|
|
||||||
|
|
||||||
ComputeStateByInsidePoints(me: in out; theFaceIndex: Integer from Standard;
|
|
||||||
theBaseFaceIndex: Integer from Standard;
|
|
||||||
theFaceRank: Integer from Standard;
|
|
||||||
theFFMap: IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd;
|
|
||||||
theState: out State from TopAbs)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is private;
|
|
||||||
|
|
||||||
TakeOnSplit(me; theFaceIndex: Integer from Standard;
|
|
||||||
theBaseFaceIndex: Integer from Standard)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is private;
|
|
||||||
|
|
||||||
PrepareReferences(me:out)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
fields
|
|
||||||
myRefObject: Solid from TopoDS is protected;
|
|
||||||
myRefTool : Solid from TopoDS is protected;
|
|
||||||
|
|
||||||
end SolidSolid;
|
|
File diff suppressed because it is too large
Load Diff
@ -1,43 +0,0 @@
|
|||||||
-- Created on: 2003-03-20
|
|
||||||
-- Created by: Michael KLOKOV
|
|
||||||
-- Copyright (c) 2003-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 SolidSolidHistoryCollector from BOP
|
|
||||||
inherits HistoryCollector from BOP
|
|
||||||
|
|
||||||
uses
|
|
||||||
Shape from TopoDS,
|
|
||||||
Operation from BOP,
|
|
||||||
PDSFiller from BOPTools,
|
|
||||||
ListOfShape from TopTools
|
|
||||||
is
|
|
||||||
Create(theShape1 : Shape from TopoDS;
|
|
||||||
theShape2 : Shape from TopoDS;
|
|
||||||
theOperation: Operation from BOP)
|
|
||||||
returns SolidSolidHistoryCollector from BOP;
|
|
||||||
|
|
||||||
AddNewShape(me: mutable; theOldShape: Shape from TopoDS;
|
|
||||||
theNewShape: Shape from TopoDS;
|
|
||||||
theDSFiller: PDSFiller from BOPTools);
|
|
||||||
|
|
||||||
SetResult(me: mutable; theResult: Shape from TopoDS;
|
|
||||||
theDSFiller: PDSFiller from BOPTools)
|
|
||||||
is redefined virtual;
|
|
||||||
|
|
||||||
end SolidSolidHistoryCollector from BOP;
|
|
@ -1,144 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
#include <BOP_SolidSolidHistoryCollector.ixx>
|
|
||||||
|
|
||||||
#include <TopAbs.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
#include <BooleanOperations_IndexedDataMapOfShapeInteger.hxx>
|
|
||||||
#include <BOPTools_SSInterference.hxx>
|
|
||||||
#include <BOPTools_InterferencePool.hxx>
|
|
||||||
#include <BOPTools_CArray1OfSSInterference.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_Curve.hxx>
|
|
||||||
#include <BOPTools_PaveBlock.hxx>
|
|
||||||
#include <BOPTools_DSFiller.hxx>
|
|
||||||
#include <BOPTools_PaveFiller.hxx>
|
|
||||||
#include <BOPTools_CommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListOfCommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPave.hxx>
|
|
||||||
#include <BOP_BuilderTools.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
|
||||||
|
|
||||||
// ======================================================================================================
|
|
||||||
// function: Constructor
|
|
||||||
// purpose:
|
|
||||||
// ======================================================================================================
|
|
||||||
BOP_SolidSolidHistoryCollector::BOP_SolidSolidHistoryCollector(const TopoDS_Shape& theShape1,
|
|
||||||
const TopoDS_Shape& theShape2,
|
|
||||||
const BOP_Operation theOperation):
|
|
||||||
BOP_HistoryCollector(theShape1, theShape2, theOperation)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ======================================================================================================
|
|
||||||
// function: AddNewShape
|
|
||||||
// purpose:
|
|
||||||
// warning: Treats only faces
|
|
||||||
// ======================================================================================================
|
|
||||||
void BOP_SolidSolidHistoryCollector::AddNewShape(const TopoDS_Shape& theOldShape,
|
|
||||||
const TopoDS_Shape& theNewShape,
|
|
||||||
const BOPTools_PDSFiller& theDSFiller)
|
|
||||||
{
|
|
||||||
if(theOldShape.ShapeType() != theNewShape.ShapeType())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(theOldShape.ShapeType() != TopAbs_FACE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Standard_Integer iRank = 0;
|
|
||||||
const BooleanOperations_IndexedDataMapOfShapeInteger& aMap1 =
|
|
||||||
theDSFiller->DS().ShapeIndexMap(1);
|
|
||||||
|
|
||||||
const BooleanOperations_IndexedDataMapOfShapeInteger& aMap2 =
|
|
||||||
theDSFiller->DS().ShapeIndexMap(2);
|
|
||||||
|
|
||||||
if(aMap1.Contains(theOldShape))
|
|
||||||
iRank = 1;
|
|
||||||
else {
|
|
||||||
if(aMap2.Contains(theOldShape))
|
|
||||||
iRank = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(iRank == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TopTools_DataMapOfShapeListOfShape& aHistoryMap = myModifMap;
|
|
||||||
|
|
||||||
if(aHistoryMap.IsBound(theOldShape)) {
|
|
||||||
aHistoryMap.ChangeFind(theOldShape).Append(theNewShape);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape aShapeList;
|
|
||||||
aShapeList.Append(theNewShape);
|
|
||||||
aHistoryMap.Bind(theOldShape, aShapeList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ======================================================================================================
|
|
||||||
// function: SetResult
|
|
||||||
// purpose:
|
|
||||||
// ======================================================================================================
|
|
||||||
void BOP_SolidSolidHistoryCollector::SetResult(const TopoDS_Shape& theResult,
|
|
||||||
const BOPTools_PDSFiller& theDSFiller)
|
|
||||||
{
|
|
||||||
myResult = theResult;
|
|
||||||
myHasDeleted = Standard_False;
|
|
||||||
|
|
||||||
TopAbs_ShapeEnum aType = TopAbs_FACE;
|
|
||||||
TopTools_IndexedMapOfShape aMap;
|
|
||||||
TopExp::MapShapes(myResult, aType, aMap);
|
|
||||||
|
|
||||||
TopExp_Explorer anExpObj(myS1, aType);
|
|
||||||
|
|
||||||
for(; anExpObj.More(); anExpObj.Next()) {
|
|
||||||
const TopoDS_Shape& aS = anExpObj.Current();
|
|
||||||
|
|
||||||
if(!aMap.Contains(aS)) {
|
|
||||||
|
|
||||||
if(!myModifMap.IsBound(aS) || myModifMap(aS).IsEmpty()) {
|
|
||||||
|
|
||||||
if(!myGenMap.IsBound(aS) || myGenMap(aS).IsEmpty()) {
|
|
||||||
myHasDeleted = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!myHasDeleted) {
|
|
||||||
TopExp_Explorer anExpTool(myS2, aType);
|
|
||||||
|
|
||||||
for(; anExpTool.More(); anExpTool.Next()) {
|
|
||||||
const TopoDS_Shape& aS = anExpTool.Current();
|
|
||||||
|
|
||||||
if(!aMap.Contains(aS)) {
|
|
||||||
if(!myModifMap.IsBound(aS) || myModifMap(aS).IsEmpty()) {
|
|
||||||
|
|
||||||
if(!myGenMap.IsBound(aS) || myGenMap(aS).IsEmpty()) {
|
|
||||||
myHasDeleted = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,993 +0,0 @@
|
|||||||
// Created on: 2004-06-29
|
|
||||||
// Created by: Mikhail KLOKOV
|
|
||||||
// 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 <BOP_SolidSolid.ixx>
|
|
||||||
|
|
||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
|
||||||
#include <TColStd_MapOfInteger.hxx>
|
|
||||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
|
||||||
#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
|
|
||||||
|
|
||||||
#include <gp_Dir.hxx>
|
|
||||||
#include <gp_Vec.hxx>
|
|
||||||
|
|
||||||
#include <Geom2d_Curve.hxx>
|
|
||||||
#include <Geom2d_TrimmedCurve.hxx>
|
|
||||||
#include <Geom2d_Line.hxx>
|
|
||||||
#include <Geom_Surface.hxx>
|
|
||||||
#include <Geom2dHatch_Intersector.hxx>
|
|
||||||
#include <Geom2dHatch_Hatcher.hxx>
|
|
||||||
#include <Geom2dAdaptor_Curve.hxx>
|
|
||||||
#include <HatchGen_Domain.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
#include <TopoDS_Vertex.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
#include <TopoDS_Face.hxx>
|
|
||||||
#include <TopoDS_Wire.hxx>
|
|
||||||
#include <TopoDS_Shell.hxx>
|
|
||||||
#include <TopoDS_Solid.hxx>
|
|
||||||
#include <TopoDS_Compound.hxx>
|
|
||||||
#include <BRep_Builder.hxx>
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
//
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
#include <BRepTools.hxx>
|
|
||||||
#include <BRepClass3d_SolidClassifier.hxx>
|
|
||||||
|
|
||||||
#include <TopTools_DataMapOfShapeInteger.hxx>
|
|
||||||
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
#include <BooleanOperations_StateOfShape.hxx>
|
|
||||||
#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
|
|
||||||
#include <BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger.hxx>
|
|
||||||
|
|
||||||
#include <IntTools_Tools.hxx>
|
|
||||||
#include <IntTools_Context.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_SSInterference.hxx>
|
|
||||||
#include <BOPTools_InterferencePool.hxx>
|
|
||||||
#include <BOPTools_CArray1OfSSInterference.hxx>
|
|
||||||
#include <BOPTools_PaveFiller.hxx>
|
|
||||||
#include <BOPTools_DSFiller.hxx>
|
|
||||||
#include <BOPTools_PaveBlock.hxx>
|
|
||||||
#include <BOPTools_CommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
|
|
||||||
#include <BOPTools_Curve.hxx>
|
|
||||||
#include <BOPTools_Tools2D.hxx>
|
|
||||||
#include <BOPTools_Tools3D.hxx>
|
|
||||||
#include <BOPTools_StateFiller.hxx>
|
|
||||||
|
|
||||||
#include <BOP_BuilderTools.hxx>
|
|
||||||
|
|
||||||
static
|
|
||||||
Standard_Integer GetIndex(const TopoDS_Shape& theShape,
|
|
||||||
const BooleanOperations_ShapesDataStructure& theDS);
|
|
||||||
|
|
||||||
static
|
|
||||||
void GetAttachedFaces(const Standard_Integer theEdgeIndex,
|
|
||||||
const Standard_Integer theFaceIndex,
|
|
||||||
const BOPTools_DSFiller& theDSFiller,
|
|
||||||
TColStd_ListOfInteger& theListOfFaces);
|
|
||||||
|
|
||||||
static
|
|
||||||
void GetStatesOfAdjacentFaces(const TColStd_ListOfInteger& theListOfFacesToCheck,
|
|
||||||
const BOPTools_DSFiller& theDSFiller,
|
|
||||||
TColStd_MapOfInteger& theMapOfUsedIndices,
|
|
||||||
Standard_Boolean& bFoundINOUT,
|
|
||||||
Standard_Boolean& bFoundININ,
|
|
||||||
Standard_Boolean& bFoundOUTOUT);
|
|
||||||
|
|
||||||
static
|
|
||||||
Standard_Boolean ComputeStateForAnalyticalSurfaces
|
|
||||||
(const Standard_Integer theFaceIndex,
|
|
||||||
const Standard_Integer theBaseFaceIndex,
|
|
||||||
const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& theFFMap,
|
|
||||||
const BOPTools_DSFiller& theDSFiller,
|
|
||||||
TopAbs_State& theState);
|
|
||||||
|
|
||||||
static
|
|
||||||
Standard_Boolean IsEdgeValidForFace(const Standard_Integer theEdgeIndex,
|
|
||||||
const Standard_Integer theFaceIndex,
|
|
||||||
BOPTools_SSInterference& theFF,
|
|
||||||
const BOPTools_DSFiller& theDSFiller);
|
|
||||||
|
|
||||||
static
|
|
||||||
TopAbs_State ComputeState(const TopoDS_Face& theF,
|
|
||||||
const TopoDS_Solid& theRef,
|
|
||||||
const Standard_Real theTol,
|
|
||||||
const Handle(IntTools_Context)& theCtx);
|
|
||||||
|
|
||||||
static
|
|
||||||
Standard_Integer PntInFace(const TopoDS_Face& aF,
|
|
||||||
gp_Pnt& theP,
|
|
||||||
gp_Pnt2d& theP2D);
|
|
||||||
|
|
||||||
static
|
|
||||||
Standard_Integer PntHoverFace(const TopoDS_Face& aF,
|
|
||||||
gp_Pnt& theP);
|
|
||||||
|
|
||||||
static
|
|
||||||
TopAbs_State ComputeState(const gp_Pnt& theP,
|
|
||||||
const TopoDS_Solid& theRef,
|
|
||||||
const Standard_Real theTol,
|
|
||||||
const Handle(IntTools_Context)& theCtx);
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function: PrepareFaceSplits
|
|
||||||
// purpose:
|
|
||||||
//=================================================================================
|
|
||||||
void BOP_SolidSolid::PrepareFaceSplits()
|
|
||||||
{
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS = myDSFiller->DS();
|
|
||||||
BooleanOperations_ShapesDataStructure* pDS = (BooleanOperations_ShapesDataStructure*)&aDS;
|
|
||||||
BOPTools_InterferencePool* pIntrPool = (BOPTools_InterferencePool*)&myDSFiller->InterfPool();
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs = pIntrPool->SSInterferences();
|
|
||||||
|
|
||||||
Standard_Integer i, aNb, nF1, iRank;
|
|
||||||
BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aFFMap;
|
|
||||||
BOP_BuilderTools::DoMap(aFFs, aFFMap);
|
|
||||||
TopTools_ListOfShape aListOfNewFaces;
|
|
||||||
TopAbs_Orientation anOriF1 = TopAbs_FORWARD;
|
|
||||||
|
|
||||||
TColStd_DataMapOfIntegerListOfInteger& aMapOfFaceSplits = myDSFiller->ChangeSplitFacePool();
|
|
||||||
|
|
||||||
aNb=aFFMap.Extent();
|
|
||||||
|
|
||||||
for (i=1; i<=aNb; i++) {
|
|
||||||
//
|
|
||||||
|
|
||||||
nF1 = aFFMap.FindKey(i);
|
|
||||||
TopoDS_Face aF1 = TopoDS::Face(aDS.Shape(nF1));
|
|
||||||
|
|
||||||
anOriF1 = aF1.Orientation();
|
|
||||||
iRank = aDS.Rank(nF1);
|
|
||||||
|
|
||||||
TopTools_DataMapOfShapeInteger aMapOfEdgeIndex;
|
|
||||||
TopTools_ListOfShape aListOfSplits;
|
|
||||||
|
|
||||||
if(SplitFace(nF1, aMapOfEdgeIndex, aListOfSplits)) {
|
|
||||||
|
|
||||||
DoInternalVertices(nF1, aListOfSplits);
|
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape aFaceIt(aListOfSplits);
|
|
||||||
|
|
||||||
for(; aFaceIt.More(); aFaceIt.Next()) {
|
|
||||||
TopoDS_Shape aShapeF = aFaceIt.Value();
|
|
||||||
BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
|
|
||||||
pDS->InsertShapeAndAncestorsSuccessors(aShapeF, anASSeq);
|
|
||||||
//
|
|
||||||
Standard_Integer aNewFaceIndex = pDS->NumberOfInsertedShapes();
|
|
||||||
//
|
|
||||||
pDS->SetState(aNewFaceIndex, BooleanOperations_ON);
|
|
||||||
|
|
||||||
if(!aMapOfFaceSplits.IsBound(nF1)) {
|
|
||||||
TColStd_ListOfInteger thelist;
|
|
||||||
aMapOfFaceSplits.Bind(nF1, thelist);
|
|
||||||
}
|
|
||||||
aMapOfFaceSplits.ChangeFind(nF1).Append(aNewFaceIndex);
|
|
||||||
|
|
||||||
TopAbs_State aState = TopAbs_ON;
|
|
||||||
Standard_Boolean bFoundFaceState = Standard_False;
|
|
||||||
|
|
||||||
if(PropagateFaceStateByEdges(aShapeF, aMapOfEdgeIndex, aState)) {
|
|
||||||
|
|
||||||
if(aState != TopAbs_ON) { // can not determine correctly ON state
|
|
||||||
BooleanOperations_StateOfShape aConvertedState = BOPTools_StateFiller::ConvertState(aState);
|
|
||||||
|
|
||||||
pDS->SetState(aNewFaceIndex, aConvertedState);
|
|
||||||
|
|
||||||
bFoundFaceState = Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!bFoundFaceState) {
|
|
||||||
//
|
|
||||||
if(ComputeStateByInsidePoints(aNewFaceIndex, nF1, iRank, aFFMap, aState)) {
|
|
||||||
|
|
||||||
if(aState != TopAbs_ON) {
|
|
||||||
BooleanOperations_StateOfShape aConvertedState = BOPTools_StateFiller::ConvertState(aState);
|
|
||||||
|
|
||||||
pDS->SetState(aNewFaceIndex, aConvertedState);
|
|
||||||
}
|
|
||||||
bFoundFaceState = Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!bFoundFaceState) {
|
|
||||||
|
|
||||||
if(ComputeStateForAnalyticalSurfaces(aNewFaceIndex, nF1, aFFMap, *myDSFiller, aState)) {
|
|
||||||
if(aState != TopAbs_ON) {
|
|
||||||
BooleanOperations_StateOfShape aConvertedState = BOPTools_StateFiller::ConvertState(aState);
|
|
||||||
|
|
||||||
pDS->SetState(aNewFaceIndex, aConvertedState);
|
|
||||||
bFoundFaceState = Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// end for
|
|
||||||
}
|
|
||||||
|
|
||||||
// =====================================================================================================================
|
|
||||||
// function: PropagateFaceStateByEdges
|
|
||||||
// purpose:
|
|
||||||
// =====================================================================================================================
|
|
||||||
Standard_Boolean BOP_SolidSolid::PropagateFaceStateByEdges(const TopoDS_Shape& theFace,
|
|
||||||
const TopTools_DataMapOfShapeInteger& theMapOfEdgeIndex,
|
|
||||||
TopAbs_State& theState)
|
|
||||||
{
|
|
||||||
TopAbs_State aState = TopAbs_UNKNOWN;
|
|
||||||
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS = myDSFiller->DS();
|
|
||||||
|
|
||||||
if(theFace.IsNull() || (theFace.ShapeType() != TopAbs_FACE))
|
|
||||||
return Standard_False;
|
|
||||||
TopoDS_Face aF1 = TopoDS::Face(theFace);
|
|
||||||
|
|
||||||
Standard_Boolean bFoundNotON = Standard_False;
|
|
||||||
BooleanOperations_StateOfShape aFoundState = BooleanOperations_ON;
|
|
||||||
Standard_Boolean bIsINOUT = Standard_False;
|
|
||||||
|
|
||||||
TopExp_Explorer anExpE(aF1, TopAbs_EDGE);
|
|
||||||
|
|
||||||
for(; anExpE.More(); anExpE.Next()) {
|
|
||||||
const TopoDS_Shape& anEdge = anExpE.Current();
|
|
||||||
|
|
||||||
Standard_Integer nE = 0;
|
|
||||||
|
|
||||||
if(theMapOfEdgeIndex.IsBound(anEdge)) {
|
|
||||||
nE = theMapOfEdgeIndex(anEdge);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
nE = aDS.ShapeIndex(anEdge, 1);
|
|
||||||
nE = (nE == 0) ? aDS.ShapeIndex(anEdge, 2) : nE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nE == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
BooleanOperations_StateOfShape anEdgeState = aDS.GetState(nE);
|
|
||||||
|
|
||||||
if((anEdgeState == BooleanOperations_IN) ||
|
|
||||||
(anEdgeState == BooleanOperations_OUT)) {
|
|
||||||
|
|
||||||
if(!bFoundNotON) {
|
|
||||||
bFoundNotON = Standard_True;
|
|
||||||
aFoundState = anEdgeState;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(aFoundState != anEdgeState) {
|
|
||||||
bIsINOUT = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!bIsINOUT && bFoundNotON) {
|
|
||||||
if(aFoundState == BooleanOperations_IN)
|
|
||||||
aState = TopAbs_IN;
|
|
||||||
else if(aFoundState == BooleanOperations_OUT)
|
|
||||||
aState = TopAbs_OUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(aState == TopAbs_UNKNOWN)
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
theState = aState;
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ComputeStateByInsidePoints
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_SolidSolid::
|
|
||||||
ComputeStateByInsidePoints(const Standard_Integer theFaceIndex,
|
|
||||||
const Standard_Integer theBaseFaceIndex,
|
|
||||||
const Standard_Integer theFaceRank,
|
|
||||||
const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& theFFMap,
|
|
||||||
TopAbs_State& theState)
|
|
||||||
|
|
||||||
{
|
|
||||||
TopAbs_State aState = TopAbs_ON;
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS = myDSFiller->DS();
|
|
||||||
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
|
|
||||||
const BOPTools_PaveFiller& aPaveFiller = myDSFiller->PaveFiller();
|
|
||||||
BOPTools_PaveFiller* pPaveFiller = (BOPTools_PaveFiller*)&aPaveFiller;
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
|
|
||||||
|
|
||||||
if(theFaceIndex == 0)
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
const TopoDS_Shape& aS = aDS.Shape(theFaceIndex);
|
|
||||||
|
|
||||||
if(aS.IsNull())
|
|
||||||
return Standard_False;
|
|
||||||
TopoDS_Face aFace = TopoDS::Face(aS);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
Standard_Integer i = 0, j = 0, aNb = 0;
|
|
||||||
aNb = theFFMap.Extent();
|
|
||||||
|
|
||||||
for (i=1; i<=aNb; i++) {
|
|
||||||
//
|
|
||||||
Standard_Integer nF1 = theFFMap.FindKey(i);
|
|
||||||
|
|
||||||
if(nF1 != theBaseFaceIndex)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const TColStd_IndexedMapOfInteger& aFFIndicesMap=theFFMap.FindFromIndex(i);
|
|
||||||
Standard_Integer aNbj = aFFIndicesMap.Extent();
|
|
||||||
|
|
||||||
for (j=1; j<=aNbj; j++) {
|
|
||||||
Standard_Integer iFF = aFFIndicesMap(j);
|
|
||||||
BOPTools_SSInterference& aFF = aFFs(iFF);
|
|
||||||
Standard_Boolean bIsTouchCase = aFF.IsTangentFaces();
|
|
||||||
|
|
||||||
if (bIsTouchCase) {
|
|
||||||
Standard_Integer nF2 = aFF.OppositeIndex(nF1);
|
|
||||||
const TopoDS_Face& aF2 = TopoDS::Face(aDS.Shape(nF2));
|
|
||||||
|
|
||||||
if(BOPTools_Tools3D::CheckSameDomainFaceInside(aFace, aF2, pPaveFiller->Context())) {
|
|
||||||
theState = TopAbs_ON;
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const TopoDS_Shape& aTool = (theFaceRank == 1) ? aDS.Tool() : aDS.Object();
|
|
||||||
TopoDS_Solid aRefSolid;
|
|
||||||
|
|
||||||
if(aTool.ShapeType() == TopAbs_SOLID)
|
|
||||||
aRefSolid = TopoDS::Solid(aTool);
|
|
||||||
else {
|
|
||||||
BRep_Builder aBB;
|
|
||||||
aBB.MakeSolid(aRefSolid);
|
|
||||||
|
|
||||||
TopExp_Explorer anExpSH(aTool, TopAbs_SHELL);
|
|
||||||
|
|
||||||
for(; anExpSH.More(); anExpSH.Next()) {
|
|
||||||
TopoDS_Shape aShell = anExpSH.Current();
|
|
||||||
aBB.Add(aShell, aRefSolid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!BOPTools_Tools3D::ComputeFaceState(aFace, aRefSolid, pPaveFiller->Context(), aState)) {
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
theState = aState;
|
|
||||||
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : TakeOnSplit
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_SolidSolid::TakeOnSplit(const Standard_Integer theFaceIndex,
|
|
||||||
const Standard_Integer theBaseFaceIndex) const
|
|
||||||
{
|
|
||||||
Standard_Boolean bTake = Standard_False;
|
|
||||||
|
|
||||||
Standard_Boolean binout = Standard_False;
|
|
||||||
Standard_Boolean binin = Standard_False;
|
|
||||||
Standard_Boolean boutout = Standard_False;
|
|
||||||
|
|
||||||
TColStd_MapOfInteger aMapOfUsedIndices;
|
|
||||||
TColStd_ListOfInteger aListOfFacesToCheck;
|
|
||||||
aListOfFacesToCheck.Append(theFaceIndex);
|
|
||||||
//DEB
|
|
||||||
Handle(IntTools_Context) aCtx;
|
|
||||||
TopAbs_Orientation aOrF1;
|
|
||||||
TopoDS_Face aF1, aFSp;
|
|
||||||
//
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
const BOPTools_PaveFiller& aPF =myDSFiller->PaveFiller();
|
|
||||||
BOPTools_PaveFiller* pPF = (BOPTools_PaveFiller*)&aPF;
|
|
||||||
aCtx=pPF->Context();
|
|
||||||
//
|
|
||||||
aF1=TopoDS::Face(aDS.Shape(theBaseFaceIndex));
|
|
||||||
aOrF1=aF1.Orientation();
|
|
||||||
aFSp=TopoDS::Face(aDS.Shape(theFaceIndex));
|
|
||||||
aFSp.Orientation(aOrF1);
|
|
||||||
//
|
|
||||||
GetStatesOfAdjacentFaces(aListOfFacesToCheck,
|
|
||||||
*myDSFiller,
|
|
||||||
aMapOfUsedIndices,
|
|
||||||
binout, binin, boutout);
|
|
||||||
|
|
||||||
//zzf
|
|
||||||
if (!binout && !binin && !boutout) {
|
|
||||||
Standard_Real aTol;
|
|
||||||
TopAbs_State aState;
|
|
||||||
//
|
|
||||||
aTol=1.e-5;
|
|
||||||
aState=ComputeState(aFSp, myRefTool, aTol, aCtx);
|
|
||||||
//
|
|
||||||
if (aState==TopAbs_IN) {
|
|
||||||
if (myOperation==BOP_FUSE || myOperation==BOP_COMMON) {
|
|
||||||
bTake=Standard_False;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bTake=Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
else if (aState==TopAbs_OUT) {
|
|
||||||
if (myOperation==BOP_FUSE || myOperation==BOP_COMMON) {
|
|
||||||
bTake=Standard_True;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bTake=Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
return bTake;
|
|
||||||
}//if (!binout && !binin && !boutout) {
|
|
||||||
//zzt
|
|
||||||
switch(myOperation) {
|
|
||||||
case BOP_FUSE: {
|
|
||||||
if(binout || (!binin && !boutout)) {
|
|
||||||
bTake = Standard_True;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case BOP_COMMON: {
|
|
||||||
if(binout || (!binin && !boutout)) {
|
|
||||||
bTake = Standard_True;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case BOP_CUT: {
|
|
||||||
if((binin || boutout) && !binout) {
|
|
||||||
bTake = Standard_True;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case BOP_CUT21: {
|
|
||||||
if((binin || boutout) && !binout) {
|
|
||||||
bTake = Standard_True;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bTake;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------
|
|
||||||
// static function: GetIndex
|
|
||||||
// purpose:
|
|
||||||
// ------------------------------------------------------------------------------------
|
|
||||||
Standard_Integer GetIndex(const TopoDS_Shape& theShape,
|
|
||||||
const BooleanOperations_ShapesDataStructure& theDS)
|
|
||||||
{
|
|
||||||
Standard_Integer anIndex = 0, i = 0;
|
|
||||||
|
|
||||||
anIndex = theDS.ShapeIndex(theShape, 1);
|
|
||||||
anIndex = (anIndex == 0) ? theDS.ShapeIndex(theShape, 2) : anIndex;
|
|
||||||
|
|
||||||
if(anIndex == 0) {
|
|
||||||
|
|
||||||
for (i = theDS.NumberOfSourceShapes() + 1; i <= theDS.NumberOfInsertedShapes(); i++) {
|
|
||||||
if(theShape.IsSame(theDS.Shape(i))) {
|
|
||||||
anIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return anIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------
|
|
||||||
// static function: GetAttachedFaces
|
|
||||||
// purpose:
|
|
||||||
// ------------------------------------------------------------------------------------
|
|
||||||
void GetAttachedFaces(const Standard_Integer theEdgeIndex,
|
|
||||||
const Standard_Integer theFaceIndex,
|
|
||||||
const BOPTools_DSFiller& theDSFiller,
|
|
||||||
TColStd_ListOfInteger& theListOfFaces)
|
|
||||||
{
|
|
||||||
theListOfFaces.Clear();
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
|
|
||||||
const TColStd_DataMapOfIntegerListOfInteger& aMap = theDSFiller.SplitFacePool();
|
|
||||||
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
|
|
||||||
for(i = 1; i <= aDS.NumberOfInsertedShapes(); i++) {
|
|
||||||
|
|
||||||
if(aDS.GetShapeType(i) == TopAbs_FACE) {
|
|
||||||
TColStd_ListOfInteger aListOfFaceIndex;
|
|
||||||
|
|
||||||
if(!aMap.IsBound(i)) {
|
|
||||||
if(theFaceIndex == i)
|
|
||||||
continue;
|
|
||||||
aListOfFaceIndex.Append(i);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TColStd_ListIteratorOfListOfInteger anIttmp(aMap.Find(i));
|
|
||||||
|
|
||||||
for(; anIttmp.More(); anIttmp.Next()) {
|
|
||||||
if(theFaceIndex == anIttmp.Value())
|
|
||||||
continue;
|
|
||||||
aListOfFaceIndex.Append(anIttmp.Value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TColStd_ListIteratorOfListOfInteger anIt(aListOfFaceIndex);
|
|
||||||
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
if(anIt.Value() <= 0)
|
|
||||||
continue;
|
|
||||||
const TopoDS_Shape& aFace = aDS.Shape(anIt.Value());
|
|
||||||
TopExp_Explorer anExpE(aFace, TopAbs_EDGE);
|
|
||||||
|
|
||||||
for(; anExpE.More(); anExpE.Next()) {
|
|
||||||
const TopoDS_Shape& anEdge = anExpE.Current();
|
|
||||||
Standard_Integer nE = GetIndex(anEdge, aDS);
|
|
||||||
|
|
||||||
if(theEdgeIndex == nE) {
|
|
||||||
theListOfFaces.Append(anIt.Value());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetStatesOfAdjacentFaces
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void GetStatesOfAdjacentFaces(const TColStd_ListOfInteger& theListOfFacesToCheck,
|
|
||||||
const BOPTools_DSFiller& theDSFiller,
|
|
||||||
TColStd_MapOfInteger& theMapOfUsedIndices,
|
|
||||||
Standard_Boolean& bFoundINOUT,
|
|
||||||
Standard_Boolean& bFoundININ,
|
|
||||||
Standard_Boolean& bFoundOUTOUT)
|
|
||||||
{
|
|
||||||
TColStd_ListOfInteger aLisOfON;
|
|
||||||
Standard_Integer nE, nF, nFa;
|
|
||||||
BooleanOperations_StateOfShape aStFa;
|
|
||||||
//
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
|
|
||||||
//
|
|
||||||
TColStd_ListIteratorOfListOfInteger anItF(theListOfFacesToCheck);
|
|
||||||
for(; anItF.More(); anItF.Next()) {
|
|
||||||
nF = anItF.Value();
|
|
||||||
const TopoDS_Shape& aF=aDS.Shape(nF);
|
|
||||||
|
|
||||||
if(theMapOfUsedIndices.Contains(nF)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
theMapOfUsedIndices.Add(nF);
|
|
||||||
|
|
||||||
TopoDS_Shape aFace = aDS.Shape(nF);
|
|
||||||
|
|
||||||
TopExp_Explorer anExpE(aFace, TopAbs_EDGE);
|
|
||||||
|
|
||||||
for(; anExpE.More(); anExpE.Next()) {
|
|
||||||
const TopoDS_Shape& anEdge = anExpE.Current();
|
|
||||||
nE = GetIndex(anEdge, aDS);
|
|
||||||
|
|
||||||
if(nE <= 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(theMapOfUsedIndices.Contains(nE)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
theMapOfUsedIndices.Add(nE);
|
|
||||||
TColStd_ListOfInteger aListOfFaces, aListOfIN, aListOfOUT;
|
|
||||||
GetAttachedFaces(nE, nF, theDSFiller, aListOfFaces);
|
|
||||||
|
|
||||||
TColStd_ListIteratorOfListOfInteger anIt(aListOfFaces);
|
|
||||||
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
nFa=anIt.Value();
|
|
||||||
aStFa=aDS.GetState(nFa);
|
|
||||||
//
|
|
||||||
const TopoDS_Shape& aFa=aDS.Shape(nFa);
|
|
||||||
if(theMapOfUsedIndices.Contains(nFa)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if(aStFa==BooleanOperations_ON) {
|
|
||||||
aLisOfON.Append(nFa);
|
|
||||||
}
|
|
||||||
if(aStFa==BooleanOperations_IN) {
|
|
||||||
aListOfIN.Append(nFa);
|
|
||||||
}
|
|
||||||
else if(aStFa==BooleanOperations_OUT) {
|
|
||||||
aListOfOUT.Append(nFa);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bFoundINOUT = bFoundINOUT || (!aListOfIN.IsEmpty() && !aListOfOUT.IsEmpty());
|
|
||||||
bFoundININ = bFoundININ || (!aListOfIN.IsEmpty() && aListOfOUT.IsEmpty());
|
|
||||||
bFoundOUTOUT = bFoundOUTOUT || (aListOfIN.IsEmpty() && !aListOfOUT.IsEmpty());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!aLisOfON.IsEmpty() && (theMapOfUsedIndices.Extent() <= aDS.NumberOfInsertedShapes())) {
|
|
||||||
GetStatesOfAdjacentFaces(aLisOfON, theDSFiller, theMapOfUsedIndices, bFoundINOUT, bFoundININ, bFoundOUTOUT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------
|
|
||||||
// static function: ComputeStateForAnalyticalSurfaces
|
|
||||||
// purpose:
|
|
||||||
// ------------------------------------------------------------------------------------
|
|
||||||
Standard_Boolean ComputeStateForAnalyticalSurfaces(const Standard_Integer theFaceIndex,
|
|
||||||
const Standard_Integer theBaseFaceIndex,
|
|
||||||
const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& theFFMap,
|
|
||||||
const BOPTools_DSFiller& theDSFiller,
|
|
||||||
TopAbs_State& theState)
|
|
||||||
{
|
|
||||||
TopAbs_State aState = TopAbs_ON;
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
|
|
||||||
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&theDSFiller.InterfPool();
|
|
||||||
const BOPTools_PaveFiller& aPaveFiller = theDSFiller.PaveFiller();
|
|
||||||
BOPTools_PaveFiller* pPaveFiller = (BOPTools_PaveFiller*)&aPaveFiller;
|
|
||||||
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
|
|
||||||
|
|
||||||
if(theFaceIndex == 0)
|
|
||||||
return Standard_False;
|
|
||||||
|
|
||||||
const TopoDS_Shape& aS = aDS.Shape(theFaceIndex);
|
|
||||||
|
|
||||||
if(aS.IsNull())
|
|
||||||
return Standard_False;
|
|
||||||
TopoDS_Face aFace = TopoDS::Face(aS);
|
|
||||||
|
|
||||||
Standard_Integer j = 0;
|
|
||||||
Standard_Boolean bFound = Standard_False;
|
|
||||||
|
|
||||||
if (theFFMap.Contains(theBaseFaceIndex)) {
|
|
||||||
//
|
|
||||||
Standard_Integer nF1 = theBaseFaceIndex;
|
|
||||||
|
|
||||||
const TColStd_IndexedMapOfInteger& aFFIndicesMap=theFFMap.FindFromKey(theBaseFaceIndex);
|
|
||||||
Standard_Integer aNbj = aFFIndicesMap.Extent();
|
|
||||||
|
|
||||||
for (j=1; (!bFound) && (j<=aNbj); j++) {
|
|
||||||
Standard_Integer iFF = aFFIndicesMap(j);
|
|
||||||
BOPTools_SSInterference& aFF = aFFs(iFF);
|
|
||||||
Standard_Boolean bIsTouchCase = aFF.IsTangentFaces();
|
|
||||||
|
|
||||||
if (!bIsTouchCase) {
|
|
||||||
Standard_Integer nF2 = aFF.OppositeIndex(nF1);
|
|
||||||
const TopoDS_Face& aF2 = TopoDS::Face(aDS.Shape(nF2));
|
|
||||||
//
|
|
||||||
TopExp_Explorer anExpE(aFace, TopAbs_EDGE);
|
|
||||||
|
|
||||||
for(; anExpE.More(); anExpE.Next()) {
|
|
||||||
TopoDS_Edge aSp = TopoDS::Edge(anExpE.Current());
|
|
||||||
|
|
||||||
Standard_Boolean bTestEdge = Standard_False;
|
|
||||||
|
|
||||||
Standard_Integer nE = GetIndex(aSp, aDS);
|
|
||||||
bTestEdge = IsEdgeValidForFace(nE, nF2, aFF, theDSFiller);
|
|
||||||
|
|
||||||
if(bTestEdge) {
|
|
||||||
TopAbs_State aStPF = TopAbs_ON;
|
|
||||||
|
|
||||||
Standard_Boolean bAnalytic = Standard_False;
|
|
||||||
Standard_Real aTolTangent, aTolR;
|
|
||||||
//
|
|
||||||
aTolTangent=0.002;
|
|
||||||
aTolR=0.0000001;
|
|
||||||
|
|
||||||
bAnalytic = BOPTools_Tools3D::TreatedAsAnalytic(aF2, aSp, aFace,
|
|
||||||
aTolTangent, aTolR,
|
|
||||||
aStPF, pPaveFiller->Context());
|
|
||||||
if(bAnalytic) {
|
|
||||||
aState = aStPF;
|
|
||||||
bFound = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
gp_Dir aDBF1, aDNF2;
|
|
||||||
|
|
||||||
BOPTools_Tools3D::GetBiNormal (aSp, aFace, aDBF1);
|
|
||||||
BOPTools_Tools3D::GetNormalToFaceOnEdge (aSp, aF2, aDNF2);
|
|
||||||
|
|
||||||
Standard_Real aTolScPr, aScPr;
|
|
||||||
|
|
||||||
aTolScPr=1.e-7;
|
|
||||||
aScPr=aDBF1*aDNF2;
|
|
||||||
|
|
||||||
if (fabs(aScPr) > aTolScPr) {
|
|
||||||
aStPF=TopAbs_OUT;
|
|
||||||
|
|
||||||
if (aScPr<0.) {
|
|
||||||
aStPF=TopAbs_IN;
|
|
||||||
}
|
|
||||||
aState = aStPF;
|
|
||||||
bFound = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// end if(bTestEdge)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!bFound) {
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
theState = aState;
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------
|
|
||||||
// static function: IsEdgeValidForFace
|
|
||||||
// purpose:
|
|
||||||
// ------------------------------------------------------------------------------------
|
|
||||||
Standard_Boolean IsEdgeValidForFace(const Standard_Integer theEdgeIndex,
|
|
||||||
const Standard_Integer theFaceIndex,
|
|
||||||
BOPTools_SSInterference& theFF,
|
|
||||||
const BOPTools_DSFiller& theDSFiller)
|
|
||||||
{
|
|
||||||
|
|
||||||
const BOPTools_PaveFiller& aPaveFiller = theDSFiller.PaveFiller();
|
|
||||||
BOPTools_PaveFiller* pPaveFiller = (BOPTools_PaveFiller*)&aPaveFiller;
|
|
||||||
BOPTools_CommonBlockPool& aCBPool = pPaveFiller->ChangeCommonBlockPool();
|
|
||||||
|
|
||||||
BOPTools_SequenceOfCurves& aSCvs=theFF.Curves();
|
|
||||||
Standard_Integer aNbCurves=aSCvs.Length();
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
|
|
||||||
for (i=1; i<=aNbCurves; i++) {
|
|
||||||
BOPTools_Curve& aBC=aSCvs(i);
|
|
||||||
const BOPTools_ListOfPaveBlock& aSectEdges=aBC.NewPaveBlocks();
|
|
||||||
|
|
||||||
BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSectEdges);
|
|
||||||
|
|
||||||
for (; aPBIt.More(); aPBIt.Next()) {
|
|
||||||
BOPTools_PaveBlock& aPB = aPBIt.Value();
|
|
||||||
|
|
||||||
if(theEdgeIndex == aPB.Edge())
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for(i = 1; i <= aCBPool.Length(); i++) {
|
|
||||||
const BOPTools_ListOfCommonBlock& aCBList = aCBPool.Value(i);
|
|
||||||
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aCBList);
|
|
||||||
|
|
||||||
for (; anItCB.More(); anItCB.Next()) {
|
|
||||||
BOPTools_CommonBlock& aCB=anItCB.Value();
|
|
||||||
Standard_Integer nFace = aCB.Face();
|
|
||||||
|
|
||||||
if(nFace == theFaceIndex) {
|
|
||||||
const BOPTools_PaveBlock& aPB1 = aCB.PaveBlock1();
|
|
||||||
const BOPTools_PaveBlock& aPB2 = aCB.PaveBlock2();
|
|
||||||
|
|
||||||
if((theEdgeIndex == aPB1.Edge()) ||
|
|
||||||
(theEdgeIndex == aPB2.Edge())) {
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: ComputeState
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
TopAbs_State ComputeState(const TopoDS_Face& theF,
|
|
||||||
const TopoDS_Solid& theRef,
|
|
||||||
const Standard_Real theTol,
|
|
||||||
const Handle(IntTools_Context)& theCtx)
|
|
||||||
{
|
|
||||||
Standard_Integer iErr;
|
|
||||||
TopAbs_State aRet;
|
|
||||||
gp_Pnt aP;
|
|
||||||
//
|
|
||||||
aRet=TopAbs_UNKNOWN;
|
|
||||||
//
|
|
||||||
iErr=PntHoverFace(theF, aP);
|
|
||||||
if (iErr) {
|
|
||||||
return aRet;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aRet=ComputeState(aP, theRef, theTol, theCtx);
|
|
||||||
return aRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: ComputeState
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
TopAbs_State ComputeState(const gp_Pnt& theP,
|
|
||||||
const TopoDS_Solid& theRef,
|
|
||||||
const Standard_Real theTol,
|
|
||||||
const Handle(IntTools_Context)& theCtx)
|
|
||||||
{
|
|
||||||
TopAbs_State aState;
|
|
||||||
//
|
|
||||||
BRepClass3d_SolidClassifier& aSC=theCtx->SolidClassifier(theRef);
|
|
||||||
aSC.Perform(theP, theTol);
|
|
||||||
//
|
|
||||||
aState=aSC.State();
|
|
||||||
//
|
|
||||||
return aState;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : PntHoverFace
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer PntHoverFace(const TopoDS_Face& aF,
|
|
||||||
gp_Pnt& theP)
|
|
||||||
{
|
|
||||||
Standard_Integer iErr;
|
|
||||||
Standard_Real aU, aV, aX;
|
|
||||||
gp_Pnt aP;
|
|
||||||
gp_Vec aDN;
|
|
||||||
gp_Pnt2d aP2D;
|
|
||||||
//
|
|
||||||
iErr=PntInFace(aF, aP, aP2D);
|
|
||||||
if (iErr) {
|
|
||||||
return iErr;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aX=1e-4;
|
|
||||||
//
|
|
||||||
aP2D.Coord(aU, aV);
|
|
||||||
BOPTools_Tools2D::FaceNormal(aF, aU, aV, aDN);
|
|
||||||
//
|
|
||||||
theP.SetXYZ(aP.XYZ()+aX*aDN.XYZ());
|
|
||||||
//
|
|
||||||
return iErr;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : PntInFace
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer PntInFace(const TopoDS_Face& aF,
|
|
||||||
gp_Pnt& theP,
|
|
||||||
gp_Pnt2d& theP2D)
|
|
||||||
{
|
|
||||||
Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
|
|
||||||
Standard_Integer iErr, aIx, aNbDomains, i;
|
|
||||||
Standard_Real aUMin, aUMax, aVMin, aVMax;
|
|
||||||
Standard_Real aVx, aUx, aV1, aV2, aU1, aU2, aEpsT;
|
|
||||||
Standard_Real aTolArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D;
|
|
||||||
gp_Dir2d aD2D (0., 1.);
|
|
||||||
gp_Pnt2d aP2D;
|
|
||||||
gp_Pnt aPx;
|
|
||||||
Handle(Geom2d_Curve) aC2D;
|
|
||||||
Handle(Geom2d_TrimmedCurve) aCT2D;
|
|
||||||
Handle(Geom2d_Line) aL2D;
|
|
||||||
Handle(Geom_Surface) aS;
|
|
||||||
TopAbs_Orientation aOrE;
|
|
||||||
TopoDS_Face aFF;
|
|
||||||
TopExp_Explorer aExp;
|
|
||||||
//
|
|
||||||
aTolHatch2D=1.e-8;
|
|
||||||
aTolHatch3D=1.e-8;
|
|
||||||
aTolArcIntr=1.e-10;
|
|
||||||
aTolTangfIntr=1.e-10;
|
|
||||||
//
|
|
||||||
Geom2dHatch_Intersector aIntr(aTolArcIntr, aTolTangfIntr);
|
|
||||||
Geom2dHatch_Hatcher aHatcher(aIntr,
|
|
||||||
aTolHatch2D, aTolHatch3D,
|
|
||||||
Standard_True, Standard_False);
|
|
||||||
//
|
|
||||||
iErr=0;
|
|
||||||
aEpsT=1.e-12;
|
|
||||||
//
|
|
||||||
aFF=aF;
|
|
||||||
aFF.Orientation (TopAbs_FORWARD);
|
|
||||||
//
|
|
||||||
aS=BRep_Tool::Surface(aFF);
|
|
||||||
BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
|
|
||||||
//
|
|
||||||
// 1
|
|
||||||
aExp.Init (aFF, TopAbs_EDGE);
|
|
||||||
for (; aExp.More() ; aExp.Next()) {
|
|
||||||
const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current());
|
|
||||||
aOrE=aE.Orientation();
|
|
||||||
//
|
|
||||||
aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2);
|
|
||||||
if (aC2D.IsNull() ) {
|
|
||||||
iErr=1;
|
|
||||||
return iErr;
|
|
||||||
}
|
|
||||||
if (fabs(aU1-aU2) < aEpsT) {
|
|
||||||
iErr=2;
|
|
||||||
return iErr;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2);
|
|
||||||
aHatcher.AddElement(aCT2D, aOrE);
|
|
||||||
}// for (; aExp.More() ; aExp.Next()) {
|
|
||||||
//
|
|
||||||
// 2
|
|
||||||
aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
|
|
||||||
aP2D.SetCoord(aUx, 0.);
|
|
||||||
aL2D=new Geom2d_Line (aP2D, aD2D);
|
|
||||||
Geom2dAdaptor_Curve aHCur(aL2D);
|
|
||||||
//
|
|
||||||
aIx=aHatcher.AddHatching(aHCur) ;
|
|
||||||
//
|
|
||||||
// 3.
|
|
||||||
aHatcher.Trim();
|
|
||||||
bIsDone=aHatcher.TrimDone(aIx);
|
|
||||||
if (!bIsDone) {
|
|
||||||
iErr=3;
|
|
||||||
return iErr;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aHatcher.ComputeDomains(aIx);
|
|
||||||
bIsDone=aHatcher.IsDone(aIx);
|
|
||||||
if (!bIsDone) {
|
|
||||||
iErr=4;
|
|
||||||
return iErr;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// 4.
|
|
||||||
aNbDomains=aHatcher.NbDomains(aIx);
|
|
||||||
for (i=1; i<=aNbDomains; ++i) {
|
|
||||||
const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
|
|
||||||
bHasFirstPoint=aDomain.HasFirstPoint();
|
|
||||||
if (!bHasFirstPoint) {
|
|
||||||
iErr=5;
|
|
||||||
return iErr;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aV1=aDomain.FirstPoint().Parameter();
|
|
||||||
//
|
|
||||||
bHasSecondPoint=aDomain.HasSecondPoint();
|
|
||||||
if (!bHasSecondPoint) {
|
|
||||||
iErr=6;
|
|
||||||
return iErr;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aV2=aDomain.SecondPoint().Parameter();
|
|
||||||
//
|
|
||||||
aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
|
|
||||||
//
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aS->D0(aUx, aVx, aPx);
|
|
||||||
//
|
|
||||||
theP2D.SetCoord(aUx, aVx);
|
|
||||||
theP=aPx;
|
|
||||||
//
|
|
||||||
return iErr;
|
|
||||||
}
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
|||||||
-- Created on: 2001-04-13
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 WESCorrector from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- The algorithm to change the Wire Edges Set (WES) contents.
|
|
||||||
-- The NewWES will contain only wires instead of wires and edges.
|
|
||||||
--
|
|
||||||
uses
|
|
||||||
WireEdgeSet from BOP,
|
|
||||||
PWireEdgeSet from BOP,
|
|
||||||
ListOfConnexityBlock from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns WESCorrector from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
SetWES (me:out;
|
|
||||||
aWES: WireEdgeSet from BOP);
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
Do (me:out);
|
|
||||||
---Purpose:
|
|
||||||
--- Performs the algorithm that consists of two steps
|
|
||||||
--- 1. Make conexity blocks ( DoConnexityBlocks() )
|
|
||||||
--- 2. Make corrections ( DoCorrections() )
|
|
||||||
---
|
|
||||||
DoConnexityBlocks(me:out)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
DoCorrections(me:out)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
IsDone(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
ErrorStatus (me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
--- contents see BOP_WESCorrector.cxx
|
|
||||||
---
|
|
||||||
WES (me:out)
|
|
||||||
returns WireEdgeSet from BOP;
|
|
||||||
---C++: return &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
NewWES (me:out)
|
|
||||||
returns WireEdgeSet from BOP;
|
|
||||||
---C++: return &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myWES : PWireEdgeSet from BOP;
|
|
||||||
myNewWES : WireEdgeSet from BOP;
|
|
||||||
myConnexityBlocks : ListOfConnexityBlock from BOP;
|
|
||||||
myIsDone : Boolean from Standard;
|
|
||||||
myErrorStatus : Integer from Standard;
|
|
||||||
|
|
||||||
end WESCorrector;
|
|
@ -1,258 +0,0 @@
|
|||||||
// Created on: 2001-04-13
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2001-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 <BOP_WESCorrector.ixx>
|
|
||||||
|
|
||||||
#include <TopTools_IndexedMapOfOrientedShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
#include <TopoDS_Wire.hxx>
|
|
||||||
#include <TopoDS_Face.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Builder.hxx>
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
|
|
||||||
#include <BOP_ConnexityBlock.hxx>
|
|
||||||
#include <BOP_ListIteratorOfListOfConnexityBlock.hxx>
|
|
||||||
#include <BOP_WireSplitter.hxx>
|
|
||||||
#include <BOPTColStd_ListOfListOfShape.hxx>
|
|
||||||
#include <BOPTColStd_ListIteratorOfListOfListOfShape.hxx>
|
|
||||||
|
|
||||||
static
|
|
||||||
void MakeWire(const TopTools_ListOfShape& aLE,
|
|
||||||
TopoDS_Wire& newWire);
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_WESCorrector::BOP_WESCorrector
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_WESCorrector::BOP_WESCorrector()
|
|
||||||
:
|
|
||||||
myIsDone(Standard_False),
|
|
||||||
myErrorStatus(1)
|
|
||||||
{}
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetWES
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WESCorrector::SetWES (const BOP_WireEdgeSet& aWES)
|
|
||||||
{
|
|
||||||
BOP_WireEdgeSet* pWES=(BOP_WireEdgeSet*) &aWES;
|
|
||||||
myWES=pWES;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: WES
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_WireEdgeSet& BOP_WESCorrector::WES ()
|
|
||||||
{
|
|
||||||
return *myWES;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: NewWES
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_WireEdgeSet& BOP_WESCorrector::NewWES ()
|
|
||||||
{
|
|
||||||
return myNewWES;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: IsDone
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_WESCorrector::IsDone () const
|
|
||||||
{
|
|
||||||
return myIsDone;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: ErrorStatus
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_WESCorrector::ErrorStatus () const
|
|
||||||
{
|
|
||||||
return myErrorStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: Do
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WESCorrector::Do()
|
|
||||||
{
|
|
||||||
DoConnexityBlocks();
|
|
||||||
|
|
||||||
DoCorrections();
|
|
||||||
|
|
||||||
myIsDone=Standard_True;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoConnexityBlocks
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WESCorrector::DoConnexityBlocks()
|
|
||||||
{
|
|
||||||
Standard_Boolean EnewinM, aGoOn;
|
|
||||||
Standard_Integer Mextent, IsRegular, aNbNeighbours, Eindex;
|
|
||||||
TopTools_IndexedMapOfOrientedShape myOrientedShapeMap, aMap;
|
|
||||||
//
|
|
||||||
myWES->InitStartElements();
|
|
||||||
for (; myWES->MoreStartElements(); myWES->NextStartElement()) {
|
|
||||||
const TopoDS_Shape& anE = myWES->StartElement();
|
|
||||||
Mextent = myOrientedShapeMap.Extent();
|
|
||||||
|
|
||||||
Eindex = myOrientedShapeMap.Add(anE);
|
|
||||||
|
|
||||||
EnewinM = (Eindex > Mextent);
|
|
||||||
if (EnewinM) {
|
|
||||||
//
|
|
||||||
// make a new block starting at element Eindex
|
|
||||||
IsRegular=Standard_True;
|
|
||||||
aNbNeighbours=0;
|
|
||||||
Mextent = myOrientedShapeMap.Extent();
|
|
||||||
//
|
|
||||||
aMap.Clear();
|
|
||||||
aMap.Add(anE);
|
|
||||||
//
|
|
||||||
aGoOn = (Eindex <= Mextent);
|
|
||||||
while (aGoOn) {
|
|
||||||
const TopoDS_Shape& anEE = myOrientedShapeMap(Eindex);
|
|
||||||
aNbNeighbours = myWES->MaxNumberSubShape(anEE);
|
|
||||||
|
|
||||||
IsRegular = IsRegular && (aNbNeighbours == 2);
|
|
||||||
//
|
|
||||||
myWES->InitNeighbours(anEE);
|
|
||||||
for (; myWES->MoreNeighbours(); myWES->NextNeighbour()) {
|
|
||||||
const TopoDS_Shape& aNeignbE = myWES->Neighbour();
|
|
||||||
myOrientedShapeMap.Add(aNeignbE);
|
|
||||||
//
|
|
||||||
aMap.Add(aNeignbE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Eindex++;
|
|
||||||
Mextent = myOrientedShapeMap.Extent();
|
|
||||||
aGoOn = (Eindex <= Mextent);
|
|
||||||
} // end of while aGoOn
|
|
||||||
|
|
||||||
//
|
|
||||||
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
||||||
{
|
|
||||||
Standard_Integer aNbE;
|
|
||||||
|
|
||||||
aNbE=aMap.Extent();
|
|
||||||
if (aNbE==2) {
|
|
||||||
const TopoDS_Edge& aEB1=TopoDS::Edge(aMap(1));
|
|
||||||
const TopoDS_Edge& aEB2=TopoDS::Edge(aMap(2));
|
|
||||||
if (aEB1.IsSame(aEB2)) {
|
|
||||||
if (!BRep_Tool::IsClosed(aEB1, myWES->Face())) {
|
|
||||||
IsRegular=Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
||||||
//
|
|
||||||
BOP_ConnexityBlock aConnexityBlock;
|
|
||||||
aConnexityBlock.SetShapes(aMap);
|
|
||||||
aConnexityBlock.SetRegularity(IsRegular);
|
|
||||||
myConnexityBlocks.Append(aConnexityBlock);
|
|
||||||
} // end of if (EnewinM)
|
|
||||||
} // end of for (; myWES->MoreStartElements();...
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoCorrections
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WESCorrector::DoCorrections()
|
|
||||||
{
|
|
||||||
Standard_Boolean anIsRegular, anIsNothingToDo, anIsDone;
|
|
||||||
|
|
||||||
TopoDS_Wire aW;
|
|
||||||
BOP_ListIteratorOfListOfConnexityBlock aCBIt;
|
|
||||||
|
|
||||||
myNewWES.Initialize(myWES->Face());
|
|
||||||
|
|
||||||
aCBIt.Initialize(myConnexityBlocks);
|
|
||||||
for (; aCBIt.More(); aCBIt.Next()) {
|
|
||||||
const BOP_ConnexityBlock& aCB=aCBIt.Value();
|
|
||||||
const TopTools_ListOfShape& aListOfEdges=aCB.Shapes();
|
|
||||||
|
|
||||||
anIsRegular=aCB.IsRegular();
|
|
||||||
|
|
||||||
if (anIsRegular) {
|
|
||||||
MakeWire(aListOfEdges, aW);
|
|
||||||
myNewWES.AddShape (aW);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Treatment of non regular Connexity Block
|
|
||||||
const TopoDS_Face& aF=myWES->Face();
|
|
||||||
BOP_WireSplitter aWireSplitter;
|
|
||||||
aWireSplitter.SetFace(aF);
|
|
||||||
aWireSplitter.DoWithListOfEdges(aListOfEdges);
|
|
||||||
|
|
||||||
anIsDone=aWireSplitter.IsDone();
|
|
||||||
anIsNothingToDo=aWireSplitter.IsNothingToDo();
|
|
||||||
|
|
||||||
if (!anIsDone || anIsNothingToDo) {
|
|
||||||
MakeWire(aListOfEdges, aW);
|
|
||||||
myNewWES.AddShape (aW);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
const BOPTColStd_ListOfListOfShape& aSSS=aWireSplitter.Shapes();
|
|
||||||
|
|
||||||
BOPTColStd_ListIteratorOfListOfListOfShape aWireIt(aSSS);
|
|
||||||
for (; aWireIt.More(); aWireIt.Next()) {
|
|
||||||
const TopTools_ListOfShape& aListEd=aWireIt.Value();
|
|
||||||
//
|
|
||||||
MakeWire(aListEd, aW);
|
|
||||||
myNewWES.AddShape (aW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: MakeWire
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void MakeWire(const TopTools_ListOfShape& aLE,
|
|
||||||
TopoDS_Wire& newWire)
|
|
||||||
{
|
|
||||||
BRep_Builder aBB;
|
|
||||||
aBB.MakeWire(newWire);
|
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aLE);
|
|
||||||
for (; anIt.More(); anIt.Next()){
|
|
||||||
const TopoDS_Edge& aE=TopoDS::Edge(anIt.Value());
|
|
||||||
aBB.Add(newWire, aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// myErrorStatus:
|
|
||||||
//
|
|
||||||
// 1 - Nothing is done because only constructor has been invoked
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
@ -1,118 +0,0 @@
|
|||||||
-- Created on: 1993-06-17
|
|
||||||
-- Created by: Jean Yves LEBEY
|
|
||||||
-- Copyright (c) 1993-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 WireEdgeClassifier from BOP inherits CompositeClassifier from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
-- The algorithm is to classify loops that
|
|
||||||
-- shapes are Wires, Element are Edge.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
ShapeEnum from TopAbs,
|
|
||||||
State from TopAbs,
|
|
||||||
|
|
||||||
Shape from TopoDS,
|
|
||||||
Face from TopoDS,
|
|
||||||
|
|
||||||
Pnt2d from gp,
|
|
||||||
|
|
||||||
Edge from BRepClass,
|
|
||||||
FacePassiveClassifier from BRepClass,
|
|
||||||
BlockBuilder from BOP,
|
|
||||||
Loop from BOP
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(F : Face from TopoDS;
|
|
||||||
BB : BlockBuilder)
|
|
||||||
returns WireEdgeClassifier;
|
|
||||||
---Purpose:
|
|
||||||
--- Creates a classifier on edge <F>.
|
|
||||||
--- Used to compare edges and wires on the edge <F>.
|
|
||||||
---
|
|
||||||
|
|
||||||
Compare(me : in out;
|
|
||||||
L1 : Loop from BOP;
|
|
||||||
L2 : Loop from BOP)
|
|
||||||
returns State from TopAbs
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- Classify loop <L1> with <L2>
|
|
||||||
---
|
|
||||||
LoopToShape(me : in out;
|
|
||||||
L : Loop from BOP)
|
|
||||||
returns Shape from TopoDS;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
CompareShapes(me : in out;
|
|
||||||
B1 : Shape from TopoDS;
|
|
||||||
B2 : Shape from TopoDS)
|
|
||||||
returns State from TopAbs;
|
|
||||||
---Purpose:
|
|
||||||
--- Classify wire <B1> with wire <B2>
|
|
||||||
---
|
|
||||||
CompareElementToShape(me : in out;
|
|
||||||
E : Shape from TopoDS;
|
|
||||||
W : Shape from TopoDS)
|
|
||||||
returns State from TopAbs;
|
|
||||||
---Purpose:
|
|
||||||
--- Classify edge <E> with wire <W>
|
|
||||||
---
|
|
||||||
ResetShape(me : in out;
|
|
||||||
B : Shape from TopoDS);
|
|
||||||
---Purpose:
|
|
||||||
--- Prepare classification involving wire <B>
|
|
||||||
--- calls ResetElement on first edge of <B>
|
|
||||||
---
|
|
||||||
|
|
||||||
ResetElement(me : in out;
|
|
||||||
E : Shape from TopoDS);
|
|
||||||
---Purpose:
|
|
||||||
--- Prepare classification involving edge <E>
|
|
||||||
--- define 2D point (later used in Compare())
|
|
||||||
--- on first vertex of edge <E>.
|
|
||||||
---
|
|
||||||
|
|
||||||
CompareElement(me : in out;
|
|
||||||
E : Shape from TopoDS);
|
|
||||||
---Purpose:
|
|
||||||
--- Add the edge <E> in the set of edges used in 2D point
|
|
||||||
--- classification.
|
|
||||||
---
|
|
||||||
|
|
||||||
State(me : in out)
|
|
||||||
returns State from TopAbs;
|
|
||||||
---Purpose:
|
|
||||||
--- Returns state of classification of 2D point, defined by
|
|
||||||
--- ResetElement, with the current set of edges, defined by Compare.
|
|
||||||
---
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myFirstCompare : Boolean from Standard;
|
|
||||||
myPoint2d : Pnt2d from gp;
|
|
||||||
myBCEdge : Edge from BRepClass;
|
|
||||||
myFPC : FacePassiveClassifier from BRepClass;
|
|
||||||
myShape : Shape from TopoDS;
|
|
||||||
|
|
||||||
end WireEdgeClassifier;
|
|
@ -1,472 +0,0 @@
|
|||||||
// Created on: 1993-06-17
|
|
||||||
// Created by: Jean Yves LEBEY
|
|
||||||
// Copyright (c) 1993-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.
|
|
||||||
|
|
||||||
// modified by PKV
|
|
||||||
// ... and nobody played synthesizer .
|
|
||||||
|
|
||||||
// Modified by skv - Thu Jul 6 12:01:17 2006 OCC12627
|
|
||||||
|
|
||||||
#include <BOP_WireEdgeClassifier.ixx>
|
|
||||||
|
|
||||||
#include <Standard_ProgramError.hxx>
|
|
||||||
|
|
||||||
#include <Precision.hxx>
|
|
||||||
|
|
||||||
#include <gp_Pnt.hxx>
|
|
||||||
#include <gp_Vec2d.hxx>
|
|
||||||
|
|
||||||
#include <Geom2d_Curve.hxx>
|
|
||||||
#include <Geom_Curve.hxx>
|
|
||||||
#include <Geom_Surface.hxx>
|
|
||||||
#include <Geom_TrimmedCurve.hxx>
|
|
||||||
|
|
||||||
#include <GeomAdaptor_Surface.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Vertex.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
#include <TopoDS_Wire.hxx>
|
|
||||||
#include <TopoDS_Face.hxx>
|
|
||||||
|
|
||||||
#include <TopLoc_Location.hxx>
|
|
||||||
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
#include <BRepClass_FaceClassifier.hxx>
|
|
||||||
#include <BRep_Builder.hxx>
|
|
||||||
#include <BRepAdaptor_Curve2d.hxx>
|
|
||||||
|
|
||||||
#include <IntTools_Tools.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_Tools2D.hxx>
|
|
||||||
#include <BOPTools_Tools3D.hxx>
|
|
||||||
#include <IntTools_FClass2d.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
Standard_Real MinStepIn2d(const TopoDS_Edge& aE,
|
|
||||||
const TopoDS_Face& aF);
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_WireEdgeClassifier::BOP_WireEdgeClassifier
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_WireEdgeClassifier::BOP_WireEdgeClassifier (const TopoDS_Face& F,
|
|
||||||
const BOP_BlockBuilder& BB)
|
|
||||||
:
|
|
||||||
BOP_CompositeClassifier(BB)
|
|
||||||
{
|
|
||||||
myBCEdge.Face() = F;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Compare
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
TopAbs_State BOP_WireEdgeClassifier::Compare (const Handle(BOP_Loop)& L1,
|
|
||||||
const Handle(BOP_Loop)& L2)
|
|
||||||
{
|
|
||||||
TopAbs_State state = TopAbs_UNKNOWN;
|
|
||||||
|
|
||||||
Standard_Boolean isshape1, isshape2, yena1 ;
|
|
||||||
|
|
||||||
isshape1 = L1->IsShape();
|
|
||||||
isshape2 = L2->IsShape();
|
|
||||||
|
|
||||||
if ( isshape2 && isshape1 ) {
|
|
||||||
// L1 is Shape , L2 is Shape
|
|
||||||
const TopoDS_Shape& s1 = L1->Shape();
|
|
||||||
const TopoDS_Shape& s2 = L2->Shape();
|
|
||||||
state = CompareShapes(s1,s2);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ( isshape2 && !isshape1 ) {
|
|
||||||
// L1 is Block , L2 is Shape
|
|
||||||
BOP_BlockIterator Bit1 = L1->BlockIterator();
|
|
||||||
Bit1.Initialize();
|
|
||||||
yena1 = Bit1.More();
|
|
||||||
while (yena1) {
|
|
||||||
const TopoDS_Shape& s1 =
|
|
||||||
((BOP_BlockBuilder*)myBlockBuilder)->Element(Bit1);
|
|
||||||
const TopoDS_Shape& s2 = L2->Shape();
|
|
||||||
state = CompareElementToShape(s1,s2);
|
|
||||||
yena1 = Standard_False;
|
|
||||||
if (state == TopAbs_UNKNOWN) {
|
|
||||||
if (Bit1.More()) Bit1.Next();
|
|
||||||
yena1 = Bit1.More();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ( !isshape2 && isshape1 ) {
|
|
||||||
// L1 is Shape , L2 is Block
|
|
||||||
const TopoDS_Shape& s1 = L1->Shape();
|
|
||||||
ResetShape(s1);
|
|
||||||
BOP_BlockIterator Bit2 = L2->BlockIterator();
|
|
||||||
for (Bit2.Initialize(); Bit2.More(); Bit2.Next()) {
|
|
||||||
const TopoDS_Shape& s2 =
|
|
||||||
((BOP_BlockBuilder*)myBlockBuilder)->Element(Bit2);
|
|
||||||
CompareElement(s2);
|
|
||||||
}
|
|
||||||
state = State();
|
|
||||||
}
|
|
||||||
else if ( !isshape2 && !isshape1 ) {
|
|
||||||
// L1 is Block , L2 is Block
|
|
||||||
if (state == TopAbs_UNKNOWN) {
|
|
||||||
BOP_BlockIterator Bit1 = L1->BlockIterator();
|
|
||||||
Bit1.Initialize();
|
|
||||||
yena1 = Bit1.More();
|
|
||||||
while (yena1) {
|
|
||||||
const TopoDS_Shape& s1 =
|
|
||||||
((BOP_BlockBuilder*)myBlockBuilder)->Element(Bit1);
|
|
||||||
ResetElement(s1);
|
|
||||||
BOP_BlockIterator Bit2 = L2->BlockIterator();
|
|
||||||
for (Bit2.Initialize(); Bit2.More(); Bit2.Next()) {
|
|
||||||
const TopoDS_Shape& s2 =
|
|
||||||
((BOP_BlockBuilder*)myBlockBuilder)->Element(Bit2);
|
|
||||||
CompareElement(s2);
|
|
||||||
}
|
|
||||||
state = State();
|
|
||||||
yena1 = Standard_False;
|
|
||||||
if (state == TopAbs_UNKNOWN) {
|
|
||||||
if (Bit1.More()) Bit1.Next();
|
|
||||||
yena1 = Bit1.More();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // if (state == TopAbs_UNKNOWN)
|
|
||||||
|
|
||||||
if (state == TopAbs_UNKNOWN) {
|
|
||||||
//
|
|
||||||
TopoDS_Shape s1 = LoopToShape(L1);
|
|
||||||
if (s1.IsNull()) {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
TopoDS_Shape s2 = LoopToShape(L2);
|
|
||||||
if (s2.IsNull()) {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
} // if (state == TopAbs_UNKNOWN)
|
|
||||||
|
|
||||||
} // else if ( !isshape2 && !isshape1 )
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : LoopToShape
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
TopoDS_Shape BOP_WireEdgeClassifier::LoopToShape(const Handle(BOP_Loop)& L)
|
|
||||||
{
|
|
||||||
myShape.Nullify();
|
|
||||||
|
|
||||||
BOP_BlockIterator Bit = L->BlockIterator();
|
|
||||||
Bit.Initialize();
|
|
||||||
if ( !Bit.More() ) {
|
|
||||||
return myShape;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopoDS_Shape aLocalShape = myBCEdge.Face();
|
|
||||||
const TopoDS_Face& F1 = TopoDS::Face(aLocalShape);
|
|
||||||
//
|
|
||||||
aLocalShape = F1.EmptyCopied();
|
|
||||||
TopoDS_Face F = TopoDS::Face(aLocalShape);
|
|
||||||
//
|
|
||||||
BRep_Builder BB;
|
|
||||||
TopoDS_Wire W;
|
|
||||||
BB.MakeWire(W);
|
|
||||||
|
|
||||||
Standard_Real tolE, f,l,tolpc, tol;
|
|
||||||
Standard_Boolean haspc ;
|
|
||||||
|
|
||||||
for (; Bit.More(); Bit.Next()) {
|
|
||||||
const TopoDS_Edge& E =
|
|
||||||
TopoDS::Edge(((BOP_BlockBuilder*)myBlockBuilder)->Element(Bit));
|
|
||||||
|
|
||||||
tolE = BRep_Tool::Tolerance(E);
|
|
||||||
|
|
||||||
haspc = BOPTools_Tools2D::HasCurveOnSurface (E, F);
|
|
||||||
if (!haspc) {
|
|
||||||
Handle(Geom2d_Curve) C2D;
|
|
||||||
BOPTools_Tools2D::CurveOnSurface (E, F, C2D, f, l, tolpc, Standard_False);
|
|
||||||
|
|
||||||
if (!C2D.IsNull()) {
|
|
||||||
tol = Max(tolpc,tolE);
|
|
||||||
BB.UpdateEdge(E,C2D,F,tol);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BB.Add(W,E);
|
|
||||||
}
|
|
||||||
BB.Add(F, W);
|
|
||||||
|
|
||||||
myShape = F;
|
|
||||||
return myShape;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : CompareShapes
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
TopAbs_State BOP_WireEdgeClassifier::CompareShapes (const TopoDS_Shape& B1,
|
|
||||||
const TopoDS_Shape& B2)
|
|
||||||
{
|
|
||||||
Standard_Boolean bBothWires;
|
|
||||||
TopAbs_State aSt;
|
|
||||||
TopExp_Explorer anExp1;
|
|
||||||
|
|
||||||
aSt = TopAbs_UNKNOWN;
|
|
||||||
bBothWires= (B2.ShapeType()==TopAbs_WIRE) && (B1.ShapeType()==TopAbs_WIRE);
|
|
||||||
|
|
||||||
anExp1.Init (B1, TopAbs_EDGE);
|
|
||||||
if ( !anExp1.More() ) {
|
|
||||||
return aSt;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
for (; anExp1.More(); anExp1.Next() ) {
|
|
||||||
const TopoDS_Edge& anE1 = TopoDS::Edge(anExp1.Current());
|
|
||||||
ResetShape(anE1);
|
|
||||||
//
|
|
||||||
TopExp_Explorer anExp2(B2, TopAbs_EDGE);
|
|
||||||
for(; anExp2.More(); anExp2.Next()) {
|
|
||||||
const TopoDS_Edge& anE2 = TopoDS::Edge(anExp2.Current());
|
|
||||||
//
|
|
||||||
if(anE2.IsSame(anE1)) {
|
|
||||||
//const TopoDS_Face& aF=myBCEdge.Face();
|
|
||||||
if (bBothWires) {
|
|
||||||
aSt = TopAbs_OUT;
|
|
||||||
return aSt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
TopoDS_Face aFN1, aFN2;
|
|
||||||
gp_Pnt2d aP2DNear;
|
|
||||||
gp_Pnt aPNear;
|
|
||||||
|
|
||||||
const TopoDS_Face& theFace = myBCEdge.Face();
|
|
||||||
const TopoDS_Wire& aW1=TopoDS::Wire(B1);
|
|
||||||
const TopoDS_Wire& aW2=TopoDS::Wire(B2);
|
|
||||||
|
|
||||||
IntTools_Tools::MakeFaceFromWireAndFace (aW1, theFace, aFN1);
|
|
||||||
IntTools_Tools::MakeFaceFromWireAndFace (aW2, theFace, aFN2);
|
|
||||||
|
|
||||||
anExp1.Init (aFN1, TopAbs_EDGE);
|
|
||||||
for (; anExp1.More(); anExp1.Next()){
|
|
||||||
const TopoDS_Edge& aE1=TopoDS::Edge(anExp1.Current());
|
|
||||||
//
|
|
||||||
// The block that choises step in 2D taking into account
|
|
||||||
// tolerances of the Face and Edge on the Face in order to
|
|
||||||
// obtain 2D point exactly INside of the Face
|
|
||||||
// pkv207/A5
|
|
||||||
// PKV Thu Jun 13 09:09:53 2002
|
|
||||||
{
|
|
||||||
Standard_Real aT, aT1, aT2, dt2D;
|
|
||||||
|
|
||||||
BRep_Tool::Range(aE1, aT1, aT2);
|
|
||||||
aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
|
|
||||||
//
|
|
||||||
TopoDS_Face aFF=aFN1;
|
|
||||||
TopoDS_Edge aERight;
|
|
||||||
|
|
||||||
aFF.Orientation(TopAbs_FORWARD);
|
|
||||||
BOPTools_Tools3D::OrientEdgeOnFace (aE1, aFF, aERight);
|
|
||||||
|
|
||||||
dt2D=MinStepIn2d(aERight, aFF);
|
|
||||||
BOPTools_Tools3D::PointNearEdge (aERight, aFF, aT, dt2D, aP2DNear, aPNear);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Modified by skv - Thu Jul 6 12:01:17 2006 OCC12627 Begin
|
|
||||||
// aSt=IntTools_Tools::ClassifyPointByFace (aFN2, aP2DNear);
|
|
||||||
Standard_Real aTol = Precision::PConfusion();
|
|
||||||
IntTools_FClass2d aClass2d(aFN2, aTol);
|
|
||||||
|
|
||||||
aSt = aClass2d.Perform(aP2DNear);
|
|
||||||
// Modified by skv - Thu Jul 6 12:01:19 2006 OCC12627 End
|
|
||||||
|
|
||||||
return aSt;
|
|
||||||
}
|
|
||||||
return aSt;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : CompareElementToShape
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
TopAbs_State BOP_WireEdgeClassifier::CompareElementToShape (const TopoDS_Shape& EE,
|
|
||||||
const TopoDS_Shape& B)
|
|
||||||
{
|
|
||||||
// isEdge : edge E inits myPoint2d
|
|
||||||
ResetElement(EE);
|
|
||||||
TopExp_Explorer Ex;
|
|
||||||
Ex.Init(B,TopAbs_EDGE);
|
|
||||||
for(; Ex.More(); Ex.Next()) {
|
|
||||||
const TopoDS_Shape& E = Ex.Current();
|
|
||||||
CompareElement(E);
|
|
||||||
}
|
|
||||||
TopAbs_State state = State();
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ResetShape
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireEdgeClassifier::ResetShape(const TopoDS_Shape& B)
|
|
||||||
{
|
|
||||||
if (B.ShapeType() == TopAbs_EDGE) {
|
|
||||||
ResetElement(B);
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
TopExp_Explorer ex(B,TopAbs_EDGE);
|
|
||||||
if (ex.More()) {
|
|
||||||
const TopoDS_Shape& E = ex.Current();
|
|
||||||
ResetElement(E);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : ResetElement
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireEdgeClassifier::ResetElement(const TopoDS_Shape& EE)
|
|
||||||
{
|
|
||||||
const TopoDS_Edge& E = TopoDS::Edge(EE);
|
|
||||||
const TopoDS_Face& F = myBCEdge.Face();
|
|
||||||
|
|
||||||
Standard_Boolean haspc;
|
|
||||||
Standard_Real f2, l2, tolpc, tolE, tol, par ;
|
|
||||||
Handle(Geom2d_Curve) C2D;
|
|
||||||
BRep_Builder BB;
|
|
||||||
|
|
||||||
haspc = BOPTools_Tools2D::HasCurveOnSurface(E, F);
|
|
||||||
if (!haspc) {
|
|
||||||
BOPTools_Tools2D::CurveOnSurface(E, F, C2D, f2, l2, tolpc, Standard_True);
|
|
||||||
tolE = BRep_Tool::Tolerance(E);
|
|
||||||
tol = Max(tolE,tolpc);
|
|
||||||
BB.UpdateEdge(E,C2D,F,tol);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BOPTools_Tools2D::CurveOnSurface(E, F, C2D, f2, l2, tolpc, Standard_False);
|
|
||||||
if (C2D.IsNull()) {
|
|
||||||
Standard_ProgramError::Raise("WEC : ResetElement");
|
|
||||||
}
|
|
||||||
|
|
||||||
par = BOPTools_Tools2D::IntermediatePoint (f2, l2);
|
|
||||||
myPoint2d = C2D->Value(par);
|
|
||||||
|
|
||||||
myFirstCompare = Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : CompareElement
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireEdgeClassifier::CompareElement(const TopoDS_Shape& EE)
|
|
||||||
{
|
|
||||||
const TopoDS_Edge& E = TopoDS::Edge(EE);
|
|
||||||
const TopoDS_Face& F = myBCEdge.Face();
|
|
||||||
|
|
||||||
Standard_Real f2, l2, tolpc, tolE, tol, par, dist, tol2d;
|
|
||||||
Standard_Boolean haspc;
|
|
||||||
|
|
||||||
if (myFirstCompare) {
|
|
||||||
|
|
||||||
Handle(Geom2d_Curve) C2D;
|
|
||||||
BRep_Builder BB;
|
|
||||||
|
|
||||||
haspc = BOPTools_Tools2D::HasCurveOnSurface(E, F);
|
|
||||||
if (!haspc) {
|
|
||||||
BOPTools_Tools2D::CurveOnSurface(E, F, C2D, f2, l2, tolpc, Standard_True);
|
|
||||||
tolE = BRep_Tool::Tolerance(E);
|
|
||||||
tol = Max(tolE, tolpc);
|
|
||||||
BB.UpdateEdge(E,C2D,F,tol);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOPTools_Tools2D::CurveOnSurface(E, F, C2D, f2, l2, tolpc, Standard_False);
|
|
||||||
|
|
||||||
par = BOPTools_Tools2D::IntermediatePoint (f2, l2);
|
|
||||||
|
|
||||||
gp_Pnt2d p2d = C2D->Value(par);
|
|
||||||
|
|
||||||
gp_Vec2d v2d(myPoint2d,p2d);
|
|
||||||
gp_Lin2d l2d(myPoint2d,v2d);
|
|
||||||
dist = myPoint2d.Distance(p2d);
|
|
||||||
tol2d = Precision::PConfusion();
|
|
||||||
|
|
||||||
myFPC.Reset(l2d,dist,tol2d);
|
|
||||||
myFirstCompare = Standard_False;
|
|
||||||
|
|
||||||
} // end of if (myFirstCompare)
|
|
||||||
|
|
||||||
myBCEdge.Edge() = E;
|
|
||||||
TopAbs_Orientation Eori = E.Orientation();
|
|
||||||
myFPC.Compare(myBCEdge,Eori);
|
|
||||||
//ZZ TopAbs_State state = myFPC.State();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : State
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
TopAbs_State BOP_WireEdgeClassifier::State()
|
|
||||||
{
|
|
||||||
TopAbs_State state = myFPC.State();
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : MinStepIn2d
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Real MinStepIn2d(const TopoDS_Edge& aE,
|
|
||||||
const TopoDS_Face& aF)
|
|
||||||
{
|
|
||||||
Standard_Real aDt2dMin, aDt2D, aTolE, aURes, aVRes;
|
|
||||||
//
|
|
||||||
aDt2dMin=1.e-5;
|
|
||||||
//
|
|
||||||
aTolE=BRep_Tool::Tolerance(aE);
|
|
||||||
//
|
|
||||||
Handle(Geom_Surface) aS=BRep_Tool::Surface(aF);
|
|
||||||
GeomAdaptor_Surface aGAS(aS);
|
|
||||||
if (aGAS.GetType()==GeomAbs_Plane) {
|
|
||||||
aURes=aGAS.UResolution(aTolE);
|
|
||||||
aVRes=aGAS.VResolution(aTolE);
|
|
||||||
aDt2D=(aURes>aVRes) ? aURes : aVRes;
|
|
||||||
//
|
|
||||||
if (aDt2D > aDt2dMin) {
|
|
||||||
aDt2D=aDt2dMin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aDt2D=aDt2dMin;
|
|
||||||
}
|
|
||||||
return aDt2D;
|
|
||||||
}
|
|
@ -1,199 +0,0 @@
|
|||||||
-- Created on: 1993-06-16
|
|
||||||
-- Created by: Jean Yves LEBEY
|
|
||||||
-- Copyright (c) 1993-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 WireEdgeSet from BOP inherits ShapeSet from BOP
|
|
||||||
|
|
||||||
---Purpose: The class containing data and methods
|
|
||||||
-- for a set of edges and wires
|
|
||||||
--
|
|
||||||
-- Bound is a wire,
|
|
||||||
-- Boundelement is an edge.
|
|
||||||
--
|
|
||||||
-- The ShapeSet stores :
|
|
||||||
-- - a list of wire (bounds),
|
|
||||||
-- - a list of edge (boundelements) to start reconstructions,
|
|
||||||
-- - a map of vertex giving the list of edge incident to a vertex.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
Orientation from TopAbs,
|
|
||||||
|
|
||||||
Shape from TopoDS,
|
|
||||||
Face from TopoDS,
|
|
||||||
Edge from TopoDS,
|
|
||||||
Vertex from TopoDS,
|
|
||||||
|
|
||||||
ListOfShape from TopTools,
|
|
||||||
|
|
||||||
Pnt2d from gp,
|
|
||||||
Vec2d from gp
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns WireEdgeSet from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
Create (F: Face from TopoDS)
|
|
||||||
returns WireEdgeSet from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Creates a WES to build edges connected by vertices
|
|
||||||
--- on face F. Edges of the WireEdgeSet must have a representation
|
|
||||||
--- on surface of face F.
|
|
||||||
---
|
|
||||||
Initialize(me:out;
|
|
||||||
F: Face from TopoDS);
|
|
||||||
---Purpose:
|
|
||||||
--- Initialize a WES to build edges connected by vertices
|
|
||||||
--- on face F. Edges of the WireEdgeSet must have a representation
|
|
||||||
--- on surface of face F.
|
|
||||||
---
|
|
||||||
Face(me)
|
|
||||||
returns Face from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
AddShape(me:out;
|
|
||||||
S:Shape from TopoDS)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- See in base class, please
|
|
||||||
---
|
|
||||||
AddStartElement(me:out;
|
|
||||||
S:Shape from TopoDS)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- See in base class, please
|
|
||||||
---
|
|
||||||
AddElement(me:out;
|
|
||||||
S:Shape from TopoDS)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- See in base class, please
|
|
||||||
---
|
|
||||||
InitNeighbours(me:out;
|
|
||||||
E:Shape from TopoDS)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
FindNeighbours(me:out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- Build the list of neighbour edges of edge myCurrentShape
|
|
||||||
--- Initialize iterator of neighbour edges to edge myCurrentShape
|
|
||||||
---
|
|
||||||
MakeNeighboursList(me:out;
|
|
||||||
E,V:Shape from TopoDS)
|
|
||||||
returns ListOfShape from TopTools
|
|
||||||
is redefined;
|
|
||||||
---C++: return const &
|
|
||||||
|
|
||||||
VertexConnectsEdges(me;
|
|
||||||
V,E1,E2:Shape from TopoDS;
|
|
||||||
O1,O2:out Orientation from TopAbs)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Indicates whether vertex V is a good connexity vertex between
|
|
||||||
--- edges E1 and E2.
|
|
||||||
--- i.e, returns True if V is shared by E1 and E2 and if V has different
|
|
||||||
--- orientations on E1 and E2.
|
|
||||||
--- If V is shared by E1 and E2, returns the orientation of V on E1 and E2
|
|
||||||
---
|
|
||||||
|
|
||||||
VertexConnectsEdgesClosing(me;
|
|
||||||
V,E1,E2:Shape from TopoDS)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
NbClosingShapes(me;
|
|
||||||
L:ListOfShape from TopTools)
|
|
||||||
returns Integer from Standard
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
LocalD1(me;
|
|
||||||
F : Face from TopoDS;
|
|
||||||
E : Edge from TopoDS;
|
|
||||||
V : Vertex from TopoDS;
|
|
||||||
P2: out Pnt2d from gp;
|
|
||||||
V2: out Vec2d from gp)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
IsClosed(me;
|
|
||||||
E:Shape from TopoDS)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- indicates if the edge <E> is a closing edge of myFace
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
IsUClosed(me;
|
|
||||||
E:Shape from TopoDS)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- indicates if the edge <E> is a closing edge on U of myFace
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
IsVClosed(me;
|
|
||||||
E:Shape from TopoDS)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- indicates if the edge <E> is a closing edge on V of myFace
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
IsUVISO(myclass;
|
|
||||||
E:Edge from TopoDS;
|
|
||||||
F:Face from TopoDS;
|
|
||||||
uiso,viso:out Boolean from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
|
|
||||||
RemoveEdgeFromWES (me:out;
|
|
||||||
aE : Edge from TopoDS);
|
|
||||||
---Purpose:
|
|
||||||
--- Removes the edge aE from the WES
|
|
||||||
---
|
|
||||||
KeptTwice(me;
|
|
||||||
aE : Edge from TopoDS)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Returns TRUE if the edge aE has been kept twice
|
|
||||||
--- in the WES
|
|
||||||
---
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myFace:Face from TopoDS;
|
|
||||||
myDEBVertexIndex:Integer from Standard;
|
|
||||||
|
|
||||||
end WireEdgeSet from BOP;
|
|
@ -1,608 +0,0 @@
|
|||||||
// Created on: 1993-06-17
|
|
||||||
// Created by: Jean Yves LEBEY
|
|
||||||
// Copyright (c) 1993-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.
|
|
||||||
|
|
||||||
// modified by NIZNHY-PKV
|
|
||||||
|
|
||||||
#include <BOP_WireEdgeSet.ixx>
|
|
||||||
|
|
||||||
#include <Standard_ProgramError.hxx>
|
|
||||||
|
|
||||||
#include <Precision.hxx>
|
|
||||||
|
|
||||||
#include <gp_Vec.hxx>
|
|
||||||
#include <gp_Vec2d.hxx>
|
|
||||||
#include <gp_Pnt2d.hxx>
|
|
||||||
#include <gp_Dir2d.hxx>
|
|
||||||
|
|
||||||
#include <Geom2d_Curve.hxx>
|
|
||||||
#include <Geom2d_Line.hxx>
|
|
||||||
#include <Geom_Curve.hxx>
|
|
||||||
#include <Geom_Surface.hxx>
|
|
||||||
#include <GeomAbs_SurfaceType.hxx>
|
|
||||||
#include <GeomAbs_CurveType.hxx>
|
|
||||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
#include <BRepAdaptor_Surface.hxx>
|
|
||||||
#include <BRepAdaptor_Curve.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopAbs.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_Tools2D.hxx>
|
|
||||||
|
|
||||||
// modified by NIZHNY-MKK Fri May 30 10:18:01 2003.BEGIN
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
#include <BOPTools_Tools3D.hxx>
|
|
||||||
|
|
||||||
static void GetOrientationVOnE(const TopoDS_Shape& V,
|
|
||||||
const TopoDS_Shape& E1,
|
|
||||||
const TopoDS_Shape& E2,
|
|
||||||
TopAbs_Orientation& o1,
|
|
||||||
TopAbs_Orientation& o2);
|
|
||||||
// modified by NIZHNY-MKK Fri May 30 10:18:03 2003.END
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_WireEdgeSet::BOP_WireEdgeSet
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_WireEdgeSet::BOP_WireEdgeSet()
|
|
||||||
:
|
|
||||||
BOP_ShapeSet(TopAbs_VERTEX)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_WireEdgeSet::BOP_WireEdgeSet
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
BOP_WireEdgeSet::BOP_WireEdgeSet(const TopoDS_Face& F)
|
|
||||||
:
|
|
||||||
BOP_ShapeSet(TopAbs_VERTEX),
|
|
||||||
myFace(F)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireEdgeSet::Initialize(const TopoDS_Face& F)
|
|
||||||
{
|
|
||||||
myFace=F;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddShape
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireEdgeSet::AddShape(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
ProcessAddShape(S);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddStartElement
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireEdgeSet::AddStartElement(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
ProcessAddStartElement(S);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddElement
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireEdgeSet::AddElement(const TopoDS_Shape& S)
|
|
||||||
{
|
|
||||||
BOP_ShapeSet::AddElement(S);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : InitNeighbours
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireEdgeSet::InitNeighbours(const TopoDS_Shape& E)
|
|
||||||
{
|
|
||||||
mySubShapeExplorer.Init(E,mySubShapeType);
|
|
||||||
myCurrentShape = E;
|
|
||||||
|
|
||||||
FindNeighbours();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FindNeighbours
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireEdgeSet::FindNeighbours()
|
|
||||||
{
|
|
||||||
while (mySubShapeExplorer.More()) {
|
|
||||||
|
|
||||||
// l = list of edges neighbour of edge myCurrentShape trough
|
|
||||||
// the vertex mySubShapeExplorer.Current(), which is a vertex of the
|
|
||||||
// edge myCurrentShape.
|
|
||||||
const TopoDS_Shape& V = mySubShapeExplorer.Current();
|
|
||||||
|
|
||||||
const TopTools_ListOfShape & l =
|
|
||||||
MakeNeighboursList(myCurrentShape, V);
|
|
||||||
|
|
||||||
// myIncidentShapesIter iterates on the neighbour edges of the edge
|
|
||||||
// given as InitNeighbours() argument (this edge has been stored
|
|
||||||
// in the field myCurrentShape).
|
|
||||||
|
|
||||||
myIncidentShapesIter.Initialize(l);
|
|
||||||
if (myIncidentShapesIter.More()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
mySubShapeExplorer.Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : MakeNeighboursList
|
|
||||||
//purpose : find edges connected to Earg by Varg
|
|
||||||
//=======================================================================
|
|
||||||
const TopTools_ListOfShape & BOP_WireEdgeSet::MakeNeighboursList(const TopoDS_Shape& Earg,
|
|
||||||
const TopoDS_Shape& Varg)
|
|
||||||
{
|
|
||||||
const TopoDS_Edge& E = TopoDS::Edge(Earg);
|
|
||||||
const TopoDS_Vertex& V = TopoDS::Vertex(Varg);
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& l = mySubShapeMap.FindFromKey(Varg);
|
|
||||||
|
|
||||||
Standard_Integer nclosing = NbClosingShapes(l);
|
|
||||||
if (nclosing) {
|
|
||||||
// build myCurrentShapeNeighbours =
|
|
||||||
// edge list made of connected shapes to Earg through Varg
|
|
||||||
myCurrentShapeNeighbours.Clear();
|
|
||||||
|
|
||||||
Standard_Integer iapp = 0;
|
|
||||||
for (TopTools_ListIteratorOfListOfShape it(l); it.More(); it.Next()) {
|
|
||||||
iapp++;
|
|
||||||
const TopoDS_Shape& curn = it.Value(); // current neighbour
|
|
||||||
Standard_Boolean k = VertexConnectsEdgesClosing(Varg, Earg, curn);
|
|
||||||
if (k) {
|
|
||||||
myCurrentShapeNeighbours.Append(curn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer newn = NbClosingShapes(myCurrentShapeNeighbours);
|
|
||||||
if (newn >= 2 ) {
|
|
||||||
|
|
||||||
const TopoDS_Face& F = myFace;
|
|
||||||
// several sewing edges connected to E by V such as :
|
|
||||||
// orientation of V in E # orientation of V in its edges.
|
|
||||||
// one leaves among the connected sewing edges,
|
|
||||||
// only edge A that checks tg(E) ^ tg(A) > 0
|
|
||||||
|
|
||||||
TopAbs_Orientation Eori;
|
|
||||||
gp_Vec2d d1E; gp_Pnt2d pE;
|
|
||||||
Standard_Real fiE, laE, tolpc, parE;
|
|
||||||
|
|
||||||
parE = BRep_Tool::Parameter(V,E);
|
|
||||||
|
|
||||||
Handle(Geom2d_Curve) PCE;
|
|
||||||
BOPTools_Tools2D::CurveOnSurface(E, F, PCE, fiE, laE, tolpc, Standard_False);
|
|
||||||
|
|
||||||
if (!PCE.IsNull()){
|
|
||||||
PCE->D1(parE, pE, d1E);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LocalD1 (F, E, V, pE, d1E);
|
|
||||||
}
|
|
||||||
|
|
||||||
Eori = E.Orientation();
|
|
||||||
if (Eori == TopAbs_REVERSED) {
|
|
||||||
d1E.Reverse();
|
|
||||||
}
|
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape lclo(myCurrentShapeNeighbours);
|
|
||||||
Standard_Integer rang = 0;
|
|
||||||
while (lclo.More()) {
|
|
||||||
rang++;
|
|
||||||
|
|
||||||
if ( ! IsClosed(lclo.Value()) ) {
|
|
||||||
lclo.Next();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TopoDS_Edge& EE = TopoDS::Edge(lclo.Value());
|
|
||||||
Standard_Real parEE, fiEE, laEE, tolpcc;
|
|
||||||
gp_Vec2d d1EE; gp_Pnt2d pEE;
|
|
||||||
|
|
||||||
parEE = BRep_Tool::Parameter(V,EE);
|
|
||||||
|
|
||||||
Handle(Geom2d_Curve) PCEE;
|
|
||||||
BOPTools_Tools2D::CurveOnSurface (EE, F, PCEE, fiEE, laEE, tolpcc, Standard_False);//
|
|
||||||
//
|
|
||||||
if (!PCEE.IsNull()) {
|
|
||||||
PCEE->D1(parEE,pEE,d1EE);
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LocalD1(F, EE, V, pEE, d1EE);
|
|
||||||
}
|
|
||||||
|
|
||||||
TopAbs_Orientation EEori = EE.Orientation();
|
|
||||||
if (EEori == TopAbs_REVERSED) d1EE.Reverse();
|
|
||||||
|
|
||||||
Standard_Real cross = d1E.Crossed(d1EE);
|
|
||||||
TopAbs_Orientation oVE,oVEE;
|
|
||||||
|
|
||||||
// modified by NIZHNY-MKK Fri May 30 10:17:10 2003.BEGIN
|
|
||||||
GetOrientationVOnE(V,E,EE,oVE,oVEE);
|
|
||||||
// VertexConnectsEdges(V,E,EE,oVE,oVEE);
|
|
||||||
// modified by NIZHNY-MKK Fri May 30 10:17:13 2003.END
|
|
||||||
|
|
||||||
Standard_Boolean t2 = ( (cross > 0) && oVE == TopAbs_REVERSED ) ||
|
|
||||||
( (cross < 0) && oVE == TopAbs_FORWARD );
|
|
||||||
|
|
||||||
if ( t2 ) { //-- t1
|
|
||||||
// this is proper IsClosed, only it is preserved among IsClosed
|
|
||||||
lclo.Next();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// edge IsClosed is suspended
|
|
||||||
myCurrentShapeNeighbours.Remove(lclo);
|
|
||||||
}
|
|
||||||
}// end of while (lclo.More())
|
|
||||||
}// end of if (newn >= 2 )
|
|
||||||
return myCurrentShapeNeighbours;
|
|
||||||
}// end of if (nclosing)
|
|
||||||
|
|
||||||
else {
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
} // MakeNeighoursList
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : VertexConnectsEdges
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_WireEdgeSet::VertexConnectsEdges(const TopoDS_Shape& V,
|
|
||||||
const TopoDS_Shape& E1,
|
|
||||||
const TopoDS_Shape& E2,
|
|
||||||
TopAbs_Orientation& o1,
|
|
||||||
TopAbs_Orientation& o2) const
|
|
||||||
{
|
|
||||||
TopExp_Explorer ex1, ex2;
|
|
||||||
ex1.Init(E1,TopAbs_VERTEX);
|
|
||||||
for(; ex1.More(); ex1.Next()) {
|
|
||||||
|
|
||||||
if (V.IsSame(ex1.Current())) {
|
|
||||||
ex2.Init(E2,TopAbs_VERTEX);
|
|
||||||
for(; ex2.More(); ex2.Next()) {
|
|
||||||
|
|
||||||
if (V.IsSame(ex2.Current())) {
|
|
||||||
o1 = ex1.Current().Orientation();
|
|
||||||
o2 = ex2.Current().Orientation();
|
|
||||||
if ( o1 != o2 ) {
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : VertexConnectEdgesClosing
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_WireEdgeSet::VertexConnectsEdgesClosing(const TopoDS_Shape& V,
|
|
||||||
const TopoDS_Shape& E1,
|
|
||||||
const TopoDS_Shape& E2) const
|
|
||||||
{
|
|
||||||
// Let S the set of incident edges on vertex V.
|
|
||||||
// S contains at least one closed edge on the periodic face to build.
|
|
||||||
// (the face implied in closing test of edge is myFace)
|
|
||||||
// E1,E2 are S shapes (sharing V).
|
|
||||||
//
|
|
||||||
// if E1 and E2 are not closed : edges are NOT connected
|
|
||||||
// if E1 or E2 is/are closed :
|
|
||||||
// if V changes of relative orientation between E1,E2 : edges are connected
|
|
||||||
// else : edges are NOT connected
|
|
||||||
//
|
|
||||||
// example with E1 NOT closed, E2 closed :
|
|
||||||
//
|
|
||||||
// E1 FORWARD, V REVERSED on E1
|
|
||||||
// E2 FORWARD, V FORWARD on E2 --> edges are connected
|
|
||||||
//
|
|
||||||
// E1 FORWARD, V REVERSED on E1
|
|
||||||
// E2 REVERSED, V FORWARD on E2 --> edges are NOT connected
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
|
|
||||||
Standard_Boolean c1 = IsClosed(E1);
|
|
||||||
Standard_Boolean c2 = IsClosed(E2);
|
|
||||||
|
|
||||||
Standard_Boolean testconnect = c1 || c2;
|
|
||||||
Standard_Boolean resu = Standard_False;
|
|
||||||
TopAbs_Orientation o1,o2;
|
|
||||||
|
|
||||||
// SSCONNEX = False ==> E2 is selected to create as many
|
|
||||||
// (default) faces as there are components connected in UV.
|
|
||||||
// SSCONNEX = True ==> the entire edge E2 sharing V with E1 is taken
|
|
||||||
// so that orientation(V/E1) # orientation(V/E2)
|
|
||||||
// ==> face of part and other sewings
|
|
||||||
if ((c1 && c2)) {
|
|
||||||
Standard_Boolean u1 = c1 ? IsUClosed(E1) : Standard_False;
|
|
||||||
Standard_Boolean v1 = c1 ? IsVClosed(E1) : Standard_False;
|
|
||||||
Standard_Boolean u2 = c2 ? IsUClosed(E2) : Standard_False;
|
|
||||||
Standard_Boolean v2 = c2 ? IsVClosed(E2) : Standard_False;
|
|
||||||
Standard_Boolean uvdiff = (u1 && v2) || (u2 && v1);
|
|
||||||
testconnect = uvdiff;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (testconnect) {
|
|
||||||
resu = VertexConnectsEdges(V,E1,E2,o1,o2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// cto 012 O2 sewing edge of cylindric face
|
|
||||||
// chain of components split ON and OUT of the same orientation
|
|
||||||
TopAbs_Orientation oe1 = E1.Orientation();
|
|
||||||
TopAbs_Orientation oe2 = E2.Orientation();
|
|
||||||
Standard_Boolean iseq = E1.IsEqual(E2);
|
|
||||||
if ( (c1 && c2) && (oe1 == oe2) && (!iseq) ) {
|
|
||||||
resu = VertexConnectsEdges(V,E1,E2,o1,o2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return resu;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbClosingShapes
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer BOP_WireEdgeSet::NbClosingShapes(const TopTools_ListOfShape & L) const
|
|
||||||
{
|
|
||||||
Standard_Integer n = 0;
|
|
||||||
TopTools_ListIteratorOfListOfShape it(L);
|
|
||||||
for ( ; it.More(); it.Next()) {
|
|
||||||
const TopoDS_Shape& S = it.Value();
|
|
||||||
if ( IsClosed(S) ) {
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : LocalD1
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireEdgeSet::LocalD1(const TopoDS_Face& F,
|
|
||||||
const TopoDS_Edge& E,
|
|
||||||
const TopoDS_Vertex& V,
|
|
||||||
gp_Pnt2d& ,//pE,
|
|
||||||
gp_Vec2d& d1E) const
|
|
||||||
{
|
|
||||||
TopLoc_Location Loc;
|
|
||||||
Standard_Real parE, fiE, laE, u, v;
|
|
||||||
|
|
||||||
parE = BRep_Tool::Parameter(V,E);
|
|
||||||
|
|
||||||
Handle(Geom_Curve) CE = BRep_Tool::Curve(E, Loc, fiE, laE);
|
|
||||||
CE = Handle(Geom_Curve)::DownCast(CE->Transformed(Loc.Transformation()));
|
|
||||||
|
|
||||||
gp_Pnt p3dE; gp_Vec d3dE;
|
|
||||||
CE->D1(parE, p3dE, d3dE);
|
|
||||||
|
|
||||||
Handle(Geom_Surface) S = BRep_Tool::Surface(F);
|
|
||||||
GeomAPI_ProjectPointOnSurf proj(p3dE,S);
|
|
||||||
|
|
||||||
proj.LowerDistanceParameters(u,v);
|
|
||||||
gp_Pnt bid;
|
|
||||||
gp_Vec d1u,d1v;
|
|
||||||
S->D1(u,v,bid,d1u,d1v);
|
|
||||||
u = d3dE.Dot(d1u);
|
|
||||||
v = d3dE.Dot(d1v);
|
|
||||||
d1E.SetCoord(u,v);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsClosed
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_WireEdgeSet::IsClosed(const TopoDS_Shape& E) const
|
|
||||||
{
|
|
||||||
const TopoDS_Edge& EE = TopoDS::Edge(E);
|
|
||||||
Standard_Boolean closed = BRep_Tool::IsClosed(EE,myFace);
|
|
||||||
|
|
||||||
// modified by NIZHNY-MKK Wed May 12 15:44:10 2004.BEGIN
|
|
||||||
if(closed) {
|
|
||||||
TopoDS_Edge aE1, aE2;
|
|
||||||
BOPTools_Tools3D::GetSeam (myFace, aE1, aE2);
|
|
||||||
|
|
||||||
if(aE1.IsNull() || aE2.IsNull()) {
|
|
||||||
closed = Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// modified by NIZHNY-MKK Wed May 12 15:44:14 2004.END
|
|
||||||
|
|
||||||
return closed;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsUVISO
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireEdgeSet::IsUVISO(const TopoDS_Edge& E,
|
|
||||||
const TopoDS_Face& F,
|
|
||||||
Standard_Boolean& uiso,
|
|
||||||
Standard_Boolean& viso)
|
|
||||||
{
|
|
||||||
uiso = viso = Standard_False;
|
|
||||||
Standard_Real fE, lE,tolpc;
|
|
||||||
|
|
||||||
Handle(Geom2d_Curve) PC;
|
|
||||||
BOPTools_Tools2D::CurveOnSurface (E, F, PC, fE, lE, tolpc, Standard_False);//
|
|
||||||
|
|
||||||
if (PC.IsNull()) {
|
|
||||||
Standard_ProgramError::Raise("BOP_WireEdgeSet::IsUVISO");
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(Standard_Type) TheType = PC->DynamicType();
|
|
||||||
if (TheType == STANDARD_TYPE(Geom2d_Line)) {
|
|
||||||
const Handle(Geom2d_Line)& HL = *((Handle(Geom2d_Line)*)&PC);
|
|
||||||
const gp_Dir2d& D = HL->Direction();
|
|
||||||
Standard_Real tol = Precision::Angular();
|
|
||||||
if (D.IsParallel(gp_Dir2d(0.,1.),tol)) {
|
|
||||||
uiso = Standard_True;
|
|
||||||
}
|
|
||||||
else if (D.IsParallel(gp_Dir2d(1.,0.),tol)) {
|
|
||||||
viso = Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsUClosed
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_WireEdgeSet::IsUClosed(const TopoDS_Shape& E) const
|
|
||||||
{
|
|
||||||
const TopoDS_Edge& EE = TopoDS::Edge(E);
|
|
||||||
|
|
||||||
Standard_Boolean bid, closed;
|
|
||||||
IsUVISO(EE, myFace, closed, bid);
|
|
||||||
return closed;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsVClosed
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_WireEdgeSet::IsVClosed(const TopoDS_Shape& E) const
|
|
||||||
{
|
|
||||||
const TopoDS_Edge& EE = TopoDS::Edge(E);
|
|
||||||
|
|
||||||
Standard_Boolean bid, closed;
|
|
||||||
IsUVISO (EE, myFace, bid, closed);
|
|
||||||
return closed;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Face
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const TopoDS_Face& BOP_WireEdgeSet::Face() const
|
|
||||||
{
|
|
||||||
return myFace;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_Tools::KeptTwice
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_WireEdgeSet::KeptTwice (const TopoDS_Edge& aSpEF2) const
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
Standard_Integer iCnt=0;
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& aWESList=StartElements();
|
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aWESList);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& aSS=anIt.Value();
|
|
||||||
if (aSpEF2.IsSame(aSS)) {
|
|
||||||
iCnt++;
|
|
||||||
if (iCnt > 1) {
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : BOP_Tools::RemoveEdgeFromWES
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireEdgeSet::RemoveEdgeFromWES(const TopoDS_Edge& aSpEF2)
|
|
||||||
|
|
||||||
{
|
|
||||||
TopTools_ListOfShape aTmpList;
|
|
||||||
aTmpList=StartElements();
|
|
||||||
|
|
||||||
ClearContents();
|
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aTmpList);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Shape& aSS=anIt.Value();
|
|
||||||
if (!aSpEF2.IsEqual(aSS)) {
|
|
||||||
AddStartElement(aSS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// modified by NIZHNY-MKK Fri May 30 10:18:38 2003.BEGIN
|
|
||||||
void GetOrientationVOnE(const TopoDS_Shape& V,
|
|
||||||
const TopoDS_Shape& E1,
|
|
||||||
const TopoDS_Shape& E2,
|
|
||||||
TopAbs_Orientation& o1,
|
|
||||||
TopAbs_Orientation& o2) {
|
|
||||||
TopTools_IndexedMapOfShape aMap;
|
|
||||||
|
|
||||||
TopExp::MapShapes(E1, TopAbs_VERTEX, aMap);
|
|
||||||
TopExp::MapShapes(E2, TopAbs_VERTEX, aMap);
|
|
||||||
|
|
||||||
if(aMap.Extent() > 1) {
|
|
||||||
TopExp_Explorer ex1, ex2;
|
|
||||||
ex1.Init(E1,TopAbs_VERTEX);
|
|
||||||
|
|
||||||
for(; ex1.More(); ex1.Next()) {
|
|
||||||
|
|
||||||
if (V.IsSame(ex1.Current())) {
|
|
||||||
ex2.Init(E2,TopAbs_VERTEX);
|
|
||||||
|
|
||||||
for(; ex2.More(); ex2.Next()) {
|
|
||||||
|
|
||||||
if (V.IsSame(ex2.Current())) {
|
|
||||||
o1 = ex1.Current().Orientation();
|
|
||||||
o2 = ex2.Current().Orientation();
|
|
||||||
|
|
||||||
if ( o1 != o2 ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopoDS_Shape VV = V;
|
|
||||||
|
|
||||||
if(E1.Orientation() == TopAbs_REVERSED)
|
|
||||||
VV.Reverse();
|
|
||||||
o1 = VV.Orientation();
|
|
||||||
VV.Reverse();
|
|
||||||
o2 = VV.Orientation();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// modified by NIZHNY-MKK Fri May 30 10:18:40 2003.END
|
|
@ -1,62 +0,0 @@
|
|||||||
-- Created on: 2002-02-04
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2002-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 WireShape from BOP inherits Builder from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
-- The Root class to perform a Boolean Operations (BO)
|
|
||||||
-- Common,Cut,Fuse between arguments when one of them is
|
|
||||||
-- a wire
|
|
||||||
|
|
||||||
uses
|
|
||||||
-- Wire from TopoDS,
|
|
||||||
ListOfShape from TopTools
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns WireShape from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
--
|
|
||||||
-- W E S C O M P O N E N T S
|
|
||||||
--
|
|
||||||
-- (for internal usage)
|
|
||||||
--
|
|
||||||
--
|
|
||||||
AddSplitPartsINOUT(me:out);
|
|
||||||
|
|
||||||
AddSplitPartsON(me:out);
|
|
||||||
|
|
||||||
MakeResult(me:out);
|
|
||||||
---Purpose:
|
|
||||||
--- Constructs the result of the BO
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myLS : ListOfShape from TopTools
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
end WireShape;
|
|
@ -1,358 +0,0 @@
|
|||||||
// Created on: 2002-02-04
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2002-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 <BOP_WireShape.ixx>
|
|
||||||
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Compound.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
#include <TopoDS_Vertex.hxx>
|
|
||||||
#include <TopoDS_Wire.hxx>
|
|
||||||
|
|
||||||
#include <TopAbs_ShapeEnum.hxx>
|
|
||||||
#include <TopAbs_Orientation.hxx>
|
|
||||||
|
|
||||||
#include <TopTools_ListOfShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
#include <BRep_Builder.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_DSFiller.hxx>
|
|
||||||
#include <BOPTools_PaveFiller.hxx>
|
|
||||||
#include <BOPTools_SplitShapesPool.hxx>
|
|
||||||
#include <BOPTools_PaveBlock.hxx>
|
|
||||||
#include <BOPTools_ListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_CommonBlockPool.hxx>
|
|
||||||
#include <BOPTools_CommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListOfCommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
|
|
||||||
|
|
||||||
#include <BOP_CorrectTolerances.hxx>
|
|
||||||
#include <BOP_BuilderTools.hxx>
|
|
||||||
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
#include <BooleanOperations_StateOfShape.hxx>
|
|
||||||
|
|
||||||
#include <BOP_BuilderTools.hxx>
|
|
||||||
#include <BOP_ConnexityBlock.hxx>
|
|
||||||
#include <BOP_ListOfConnexityBlock.hxx>
|
|
||||||
#include <BOP_ListIteratorOfListOfConnexityBlock.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
Standard_Integer InOrOut(const TopoDS_Vertex& ,
|
|
||||||
const TopoDS_Edge& );
|
|
||||||
static
|
|
||||||
TopAbs_Orientation Orientation(const TopoDS_Vertex& ,
|
|
||||||
const TopoDS_Edge& );
|
|
||||||
static
|
|
||||||
void OrientEdgesOnWire(const TopoDS_Wire& ,
|
|
||||||
TopoDS_Wire& );
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_WireShape::BOP_WireShape
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_WireShape::BOP_WireShape()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: MakeResult
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireShape::MakeResult()
|
|
||||||
{
|
|
||||||
BRep_Builder aBB;
|
|
||||||
TopoDS_Compound aCompound;
|
|
||||||
|
|
||||||
aBB.MakeCompound(aCompound);
|
|
||||||
|
|
||||||
TopoDS_Wire aWNew;
|
|
||||||
BOP_ListOfConnexityBlock aLCB;
|
|
||||||
BOP_BuilderTools::MakeConnexityBlocks(myLS, TopAbs_EDGE, aLCB);
|
|
||||||
BOP_ListIteratorOfListOfConnexityBlock aLCBIt(aLCB);
|
|
||||||
for (; aLCBIt.More(); aLCBIt.Next()) {
|
|
||||||
const BOP_ConnexityBlock& aCB=aLCBIt.Value();
|
|
||||||
const TopTools_ListOfShape& aLE=aCB.Shapes();
|
|
||||||
TopoDS_Wire aW;
|
|
||||||
aBB.MakeWire(aW);
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt(aLE);
|
|
||||||
for (; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Edge& aE=TopoDS::Edge(anIt.Value());
|
|
||||||
aBB.Add(aW, aE);
|
|
||||||
}
|
|
||||||
OrientEdgesOnWire(aW, aWNew);
|
|
||||||
aBB.Add(aCompound, aWNew);
|
|
||||||
}
|
|
||||||
myResult=aCompound;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: AddSplitPartsINOUT
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireShape::AddSplitPartsINOUT()
|
|
||||||
{
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
|
|
||||||
const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool();
|
|
||||||
//
|
|
||||||
Standard_Integer i, aNbPB, iRank, nSp, iBeg, iEnd;
|
|
||||||
TopAbs_ShapeEnum aType, aTypeArg1, aTypeArg2;
|
|
||||||
BooleanOperations_StateOfShape aState, aStateCmp;
|
|
||||||
//
|
|
||||||
aTypeArg1=aDS.Object().ShapeType();
|
|
||||||
aTypeArg2=aDS.Tool().ShapeType();
|
|
||||||
|
|
||||||
iBeg=1;
|
|
||||||
iEnd=aDS.NumberOfShapesOfTheObject();
|
|
||||||
|
|
||||||
if (aTypeArg1!=TopAbs_WIRE && aTypeArg2==TopAbs_WIRE) {
|
|
||||||
iBeg=iEnd+1;
|
|
||||||
iEnd=aDS.NumberOfSourceShapes();
|
|
||||||
}
|
|
||||||
else if (aTypeArg1==TopAbs_WIRE && aTypeArg2==TopAbs_WIRE){
|
|
||||||
iBeg=1;
|
|
||||||
iEnd=aDS.NumberOfSourceShapes();
|
|
||||||
}
|
|
||||||
//
|
|
||||||
|
|
||||||
for (i=iBeg; i<=iEnd; ++i) {
|
|
||||||
aType=aDS.GetShapeType(i);
|
|
||||||
if (aType!=TopAbs_EDGE) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const TopoDS_Edge& aE=TopoDS::Edge(aDS.Shape(i));
|
|
||||||
|
|
||||||
iRank=aDS.Rank(i);
|
|
||||||
aStateCmp=BOP_BuilderTools::StateToCompare(iRank, myOperation);
|
|
||||||
|
|
||||||
const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(i));
|
|
||||||
aNbPB=aLPB.Extent();
|
|
||||||
//
|
|
||||||
if (!aNbPB) {
|
|
||||||
aState=aDS.GetState(i);
|
|
||||||
if (aState==aStateCmp) {
|
|
||||||
myLS.Append(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
else {
|
|
||||||
BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aLPB);
|
|
||||||
for (; aPBIt.More(); aPBIt.Next()) {
|
|
||||||
const BOPTools_PaveBlock& aPB=aPBIt.Value();
|
|
||||||
nSp=aPB.Edge();
|
|
||||||
const TopoDS_Edge& aSS=TopoDS::Edge(aDS.Shape(nSp));
|
|
||||||
aState=aDS.GetState(nSp);
|
|
||||||
if (aState==aStateCmp) {
|
|
||||||
myLS.Append(aSS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: AddSplitPartsON
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireShape::AddSplitPartsON()
|
|
||||||
{
|
|
||||||
if (myOperation==BOP_CUT || myOperation==BOP_CUT21) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
|
|
||||||
const BOPTools_CommonBlockPool& aCommonBlockPool=aPaveFiller.CommonBlockPool();
|
|
||||||
|
|
||||||
Standard_Integer i, aNbCB, nSpTaken, iBeg, iEnd;
|
|
||||||
TopAbs_ShapeEnum aType, aTypeArg1, aTypeArg2;
|
|
||||||
BOPTools_ListIteratorOfListOfCommonBlock anItCB;
|
|
||||||
//
|
|
||||||
aTypeArg1=aDS.Object().ShapeType();
|
|
||||||
aTypeArg2=aDS.Tool().ShapeType();
|
|
||||||
|
|
||||||
iBeg=1;
|
|
||||||
iEnd=aDS.NumberOfShapesOfTheObject();
|
|
||||||
if (aTypeArg1!=TopAbs_WIRE && aTypeArg2==TopAbs_WIRE) {
|
|
||||||
iBeg=iEnd+1;
|
|
||||||
iEnd=aDS.NumberOfSourceShapes();
|
|
||||||
}
|
|
||||||
else if (aTypeArg1==TopAbs_WIRE && aTypeArg2==TopAbs_WIRE){
|
|
||||||
iEnd=aDS.NumberOfSourceShapes();
|
|
||||||
}
|
|
||||||
//
|
|
||||||
for (i=iBeg; i<=iEnd; ++i) {
|
|
||||||
aType=aDS.GetShapeType(i);
|
|
||||||
if (aType!=TopAbs_EDGE) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
const BOPTools_ListOfCommonBlock& aLCB=aCommonBlockPool(aDS.RefEdge(i));
|
|
||||||
aNbCB=aLCB.Extent();
|
|
||||||
|
|
||||||
anItCB.Initialize(aLCB);
|
|
||||||
for (; anItCB.More(); anItCB.Next()) {
|
|
||||||
BOPTools_CommonBlock& aCB=anItCB.Value();
|
|
||||||
const BOPTools_PaveBlock& aPB=aCB.PaveBlock1();
|
|
||||||
nSpTaken=aPB.Edge();
|
|
||||||
const TopoDS_Edge& aSS=TopoDS::Edge(aDS.Shape(nSpTaken));
|
|
||||||
myLS.Append(aSS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: OrientEdgesOnWire
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void OrientEdgesOnWire(const TopoDS_Wire& aWire,
|
|
||||||
TopoDS_Wire& aWireNew)
|
|
||||||
{
|
|
||||||
Standard_Integer i, aNbV, aNbE, j, iCnt, iInOrOut, aNbRest;
|
|
||||||
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aVEMap;
|
|
||||||
TopTools_IndexedMapOfShape aProcessedEdges, aRestEdges, aEMap;
|
|
||||||
TopTools_ListIteratorOfListOfShape anIt;
|
|
||||||
BRep_Builder aBB;
|
|
||||||
|
|
||||||
aBB.MakeWire(aWireNew);
|
|
||||||
|
|
||||||
TopExp::MapShapesAndAncestors(aWire, TopAbs_VERTEX, TopAbs_EDGE, aVEMap);
|
|
||||||
|
|
||||||
aNbV=aVEMap.Extent();
|
|
||||||
//
|
|
||||||
// Do
|
|
||||||
for (i=1; i<=aNbV; i++) {
|
|
||||||
const TopoDS_Vertex& aV=TopoDS::Vertex(aVEMap.FindKey(i));
|
|
||||||
|
|
||||||
const TopTools_ListOfShape& aLE=aVEMap.FindFromIndex(i);
|
|
||||||
aNbE=aLE.Extent();
|
|
||||||
|
|
||||||
if (aNbE>=2) {
|
|
||||||
iCnt=0;
|
|
||||||
anIt.Initialize(aLE);
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
const TopoDS_Edge& aE=TopoDS::Edge(anIt.Value());
|
|
||||||
if (aProcessedEdges.Contains(aE)) {
|
|
||||||
iInOrOut=InOrOut(aV, aE);
|
|
||||||
iCnt+=iInOrOut;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aRestEdges.Add(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TopoDS_Edge* pE;
|
|
||||||
aNbRest=aRestEdges.Extent();
|
|
||||||
for (j=1; j<=aNbRest; j++) {
|
|
||||||
const TopoDS_Edge& aE=TopoDS::Edge(aRestEdges(j));
|
|
||||||
pE=(TopoDS_Edge*)&aE;
|
|
||||||
|
|
||||||
iInOrOut=InOrOut(aV, aE);
|
|
||||||
if (iCnt>0) {
|
|
||||||
if (iInOrOut>0) {
|
|
||||||
pE->Reverse();
|
|
||||||
}
|
|
||||||
--iCnt;
|
|
||||||
}
|
|
||||||
else if (iCnt<=0){
|
|
||||||
if (iInOrOut<0) {
|
|
||||||
pE->Reverse();
|
|
||||||
}
|
|
||||||
++iCnt;
|
|
||||||
}
|
|
||||||
aProcessedEdges.Add(*pE);
|
|
||||||
}
|
|
||||||
}//if (aNbE>=2)
|
|
||||||
}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
aNbE=aProcessedEdges.Extent();
|
|
||||||
for (i=1; i<=aNbE; i++) {
|
|
||||||
const TopoDS_Edge& aE=TopoDS::Edge(aProcessedEdges(i));
|
|
||||||
aBB.Add(aWireNew, aE);
|
|
||||||
}
|
|
||||||
|
|
||||||
TopExp::MapShapes(aWire, TopAbs_EDGE, aEMap);
|
|
||||||
|
|
||||||
aNbE=aEMap.Extent();
|
|
||||||
for (i=1; i<=aNbE; i++) {
|
|
||||||
const TopoDS_Edge& aE=TopoDS::Edge(aEMap(i));
|
|
||||||
if (!aProcessedEdges.Contains(aE)) {
|
|
||||||
aProcessedEdges.Add(aE);
|
|
||||||
aBB.Add(aWireNew, aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Orientation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
TopAbs_Orientation Orientation(const TopoDS_Vertex& aV,
|
|
||||||
const TopoDS_Edge& aE)
|
|
||||||
{
|
|
||||||
TopAbs_Orientation anOr=TopAbs_INTERNAL;
|
|
||||||
|
|
||||||
TopExp_Explorer anExp;
|
|
||||||
anExp.Init(aE, TopAbs_VERTEX);
|
|
||||||
for (; anExp.More(); anExp.Next()) {
|
|
||||||
const TopoDS_Vertex& aVE1=TopoDS::Vertex(anExp.Current());
|
|
||||||
if (aVE1.IsSame(aV)) {
|
|
||||||
anOr=aVE1.Orientation();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return anOr;
|
|
||||||
}
|
|
||||||
|
|
||||||
///=======================================================================
|
|
||||||
//function : InOrOut
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer InOrOut(const TopoDS_Vertex& aV,
|
|
||||||
const TopoDS_Edge& aE)
|
|
||||||
{
|
|
||||||
TopAbs_Orientation anOrV, anOrE;
|
|
||||||
anOrV=aV.Orientation();
|
|
||||||
anOrE=aE.Orientation();
|
|
||||||
if (anOrV==TopAbs_INTERNAL){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
anOrV=Orientation(aV, aE);
|
|
||||||
|
|
||||||
if (anOrV==anOrE) {
|
|
||||||
return -1; // escape
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 1; // entry
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
-- Created on: 2002-02-04
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2002-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 WireShell from BOP inherits WireShape from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
-- The class to perform a Boolean Operations (BO)
|
|
||||||
-- Common,Cut,Fuse between arguments when one of them is
|
|
||||||
-- a wire and other argument is a shell
|
|
||||||
--
|
|
||||||
uses
|
|
||||||
DSFiller from BOPTools,
|
|
||||||
PDSFiller from BOPTools,
|
|
||||||
--modified by NIZHNY-MKK Tue Sep 7 11:46:27 2004
|
|
||||||
ShapeEnum from TopAbs,
|
|
||||||
Operation from BOP,
|
|
||||||
ListOfShape from TopTools
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns WireShell from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
Do (me:out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- See base classes, please
|
|
||||||
---
|
|
||||||
DoWithFiller (me:out;
|
|
||||||
aDSF: DSFiller from BOPTools)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- See base classes, please
|
|
||||||
---
|
|
||||||
Destroy (me: in out)
|
|
||||||
is redefined;
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_WireShell(){Destroy();}"
|
|
||||||
---Purpose:
|
|
||||||
--- Destructor
|
|
||||||
---
|
|
||||||
BuildResult (me:out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- See base classes, please
|
|
||||||
---
|
|
||||||
--modified by NIZHNY-MKK Tue Sep 7 11:46:00 2004
|
|
||||||
CheckArgTypes(myclass; theType1, theType2: ShapeEnum from TopAbs;
|
|
||||||
theOperation: Operation from BOP)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Check the types of arguments.
|
|
||||||
--- Returns FALSE if types of arguments
|
|
||||||
--- are non-valid to be treated by the
|
|
||||||
--- agorithm
|
|
||||||
|
|
||||||
CheckArgTypes(me)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
|
|
||||||
--fields
|
|
||||||
|
|
||||||
end WireShell;
|
|
@ -1,195 +0,0 @@
|
|||||||
// Created on: 2002-02-04
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2002-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 <BOP_WireShell.ixx>
|
|
||||||
|
|
||||||
#include <Standard_Failure.hxx>
|
|
||||||
#include <Standard_ErrorHandler.hxx>
|
|
||||||
|
|
||||||
#include <TopAbs_ShapeEnum.hxx>
|
|
||||||
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
|
|
||||||
#include <BOPTColStd_Dump.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_DSFiller.hxx>
|
|
||||||
#include <BOPTools_PaveFiller.hxx>
|
|
||||||
#include <BOPTools_WireStateFiller.hxx>
|
|
||||||
|
|
||||||
#include <BOP_CorrectTolerances.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_WireShell::BOP_WireShell
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_WireShell::BOP_WireShell()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Destroy
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireShell::Destroy()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Do
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireShell::Do()
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
myIsDone=Standard_False;
|
|
||||||
//
|
|
||||||
// Filling the DS
|
|
||||||
BOPTools_DSFiller aDSFiller;
|
|
||||||
aDSFiller.SetShapes (myShape1, myShape2);
|
|
||||||
//
|
|
||||||
aDSFiller.Perform ();
|
|
||||||
//
|
|
||||||
DoWithFiller(aDSFiller);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoWithFiller
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireShell::DoWithFiller(const BOPTools_DSFiller& aDSFiller)
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
myIsDone=Standard_False;
|
|
||||||
//
|
|
||||||
myResultMap.Clear();
|
|
||||||
myModifiedMap.Clear();
|
|
||||||
//
|
|
||||||
myDSFiller=(BOPTools_DSFiller*) &aDSFiller;
|
|
||||||
//
|
|
||||||
try {
|
|
||||||
OCC_CATCH_SIGNALS
|
|
||||||
|
|
||||||
if(!myDSFiller->IsDone()) {
|
|
||||||
myErrorStatus = 1;
|
|
||||||
BOPTColStd_Dump::PrintMessage("DSFiller is invalid: Can not build result\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean bCheckTypes;
|
|
||||||
//
|
|
||||||
bCheckTypes=CheckArgTypes();
|
|
||||||
if (!bCheckTypes) {
|
|
||||||
myErrorStatus=10;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
Standard_Boolean bIsNewFiller;
|
|
||||||
bIsNewFiller=aDSFiller.IsNewFiller();
|
|
||||||
|
|
||||||
if (bIsNewFiller) {
|
|
||||||
//
|
|
||||||
// Preparing the States
|
|
||||||
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
|
|
||||||
BOPTools_WireStateFiller aStateFiller(aPaveFiller);
|
|
||||||
aStateFiller.Do();
|
|
||||||
|
|
||||||
aDSFiller.SetNewFiller(!bIsNewFiller);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
BuildResult();
|
|
||||||
//
|
|
||||||
BOP_CorrectTolerances::CorrectTolerances(myResult, 0.01);
|
|
||||||
//
|
|
||||||
FillModified();
|
|
||||||
myIsDone=Standard_True;
|
|
||||||
}
|
|
||||||
catch ( Standard_Failure ) {
|
|
||||||
myErrorStatus = 1;
|
|
||||||
BOPTColStd_Dump::PrintMessage("Can not build result\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BuildResult
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireShell::BuildResult()
|
|
||||||
{
|
|
||||||
AddSplitPartsINOUT();
|
|
||||||
AddSplitPartsON();
|
|
||||||
//
|
|
||||||
MakeResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: CheckArgTypes
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_WireShell::CheckArgTypes(const TopAbs_ShapeEnum theType1,
|
|
||||||
const TopAbs_ShapeEnum theType2,
|
|
||||||
const BOP_Operation theOperation)
|
|
||||||
{
|
|
||||||
Standard_Boolean bFlag=Standard_False;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (theType1==TopAbs_WIRE && theType2==TopAbs_SHELL) {
|
|
||||||
if (theOperation==BOP_FUSE || theOperation==BOP_CUT21) {
|
|
||||||
return bFlag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (theType1==TopAbs_SHELL && theType2==TopAbs_WIRE) {
|
|
||||||
if (theOperation==BOP_FUSE || theOperation==BOP_CUT) {
|
|
||||||
return bFlag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
return !bFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: CheckArgTypes
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_WireShell::CheckArgTypes() const
|
|
||||||
{
|
|
||||||
// Standard_Boolean bFlag=Standard_False;
|
|
||||||
|
|
||||||
TopAbs_ShapeEnum aT1, aT2;
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
|
|
||||||
aT1=aDS.Object().ShapeType();
|
|
||||||
aT2=aDS.Tool().ShapeType();
|
|
||||||
//
|
|
||||||
// if (aT1==TopAbs_WIRE && aT2==TopAbs_SHELL) {
|
|
||||||
// if (myOperation==BOP_FUSE || myOperation==BOP_CUT21) {
|
|
||||||
// return bFlag;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //
|
|
||||||
// if (aT1==TopAbs_SHELL && aT2==TopAbs_WIRE) {
|
|
||||||
// if (myOperation==BOP_FUSE || myOperation==BOP_CUT) {
|
|
||||||
// return bFlag;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //
|
|
||||||
// return !bFlag;
|
|
||||||
return CheckArgTypes(aT1, aT2, myOperation);
|
|
||||||
}
|
|
@ -1,95 +0,0 @@
|
|||||||
-- Created on: 2002-02-04
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2002-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 WireSolid from BOP inherits WireShape from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
-- The class is to perform a Boolean Operations (BO)
|
|
||||||
-- Common,Cut,Fuse between arguments when one of them is
|
|
||||||
-- a wire and other argument is a solid
|
|
||||||
--
|
|
||||||
|
|
||||||
uses
|
|
||||||
DSFiller from BOPTools,
|
|
||||||
PDSFiller from BOPTools,
|
|
||||||
HistoryCollector from BOP,
|
|
||||||
--modified by NIZHNY-MKK Tue Sep 7 11:42:36 2004
|
|
||||||
ShapeEnum from TopAbs,
|
|
||||||
Operation from BOP,
|
|
||||||
ListOfShape from TopTools
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns WireSolid from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
Do (me:out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- (See base classes, please)
|
|
||||||
---
|
|
||||||
DoWithFiller (me:out;
|
|
||||||
aDSF: DSFiller from BOPTools)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- (See base classes, please)
|
|
||||||
---
|
|
||||||
Destroy (me: in out)
|
|
||||||
is redefined;
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_WireSolid(){Destroy();}"
|
|
||||||
---Purpose:
|
|
||||||
--- Destructor
|
|
||||||
---
|
|
||||||
BuildResult (me:out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- (See base classes, please)
|
|
||||||
---
|
|
||||||
--modified by NIZHNY-MKK Tue Sep 7 11:41:46 2004
|
|
||||||
CheckArgTypes(myclass; theType1, theType2: ShapeEnum from TopAbs;
|
|
||||||
theOperation: Operation from BOP)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- Check the types of arguments.
|
|
||||||
--- Returns FALSE if types of arguments
|
|
||||||
--- are non-valid to be treated by the
|
|
||||||
--- agorithm
|
|
||||||
|
|
||||||
CheckArgTypes(me)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
AddSplitParts(me:out)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Internal usage
|
|
||||||
---
|
|
||||||
|
|
||||||
SetHistoryCollector(me: in out; theHistory: HistoryCollector from BOP)
|
|
||||||
is redefined virtual;
|
|
||||||
|
|
||||||
--fields
|
|
||||||
|
|
||||||
end WireSolid;
|
|
@ -1,282 +0,0 @@
|
|||||||
// Created on: 2002-02-04
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2002-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 <BOP_WireSolid.ixx>
|
|
||||||
|
|
||||||
#include <Standard_Failure.hxx>
|
|
||||||
#include <Standard_ErrorHandler.hxx>
|
|
||||||
|
|
||||||
#include <TopoDS.hxx>
|
|
||||||
#include <TopoDS_Edge.hxx>
|
|
||||||
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
#include <BooleanOperations_StateOfShape.hxx>
|
|
||||||
|
|
||||||
#include <BOPTColStd_Dump.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_SplitShapesPool.hxx>
|
|
||||||
#include <BOPTools_ListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_PaveBlock.hxx>
|
|
||||||
#include <BOPTools_DSFiller.hxx>
|
|
||||||
#include <BOPTools_PaveFiller.hxx>
|
|
||||||
#include <BOPTools_WireStateFiller.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
#include <BOP_CorrectTolerances.hxx>
|
|
||||||
#include <BOP_BuilderTools.hxx>
|
|
||||||
#include <BOP_WireSolidHistoryCollector.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_WireSolid::BOP_WireSolid
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_WireSolid::BOP_WireSolid()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Destroy
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireSolid::Destroy()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Do
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireSolid::Do()
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
myIsDone=Standard_False;
|
|
||||||
//
|
|
||||||
// Filling the DS
|
|
||||||
BOPTools_DSFiller aDSFiller;
|
|
||||||
aDSFiller.SetShapes (myShape1, myShape2);
|
|
||||||
//
|
|
||||||
aDSFiller.Perform ();
|
|
||||||
//
|
|
||||||
DoWithFiller(aDSFiller);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoWithFiller
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireSolid::DoWithFiller(const BOPTools_DSFiller& aDSFiller)
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
myIsDone=Standard_False;
|
|
||||||
myResultMap.Clear();
|
|
||||||
myModifiedMap.Clear();
|
|
||||||
myDSFiller=(BOPTools_DSFiller*) &aDSFiller;
|
|
||||||
//
|
|
||||||
try {
|
|
||||||
OCC_CATCH_SIGNALS
|
|
||||||
|
|
||||||
if(!myDSFiller->IsDone()) {
|
|
||||||
myErrorStatus = 1;
|
|
||||||
BOPTColStd_Dump::PrintMessage("DSFiller is invalid: Can not build result\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean bCheckTypes;
|
|
||||||
//
|
|
||||||
bCheckTypes=CheckArgTypes();
|
|
||||||
if (!bCheckTypes) {
|
|
||||||
myErrorStatus=10;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
Standard_Boolean bIsNewFiller;
|
|
||||||
bIsNewFiller=aDSFiller.IsNewFiller();
|
|
||||||
|
|
||||||
if (bIsNewFiller) {
|
|
||||||
//
|
|
||||||
// Preparing the States
|
|
||||||
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
|
|
||||||
BOPTools_WireStateFiller aStateFiller(aPaveFiller);
|
|
||||||
aStateFiller.Do();
|
|
||||||
|
|
||||||
aDSFiller.SetNewFiller(!bIsNewFiller);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
BuildResult();
|
|
||||||
//
|
|
||||||
BOP_CorrectTolerances::CorrectTolerances(myResult, 0.01);
|
|
||||||
//
|
|
||||||
FillModified();
|
|
||||||
|
|
||||||
if(!myHistory.IsNull()) {
|
|
||||||
Handle(BOP_WireSolidHistoryCollector) aHistory =
|
|
||||||
Handle(BOP_WireSolidHistoryCollector)::DownCast(myHistory);
|
|
||||||
aHistory->SetResult(myResult, myDSFiller);
|
|
||||||
}
|
|
||||||
myIsDone=Standard_True;
|
|
||||||
}
|
|
||||||
catch ( Standard_Failure ) {
|
|
||||||
myErrorStatus = 1;
|
|
||||||
BOPTColStd_Dump::PrintMessage("Can not build result\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BuildResult
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireSolid::BuildResult()
|
|
||||||
{
|
|
||||||
|
|
||||||
AddSplitParts();
|
|
||||||
//
|
|
||||||
MakeResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: CheckArgTypes
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_WireSolid::CheckArgTypes(const TopAbs_ShapeEnum theType1,
|
|
||||||
const TopAbs_ShapeEnum theType2,
|
|
||||||
const BOP_Operation theOperation)
|
|
||||||
{
|
|
||||||
Standard_Boolean bFlag=Standard_False;
|
|
||||||
|
|
||||||
if (theType1==TopAbs_WIRE && theType2==TopAbs_SOLID) {
|
|
||||||
if (theOperation==BOP_FUSE || theOperation==BOP_CUT21) {
|
|
||||||
return bFlag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (theType1==TopAbs_SOLID && theType2==TopAbs_WIRE) {
|
|
||||||
if (theOperation==BOP_FUSE || theOperation==BOP_CUT) {
|
|
||||||
return bFlag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
return !bFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: CheckArgTypes
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean BOP_WireSolid::CheckArgTypes() const
|
|
||||||
{
|
|
||||||
// Standard_Boolean bFlag=Standard_False;
|
|
||||||
|
|
||||||
TopAbs_ShapeEnum aT1, aT2;
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
|
|
||||||
aT1=aDS.Object().ShapeType();
|
|
||||||
aT2=aDS.Tool().ShapeType();
|
|
||||||
//
|
|
||||||
// if (aT1==TopAbs_WIRE && aT2==TopAbs_SOLID) {
|
|
||||||
// if (myOperation==BOP_FUSE || myOperation==BOP_CUT21) {
|
|
||||||
// return bFlag;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //
|
|
||||||
// if (aT1==TopAbs_SOLID && aT2==TopAbs_WIRE) {
|
|
||||||
// if (myOperation==BOP_FUSE || myOperation==BOP_CUT) {
|
|
||||||
// return bFlag;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //
|
|
||||||
// return !bFlag;
|
|
||||||
return CheckArgTypes(aT1, aT2, myOperation);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: AddSplitParts
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireSolid::AddSplitParts()
|
|
||||||
{
|
|
||||||
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
|
|
||||||
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
|
|
||||||
const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool();
|
|
||||||
//
|
|
||||||
Standard_Integer i, aNbPB, iRank, nSp, iBeg, iEnd;
|
|
||||||
TopAbs_ShapeEnum aType;
|
|
||||||
BooleanOperations_StateOfShape aState, aStateCmp;
|
|
||||||
|
|
||||||
iBeg=1;
|
|
||||||
iEnd=aDS.NumberOfShapesOfTheObject();
|
|
||||||
if (aDS.Tool().ShapeType()==TopAbs_WIRE) {
|
|
||||||
iBeg=iEnd+1;
|
|
||||||
iEnd=aDS.NumberOfSourceShapes();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=iBeg; i<=iEnd; ++i) {
|
|
||||||
aType=aDS.GetShapeType(i);
|
|
||||||
if (aType!=TopAbs_EDGE) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const TopoDS_Edge& aE=TopoDS::Edge(aDS.Shape(i));
|
|
||||||
iRank=aDS.Rank(i);
|
|
||||||
|
|
||||||
aStateCmp=BOP_BuilderTools::StateToCompare(iRank, myOperation);
|
|
||||||
|
|
||||||
const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(i));
|
|
||||||
aNbPB=aLPB.Extent();
|
|
||||||
//
|
|
||||||
if (!aNbPB) {
|
|
||||||
aState=aDS.GetState(i);
|
|
||||||
if (aState==aStateCmp) {
|
|
||||||
myLS.Append(aE);
|
|
||||||
}
|
|
||||||
if (myOperation==BOP_COMMON && aState==BooleanOperations_ON) {
|
|
||||||
myLS.Append(aE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
else {
|
|
||||||
BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aLPB);
|
|
||||||
for (; aPBIt.More(); aPBIt.Next()) {
|
|
||||||
const BOPTools_PaveBlock& aPB=aPBIt.Value();
|
|
||||||
nSp=aPB.Edge();
|
|
||||||
const TopoDS_Edge& aSS=TopoDS::Edge(aDS.Shape(nSp));
|
|
||||||
aState=aDS.GetState(nSp);
|
|
||||||
if (aState==aStateCmp) {
|
|
||||||
myLS.Append(aSS);
|
|
||||||
}
|
|
||||||
if (myOperation==BOP_COMMON && aState==BooleanOperations_ON) {
|
|
||||||
myLS.Append(aSS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetHistoryCollector
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireSolid::SetHistoryCollector(const Handle(BOP_HistoryCollector)& theHistory)
|
|
||||||
{
|
|
||||||
if(theHistory.IsNull() ||
|
|
||||||
!theHistory->IsKind(STANDARD_TYPE(BOP_WireSolidHistoryCollector)))
|
|
||||||
myHistory.Nullify();
|
|
||||||
else
|
|
||||||
myHistory = theHistory;
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
-- Created on: 2003-04-24
|
|
||||||
-- Created by: Michael KLOKOV
|
|
||||||
-- Copyright (c) 2003-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 WireSolidHistoryCollector from BOP inherits HistoryCollector from BOP
|
|
||||||
|
|
||||||
uses
|
|
||||||
Shape from TopoDS,
|
|
||||||
Operation from BOP,
|
|
||||||
PDSFiller from BOPTools,
|
|
||||||
ListOfShape from TopTools
|
|
||||||
is
|
|
||||||
Create(theShape1 : Shape from TopoDS;
|
|
||||||
theShape2 : Shape from TopoDS;
|
|
||||||
theOperation: Operation from BOP)
|
|
||||||
returns WireSolidHistoryCollector from BOP;
|
|
||||||
|
|
||||||
SetResult(me: mutable; theResult: Shape from TopoDS;
|
|
||||||
theDSFiller: PDSFiller from BOPTools)
|
|
||||||
is redefined virtual;
|
|
||||||
|
|
||||||
--- private
|
|
||||||
FillSection(me: mutable; theDSFiller: PDSFiller from BOPTools)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
FillEdgeHistory(me: mutable; theDSFiller: PDSFiller from BOPTools)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
end WireSolidHistoryCollector from BOP;
|
|
@ -1,664 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
#include <BOP_WireSolidHistoryCollector.ixx>
|
|
||||||
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
#include <TopAbs.hxx>
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
#include <BooleanOperations_IndexedDataMapOfShapeInteger.hxx>
|
|
||||||
#include <BOPTools_SSInterference.hxx>
|
|
||||||
#include <BOPTools_InterferencePool.hxx>
|
|
||||||
#include <BOPTools_CArray1OfSSInterference.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
|
|
||||||
#include <BOPTools_Curve.hxx>
|
|
||||||
#include <BOPTools_PaveBlock.hxx>
|
|
||||||
#include <BOPTools_DSFiller.hxx>
|
|
||||||
#include <BOPTools_PaveFiller.hxx>
|
|
||||||
#include <BOPTools_CommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListOfCommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
|
|
||||||
#include <BOPTools_ListIteratorOfListOfPave.hxx>
|
|
||||||
#include <BOPTools_PShapeShapeInterference.hxx>
|
|
||||||
#include <BOPTools_VVInterference.hxx>
|
|
||||||
|
|
||||||
#include <BOP_BuilderTools.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
#include <TopExp.hxx>
|
|
||||||
|
|
||||||
static Standard_Boolean AddNewShape(const TopoDS_Shape& theKey,
|
|
||||||
const TopoDS_Shape& theItem,
|
|
||||||
TopTools_DataMapOfShapeListOfShape& theMap);
|
|
||||||
|
|
||||||
static void GetAncestorFaces(const Standard_Integer theShapeIndex,
|
|
||||||
const BooleanOperations_ShapesDataStructure& theDS,
|
|
||||||
TopTools_IndexedMapOfShape& theFaces);
|
|
||||||
|
|
||||||
static Standard_Integer GetShapeWire(const BooleanOperations_ShapesDataStructure& theDS,
|
|
||||||
const TopoDS_Shape& S1,
|
|
||||||
const TopoDS_Shape& S2,
|
|
||||||
TopoDS_Shape& WS);
|
|
||||||
|
|
||||||
// ====================================================================================================
|
|
||||||
// function: Constructor
|
|
||||||
// purpose:
|
|
||||||
// ====================================================================================================
|
|
||||||
BOP_WireSolidHistoryCollector::BOP_WireSolidHistoryCollector(const TopoDS_Shape& theShape1,
|
|
||||||
const TopoDS_Shape& theShape2,
|
|
||||||
const BOP_Operation theOperation) :
|
|
||||||
BOP_HistoryCollector(theShape1, theShape2, theOperation)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ====================================================================================================
|
|
||||||
// function: SetResult
|
|
||||||
// purpose:
|
|
||||||
// ====================================================================================================
|
|
||||||
void BOP_WireSolidHistoryCollector::SetResult(const TopoDS_Shape& theResult,
|
|
||||||
const BOPTools_PDSFiller& theDSFiller)
|
|
||||||
{
|
|
||||||
myResult = theResult;
|
|
||||||
|
|
||||||
FillSection(theDSFiller);
|
|
||||||
FillEdgeHistory(theDSFiller);
|
|
||||||
|
|
||||||
myHasDeleted = Standard_False;
|
|
||||||
|
|
||||||
TopExp_Explorer anExp(myS1, TopAbs_FACE);
|
|
||||||
|
|
||||||
if(!anExp.More()) {
|
|
||||||
anExp.Init(myS2, TopAbs_FACE);
|
|
||||||
|
|
||||||
if(anExp.More()) {
|
|
||||||
myHasDeleted = Standard_True;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myHasDeleted = Standard_True;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
|
|
||||||
for(i = (Standard_Integer)TopAbs_EDGE; !myHasDeleted && (i < (Standard_Integer)TopAbs_VERTEX); i++) {
|
|
||||||
TopAbs_ShapeEnum aType = (TopAbs_ShapeEnum) i;
|
|
||||||
TopTools_IndexedMapOfShape aMap;
|
|
||||||
TopExp::MapShapes(myResult, aType, aMap);
|
|
||||||
|
|
||||||
TopExp_Explorer anExpObj(myS1, aType);
|
|
||||||
|
|
||||||
for(; anExpObj.More(); anExpObj.Next()) {
|
|
||||||
const TopoDS_Shape& aS = anExpObj.Current();
|
|
||||||
|
|
||||||
if(!aMap.Contains(aS)) {
|
|
||||||
|
|
||||||
if((!myModifMap.IsBound(aS) || myModifMap(aS).IsEmpty()) &&
|
|
||||||
(!myGenMap.IsBound(aS) || myGenMap(aS).IsEmpty())) {
|
|
||||||
myHasDeleted = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TopExp_Explorer anExpTool(myS2, aType);
|
|
||||||
|
|
||||||
for(; anExpTool.More(); anExpTool.Next()) {
|
|
||||||
const TopoDS_Shape& aS = anExpTool.Current();
|
|
||||||
|
|
||||||
if(!aMap.Contains(aS)) {
|
|
||||||
if((!myModifMap.IsBound(aS) || myModifMap(aS).IsEmpty()) &&
|
|
||||||
(!myGenMap.IsBound(aS) || myGenMap(aS).IsEmpty())) {
|
|
||||||
myHasDeleted = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ====================================================================================================
|
|
||||||
// function: FillSection
|
|
||||||
// purpose:
|
|
||||||
// ====================================================================================================
|
|
||||||
void BOP_WireSolidHistoryCollector::FillSection(const BOPTools_PDSFiller& theDSFiller)
|
|
||||||
{
|
|
||||||
// for edges
|
|
||||||
BOPTools_InterferencePool* pIntrPool = (BOPTools_InterferencePool*)&theDSFiller->InterfPool();
|
|
||||||
const BOPTools_PavePool& aPavePool = theDSFiller->PaveFiller().PavePool();
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS = theDSFiller->DS();
|
|
||||||
Standard_Integer nb = aDS.NumberOfShapesOfTheObject() + aDS.NumberOfShapesOfTheTool();
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
TopTools_IndexedMapOfShape aResultMap;
|
|
||||||
|
|
||||||
if(!myResult.IsNull()) {
|
|
||||||
TopExp::MapShapes(myResult, TopAbs_VERTEX, aResultMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 1; i <= nb; i++) {
|
|
||||||
if(aDS.GetShapeType(i) != TopAbs_EDGE)
|
|
||||||
continue;
|
|
||||||
const BOPTools_PaveSet& aPaveSet = aPavePool.Value(aDS.RefEdge(i));
|
|
||||||
const BOPTools_ListOfPave& aListOfPave = aPaveSet.Set();
|
|
||||||
BOPTools_ListIteratorOfListOfPave anIt(aListOfPave);
|
|
||||||
TopTools_IndexedMapOfShape aMapOfVertex;
|
|
||||||
|
|
||||||
for(; anIt.More(); anIt.Next()) {
|
|
||||||
const BOPTools_Pave& aPave = anIt.Value();
|
|
||||||
|
|
||||||
if((aPave.Type() == BooleanOperations_EdgeSurface) ||
|
|
||||||
(aPave.Type() == BooleanOperations_EdgeEdge) ||
|
|
||||||
(aPave.Type() == BooleanOperations_VertexEdge)) {
|
|
||||||
BOPTools_PShapeShapeInterference anInter = pIntrPool->GetInterference(aPave.Interference(), aPave.Type());
|
|
||||||
|
|
||||||
if(anInter != NULL) {
|
|
||||||
const TopoDS_Shape& aS1 = aDS.Shape(anInter->Index1());
|
|
||||||
const TopoDS_Shape& aS2 = aDS.Shape(anInter->Index2());
|
|
||||||
const TopoDS_Shape& aNewShape = aDS.Shape(anInter->NewShape());
|
|
||||||
|
|
||||||
if(aNewShape.ShapeType() != TopAbs_VERTEX)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Standard_Boolean addfirst = Standard_False;
|
|
||||||
Standard_Boolean addsecond = Standard_False;
|
|
||||||
|
|
||||||
if(aResultMap.Contains(aNewShape)) {
|
|
||||||
if(i == anInter->Index1()) {
|
|
||||||
addfirst = Standard_True;
|
|
||||||
|
|
||||||
if(aS1.IsSame(aNewShape)) {
|
|
||||||
aMapOfVertex.Add(aNewShape);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(aPave.Type() != BooleanOperations_EdgeEdge) {
|
|
||||||
addsecond = Standard_True;
|
|
||||||
|
|
||||||
if(aS2.IsSame(aNewShape)) {
|
|
||||||
aMapOfVertex.Add(aNewShape);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
addsecond = Standard_True;
|
|
||||||
|
|
||||||
if(aS2.IsSame(aNewShape)) {
|
|
||||||
aMapOfVertex.Add(aNewShape);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(aPave.Type() != BooleanOperations_EdgeEdge) {
|
|
||||||
addfirst = Standard_True;
|
|
||||||
|
|
||||||
if(aS1.IsSame(aNewShape)) {
|
|
||||||
aMapOfVertex.Add(aNewShape);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TopTools_ListOfShape thelist;
|
|
||||||
if(addfirst) {
|
|
||||||
// modified by NIZHNY-3643 Thu Nov 13 17:33:38 2003 .b
|
|
||||||
if( aPave.Type() == BooleanOperations_EdgeEdge) {
|
|
||||||
TopTools_IndexedMapOfShape aSharedFaces;
|
|
||||||
aSharedFaces.Clear();
|
|
||||||
GetAncestorFaces(i,aDS,aSharedFaces);
|
|
||||||
Standard_Integer anbFaces = aSharedFaces.Extent();
|
|
||||||
if( anbFaces != 0 ) {
|
|
||||||
Standard_Integer iFace = 0;
|
|
||||||
for( iFace = 1; iFace <= anbFaces; iFace++ ) {
|
|
||||||
if(!myGenMap.IsBound(aSharedFaces.FindKey(iFace)))
|
|
||||||
myGenMap.Bind(aSharedFaces.FindKey(iFace), thelist);
|
|
||||||
myGenMap.ChangeFind(aSharedFaces.FindKey(iFace)).Append(aNewShape);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(!myGenMap.IsBound(aS1))
|
|
||||||
myGenMap.Bind(aS1, thelist);
|
|
||||||
myGenMap.ChangeFind(aS1).Append(aNewShape);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(!myGenMap.IsBound(aS1))
|
|
||||||
myGenMap.Bind(aS1, thelist);
|
|
||||||
myGenMap.ChangeFind(aS1).Append(aNewShape);
|
|
||||||
}
|
|
||||||
// modified by NIZHNY-3643 Thu Nov 13 17:34:45 2003 .e
|
|
||||||
}
|
|
||||||
|
|
||||||
if(addsecond) {
|
|
||||||
// modified by NIZHNY-3643 Thu Nov 13 17:33:38 2003 .b
|
|
||||||
if( aPave.Type() == BooleanOperations_EdgeEdge) {
|
|
||||||
TopTools_IndexedMapOfShape aSharedFaces;
|
|
||||||
aSharedFaces.Clear();
|
|
||||||
GetAncestorFaces(i,aDS,aSharedFaces);
|
|
||||||
Standard_Integer anbFaces = aSharedFaces.Extent();
|
|
||||||
if( anbFaces != 0 ) {
|
|
||||||
Standard_Integer iFace = 0;
|
|
||||||
for( iFace = 1; iFace <= anbFaces; iFace++ ) {
|
|
||||||
if(!myGenMap.IsBound(aSharedFaces.FindKey(iFace)))
|
|
||||||
myGenMap.Bind(aSharedFaces.FindKey(iFace), thelist);
|
|
||||||
myGenMap.ChangeFind(aSharedFaces.FindKey(iFace)).Append(aNewShape);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(!myGenMap.IsBound(aS2))
|
|
||||||
myGenMap.Bind(aS2, thelist);
|
|
||||||
myGenMap.ChangeFind(aS2).Append(aNewShape);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(!myGenMap.IsBound(aS2))
|
|
||||||
myGenMap.Bind(aS2, thelist);
|
|
||||||
myGenMap.ChangeFind(aS2).Append(aNewShape);
|
|
||||||
}
|
|
||||||
// modified by NIZHNY-3643 Thu Nov 13 19:01:19 2003 .e
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// end for(; anIt.More...
|
|
||||||
|
|
||||||
// fill history for edges which vertices are on other shape.begin
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aMapOfOldNewVertex, aVEMap;
|
|
||||||
TopExp::MapShapesAndAncestors(myResult, TopAbs_VERTEX, TopAbs_EDGE, aVEMap);
|
|
||||||
Standard_Integer j = 0, k = 0;
|
|
||||||
TopTools_ListOfShape thelist1;
|
|
||||||
for(j = 1; j <= aDS.NumberOfSuccessors(i); j++) {
|
|
||||||
Standard_Integer avindex = aDS.GetSuccessor(i, j);
|
|
||||||
|
|
||||||
BOPTools_CArray1OfVVInterference& VVs = pIntrPool->VVInterferences();
|
|
||||||
Standard_Integer aNb = VVs.Extent();
|
|
||||||
|
|
||||||
for (k = 1; k <= aNb; k++) {
|
|
||||||
BOPTools_VVInterference& VV=VVs(k);
|
|
||||||
Standard_Integer anIndex1 = VV.Index1();
|
|
||||||
Standard_Integer anIndex2 = VV.Index2();
|
|
||||||
|
|
||||||
if((avindex == anIndex1) || (avindex == anIndex2)) {
|
|
||||||
Standard_Integer aNewShapeIndex = VV.NewShape();
|
|
||||||
TopoDS_Shape aNewShape = aDS.Shape(aNewShapeIndex);
|
|
||||||
|
|
||||||
if(!aVEMap.Contains(aNewShape))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(aVEMap.FindFromKey(aNewShape).Extent() >= 2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for(Standard_Integer vit = 0; vit < 2; vit++) {
|
|
||||||
TopoDS_Shape aShape = (vit == 0) ? aDS.Shape(anIndex1) : aDS.Shape(anIndex2);
|
|
||||||
|
|
||||||
if(!aMapOfOldNewVertex.Contains(aShape))
|
|
||||||
aMapOfOldNewVertex.Add(aShape, thelist1);
|
|
||||||
aMapOfOldNewVertex.ChangeFromKey(aShape).Append(aNewShape);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(Standard_Integer aninterit = 0; aninterit < 2; aninterit++) {
|
|
||||||
|
|
||||||
if(aninterit == 0)
|
|
||||||
aNb = pIntrPool->VEInterferences().Extent();
|
|
||||||
else
|
|
||||||
aNb = pIntrPool->VSInterferences().Extent();
|
|
||||||
|
|
||||||
for (k = 1; k <= aNb; k++) {
|
|
||||||
BOPTools_ShapeShapeInterference* anInterference = NULL;
|
|
||||||
|
|
||||||
if(aninterit == 0)
|
|
||||||
anInterference = (BOPTools_ShapeShapeInterference*)(&pIntrPool->VEInterferences().Value(k));
|
|
||||||
else
|
|
||||||
anInterference = (BOPTools_ShapeShapeInterference*)(&pIntrPool->VSInterferences().Value(k));
|
|
||||||
Standard_Integer anIndex1 = anInterference->Index1();
|
|
||||||
Standard_Integer anIndex2 = anInterference->Index2();
|
|
||||||
|
|
||||||
if((avindex == anIndex1) || (avindex == anIndex2)) {
|
|
||||||
Standard_Integer aNewShapeIndex = anInterference->NewShape();
|
|
||||||
TopoDS_Shape aNewShape = aDS.Shape(aNewShapeIndex);
|
|
||||||
|
|
||||||
if(!aVEMap.Contains(aNewShape))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(aVEMap.FindFromKey(aNewShape).Extent() >= 2)
|
|
||||||
continue;
|
|
||||||
TopoDS_Shape aShape1 = aDS.Shape(avindex);
|
|
||||||
TopoDS_Shape aShape2 = (avindex == anIndex1) ? aDS.Shape(anIndex2) : aDS.Shape(anIndex1);
|
|
||||||
|
|
||||||
if(!aMapOfOldNewVertex.Contains(aShape1))
|
|
||||||
aMapOfOldNewVertex.Add(aShape1, thelist1);
|
|
||||||
aMapOfOldNewVertex.ChangeFromKey(aShape1).Append(aNewShape);
|
|
||||||
|
|
||||||
AddNewShape(aShape2, aNewShape, myGenMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// modified by NIZHNY-3643 Fri Nov 14 09:59:47 2003 .b
|
|
||||||
TopoDS_Shape WShape;
|
|
||||||
Standard_Integer wRank = GetShapeWire(aDS,myS1,myS2,WShape);
|
|
||||||
// modified by NIZHNY-3643 Fri Nov 14 09:59:53 2003 .e
|
|
||||||
|
|
||||||
if(!aMapOfOldNewVertex.IsEmpty()) {
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
|
|
||||||
|
|
||||||
// modified by NIZHNY-3643 Fri Nov 14 10:01:32 2003 .b
|
|
||||||
Standard_Integer iSh = 0;
|
|
||||||
TopoDS_Shape aCShape;
|
|
||||||
for( iSh = 1; iSh <= 2; iSh ++ ) {
|
|
||||||
|
|
||||||
if( iSh == 1 ) {
|
|
||||||
TopExp::MapShapesAndAncestors(myS1, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
|
|
||||||
aCShape = myS1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aMapVE.Clear();
|
|
||||||
TopExp::MapShapesAndAncestors(myS2, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
|
|
||||||
aCShape = myS2;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer vit = 0;
|
|
||||||
|
|
||||||
for(vit = 1; vit <= aMapOfOldNewVertex.Extent(); vit++) {
|
|
||||||
const TopoDS_Shape& aV = aMapOfOldNewVertex.FindKey(vit);
|
|
||||||
|
|
||||||
if(!aMapVE.Contains(aV))
|
|
||||||
continue;
|
|
||||||
TopTools_ListIteratorOfListOfShape aEIt(aMapVE.FindFromKey(aV));
|
|
||||||
const TopTools_ListOfShape& aNewVList = aMapOfOldNewVertex.FindFromIndex(vit);
|
|
||||||
|
|
||||||
if(aNewVList.IsEmpty())
|
|
||||||
continue;
|
|
||||||
TopoDS_Shape aNewShape = aNewVList.First();
|
|
||||||
|
|
||||||
// for wire old
|
|
||||||
if( aCShape.IsSame(WShape) ) {
|
|
||||||
for(; aEIt.More(); aEIt.Next()) {
|
|
||||||
const TopoDS_Shape& aE = aEIt.Value();
|
|
||||||
AddNewShape(aE, aNewShape, myGenMap);
|
|
||||||
}
|
|
||||||
// avoid shared edges from solids here
|
|
||||||
Standard_Integer eRank = aDS.Rank(i);
|
|
||||||
if( eRank != wRank ) {
|
|
||||||
TopTools_IndexedMapOfShape aSharedFaces;
|
|
||||||
aSharedFaces.Clear();
|
|
||||||
GetAncestorFaces(i,aDS,aSharedFaces);
|
|
||||||
if( aSharedFaces.Extent() == 1 ) {
|
|
||||||
TopoDS_Shape aE = aDS.Shape(i);
|
|
||||||
AddNewShape(aE, aNewShape, myGenMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopoDS_Shape aE = aDS.Shape(i);
|
|
||||||
AddNewShape(aE, aNewShape, myGenMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// for solid new
|
|
||||||
TopTools_IndexedMapOfShape aSharedFaces;
|
|
||||||
aSharedFaces.Clear();
|
|
||||||
Standard_Integer sRank = (wRank == 1) ? 2 : 1;
|
|
||||||
for(; aEIt.More(); aEIt.Next()) {
|
|
||||||
const TopoDS_Shape& aE = aEIt.Value();
|
|
||||||
Standard_Integer iE = aDS.ShapeIndex(aE,sRank);
|
|
||||||
if( iE != 0 )
|
|
||||||
GetAncestorFaces(iE,aDS,aSharedFaces);
|
|
||||||
}
|
|
||||||
TopoDS_Shape aE = aDS.Shape(i);
|
|
||||||
Standard_Integer iE = aDS.ShapeIndex(aE,sRank);
|
|
||||||
if( iE != 0 )
|
|
||||||
GetAncestorFaces(iE,aDS,aSharedFaces);
|
|
||||||
if( aSharedFaces.Extent() != 0 ) {
|
|
||||||
Standard_Integer anbFaces = aSharedFaces.Extent();
|
|
||||||
Standard_Integer iFace = 0;
|
|
||||||
for( iFace = 1; iFace <= anbFaces; iFace++ ) {
|
|
||||||
AddNewShape(aSharedFaces.FindKey(iFace), aNewShape, myGenMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// modified by NIZHNY-3643 Fri Nov 14 10:02:19 2003 .e
|
|
||||||
}
|
|
||||||
// fill history for edges which vertices are on other shape.end
|
|
||||||
|
|
||||||
if(!aMapOfVertex.IsEmpty()) {
|
|
||||||
if(!myResult.IsNull()) {
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
|
|
||||||
TopExp::MapShapesAndAncestors(myS1, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
|
|
||||||
TopExp::MapShapesAndAncestors(myS2, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
|
|
||||||
Standard_Integer vit = 0;
|
|
||||||
|
|
||||||
for(vit = 1; vit <= aMapOfVertex.Extent(); vit++) {
|
|
||||||
const TopoDS_Shape& aV = aMapOfVertex(vit);
|
|
||||||
|
|
||||||
if(!aMapVE.Contains(aV))
|
|
||||||
continue;
|
|
||||||
TopTools_ListIteratorOfListOfShape aEIt(aMapVE.FindFromKey(aV));
|
|
||||||
|
|
||||||
for(; aEIt.More(); aEIt.Next()) {
|
|
||||||
const TopoDS_Shape& aE = aEIt.Value();
|
|
||||||
AddNewShape(aE, aV, myGenMap);
|
|
||||||
}
|
|
||||||
TopoDS_Shape aE = aDS.Shape(i);
|
|
||||||
AddNewShape(aE, aV, myGenMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ====================================================================================================
|
|
||||||
// function: FillEdgeHistory
|
|
||||||
// purpose: Fills modified map for edges,
|
|
||||||
// fills generated map for edges (vertex type of intersection, edge type of intersection)
|
|
||||||
// ====================================================================================================
|
|
||||||
void BOP_WireSolidHistoryCollector::FillEdgeHistory(const BOPTools_PDSFiller& theDSFiller)
|
|
||||||
{
|
|
||||||
const BooleanOperations_ShapesDataStructure& aDS = theDSFiller->DS();
|
|
||||||
const BOPTools_PaveFiller& aPaveFiller = theDSFiller->PaveFiller();
|
|
||||||
const BOPTools_SplitShapesPool& aSplitShapesPool = aPaveFiller.SplitShapesPool();
|
|
||||||
TopTools_IndexedMapOfShape aResultMap;
|
|
||||||
|
|
||||||
if(!myResult.IsNull()) {
|
|
||||||
TopExp::MapShapes(myResult, TopAbs_EDGE, aResultMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer iRank = 1;
|
|
||||||
|
|
||||||
for(; iRank <= 2; iRank++) {
|
|
||||||
BooleanOperations_StateOfShape aStateCmp, aState;
|
|
||||||
aStateCmp = BOP_BuilderTools::StateToCompare(iRank, myOp);
|
|
||||||
Standard_Integer i = 0;
|
|
||||||
Standard_Integer nb = aDS.NumberOfShapesOfTheObject();
|
|
||||||
nb = (iRank == 1) ? nb : (nb + aDS.NumberOfShapesOfTheTool());
|
|
||||||
Standard_Integer startindex = (iRank == 1) ? 1 : (aDS.NumberOfShapesOfTheObject() + 1);
|
|
||||||
|
|
||||||
for(i = startindex; i <= nb; i++) {
|
|
||||||
if(aDS.GetShapeType(i) != TopAbs_EDGE)
|
|
||||||
continue;
|
|
||||||
const BOPTools_ListOfPaveBlock& aLPB = aSplitShapesPool(aDS.RefEdge(i));
|
|
||||||
const TopoDS_Shape& anOldShape = aDS.Shape(i);
|
|
||||||
|
|
||||||
if(!aLPB.IsEmpty()) {
|
|
||||||
BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aLPB);
|
|
||||||
|
|
||||||
for(; aPBIt.More(); aPBIt.Next()) {
|
|
||||||
const BOPTools_PaveBlock& aPB = aPBIt.Value();
|
|
||||||
Standard_Integer nSp = aPB.Edge();
|
|
||||||
|
|
||||||
if(nSp == i)
|
|
||||||
continue;
|
|
||||||
aState=aDS.GetState(nSp);
|
|
||||||
|
|
||||||
if ((aState == aStateCmp) || (myOp==BOP_COMMON && (aState == BooleanOperations_ON))) {
|
|
||||||
const TopoDS_Shape& aNewShape = aDS.Shape(nSp);
|
|
||||||
|
|
||||||
if(aResultMap.Contains(aNewShape)) {
|
|
||||||
Standard_Integer bIsGenerated = Standard_True;
|
|
||||||
|
|
||||||
if((myOp == BOP_CUT) || (myOp == BOP_FUSE)) {
|
|
||||||
bIsGenerated = (iRank == 2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(myOp == BOP_CUT21) {
|
|
||||||
bIsGenerated = (iRank == 1);
|
|
||||||
}
|
|
||||||
else if(myOp == BOP_COMMON) {
|
|
||||||
bIsGenerated = Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TopTools_DataMapOfShapeListOfShape& aHistoryMap = (bIsGenerated) ? myGenMap : myModifMap;
|
|
||||||
|
|
||||||
if(aHistoryMap.IsBound(anOldShape)) {
|
|
||||||
aHistoryMap.ChangeFind(anOldShape).Append(aNewShape);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape aShapeList;
|
|
||||||
aShapeList.Append(aNewShape);
|
|
||||||
aHistoryMap.Bind(anOldShape, aShapeList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//end if(!aLPB.IsEmpty...
|
|
||||||
|
|
||||||
const BOPTools_CommonBlockPool& aCBPool = aPaveFiller.CommonBlockPool();
|
|
||||||
const BOPTools_ListOfCommonBlock& aLCB = aCBPool(aDS.RefEdge(i));
|
|
||||||
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
|
|
||||||
Standard_Boolean bWireIsObject = (myS1.ShapeType() == TopAbs_WIRE);
|
|
||||||
Standard_Boolean bFillWithCommonPart = bWireIsObject ? (iRank == 1) : (iRank == 2);
|
|
||||||
|
|
||||||
for (; bFillWithCommonPart && anItCB.More(); anItCB.Next()) {
|
|
||||||
const BOPTools_CommonBlock& aCB = anItCB.Value();
|
|
||||||
const BOPTools_PaveBlock& aPB = aCB.PaveBlock1();
|
|
||||||
Standard_Integer nSp = aPB.Edge();
|
|
||||||
TopoDS_Shape aNewShape = aDS.Shape(nSp);
|
|
||||||
|
|
||||||
Standard_Boolean found = Standard_True;
|
|
||||||
|
|
||||||
if(!aResultMap.Contains(aNewShape)) {
|
|
||||||
nSp = aCB.PaveBlock2().Edge();
|
|
||||||
found = Standard_False;
|
|
||||||
|
|
||||||
if(nSp) {
|
|
||||||
aNewShape = aDS.Shape(nSp);
|
|
||||||
found = aResultMap.Contains(aNewShape);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(found) {
|
|
||||||
TopTools_DataMapOfShapeListOfShape& aHistoryMap = myModifMap;
|
|
||||||
|
|
||||||
if(aHistoryMap.IsBound(anOldShape)) {
|
|
||||||
aHistoryMap.ChangeFind(anOldShape).Append(aNewShape);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TopTools_ListOfShape aShapeList;
|
|
||||||
aShapeList.Append(aNewShape);
|
|
||||||
aHistoryMap.Bind(anOldShape, aShapeList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// end for(i = startindex...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------
|
|
||||||
// static function: AddNewShape
|
|
||||||
// purpose:
|
|
||||||
// --------------------------------------------------------------------------------
|
|
||||||
Standard_Boolean AddNewShape(const TopoDS_Shape& theKey,
|
|
||||||
const TopoDS_Shape& theItem,
|
|
||||||
TopTools_DataMapOfShapeListOfShape& theMap) {
|
|
||||||
|
|
||||||
|
|
||||||
if(!theMap.IsBound(theKey)) {
|
|
||||||
TopTools_ListOfShape aList;
|
|
||||||
aList.Append(theItem);
|
|
||||||
theMap.Bind(theKey, aList);
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean found = Standard_False;
|
|
||||||
TopTools_ListOfShape& aList = theMap.ChangeFind(theKey);
|
|
||||||
TopTools_ListIteratorOfListOfShape aVIt(aList);
|
|
||||||
|
|
||||||
for(; aVIt.More(); aVIt.Next()) {
|
|
||||||
if(theItem.IsSame(aVIt.Value())) {
|
|
||||||
found = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!found) {
|
|
||||||
aList.Append(theItem);
|
|
||||||
}
|
|
||||||
return !found;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetAncestorFaces(const Standard_Integer theShapeIndex,
|
|
||||||
const BooleanOperations_ShapesDataStructure& theDS,
|
|
||||||
TopTools_IndexedMapOfShape& theFaces)
|
|
||||||
{
|
|
||||||
// find ancestors for the edge
|
|
||||||
Standard_Integer nbeA = theDS.NumberOfAncestors(theShapeIndex);
|
|
||||||
if( nbeA == 0 ) return;
|
|
||||||
Standard_Integer ieA = 0;
|
|
||||||
for( ieA = 1; ieA <= nbeA; ieA++ ) {
|
|
||||||
Standard_Integer indxA = theDS.GetAncestor(theShapeIndex,ieA);
|
|
||||||
TopAbs_ShapeEnum aShapeType = theDS.GetShapeType(indxA);
|
|
||||||
if( aShapeType == TopAbs_FACE ) {
|
|
||||||
theFaces.Add(theDS.Shape(indxA));
|
|
||||||
}
|
|
||||||
else if( aShapeType == TopAbs_WIRE ) {
|
|
||||||
GetAncestorFaces(indxA,theDS,theFaces);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer GetShapeWire(const BooleanOperations_ShapesDataStructure& theDS,
|
|
||||||
const TopoDS_Shape& S1,
|
|
||||||
const TopoDS_Shape& S2,
|
|
||||||
TopoDS_Shape& WS)
|
|
||||||
{
|
|
||||||
Standard_Integer wRank = 0;
|
|
||||||
if( S1.ShapeType() == TopAbs_WIRE ) {
|
|
||||||
if( S1.IsSame(theDS.Object()) )
|
|
||||||
wRank = 1;
|
|
||||||
else
|
|
||||||
wRank = 2;
|
|
||||||
WS = S1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if( S2.IsSame(theDS.Object()) )
|
|
||||||
wRank = 1;
|
|
||||||
else
|
|
||||||
wRank = 2;
|
|
||||||
WS = S2;
|
|
||||||
}
|
|
||||||
return wRank;
|
|
||||||
}
|
|
@ -1,110 +0,0 @@
|
|||||||
-- Created on: 2001-04-09
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2001-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 WireSplitter from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
--- the algorithm to split multiconnexed
|
|
||||||
--- wires on a face onto biconnexed ones
|
|
||||||
--- .
|
|
||||||
uses
|
|
||||||
Face from TopoDS,
|
|
||||||
Vertex from TopoDS,
|
|
||||||
Edge from TopoDS,
|
|
||||||
|
|
||||||
SequenceOfPnt2d from TColgp,
|
|
||||||
SequenceOfShape from TopTools,
|
|
||||||
ListOfShape from TopTools,
|
|
||||||
|
|
||||||
ListOfListOfShape from BOPTColStd,
|
|
||||||
|
|
||||||
EdgeInfo from BOP,
|
|
||||||
IndexedDataMapOfVertexListEdgeInfo from BOP
|
|
||||||
|
|
||||||
--raises
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns WireSplitter from BOP;
|
|
||||||
---C++: inline
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
SetFace (me:out;
|
|
||||||
aF: Face from TopoDS);
|
|
||||||
---C++: inline
|
|
||||||
---Purpose:
|
|
||||||
--- Modifier
|
|
||||||
---
|
|
||||||
DoWithListOfEdges(me:out;
|
|
||||||
aLE:ListOfShape from TopTools);
|
|
||||||
---Purpose:
|
|
||||||
--- Perform the algorithm using the list of shapes <aLE> as data
|
|
||||||
---
|
|
||||||
DoWithFace (me:out);
|
|
||||||
---Purpose:
|
|
||||||
--- Perform the algorithm using the face as data
|
|
||||||
---
|
|
||||||
Do (me:out)
|
|
||||||
is private;
|
|
||||||
---Purpose:
|
|
||||||
--- Perform the algorithm
|
|
||||||
---
|
|
||||||
IsNothingToDo (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---C++: inline
|
|
||||||
---Purpose:
|
|
||||||
--- Returns TRUE if the source wire is biconnexed and
|
|
||||||
--- there is nothing to correct
|
|
||||||
---
|
|
||||||
IsDone (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---C++: inline
|
|
||||||
---Purpose:
|
|
||||||
--- Returns TRUE if the algorithm was performed
|
|
||||||
--- successfuly
|
|
||||||
---
|
|
||||||
Face (me)
|
|
||||||
returns Face from TopoDS;
|
|
||||||
---C++: return const &
|
|
||||||
---C++: inline
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
Shapes (me)
|
|
||||||
returns ListOfListOfShape from BOPTColStd;
|
|
||||||
---C++: return const &
|
|
||||||
---C++: inline
|
|
||||||
---Purpose:
|
|
||||||
--- Selector
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myFace : Face from TopoDS;
|
|
||||||
myIsDone : Boolean from Standard;
|
|
||||||
myNothingToDo: Boolean from Standard;
|
|
||||||
myShapes : ListOfListOfShape from BOPTColStd;
|
|
||||||
mySmartMap : IndexedDataMapOfVertexListEdgeInfo from BOP;
|
|
||||||
myEdges : ListOfShape from TopTools;
|
|
||||||
|
|
||||||
end WireSplitter;
|
|
File diff suppressed because it is too large
Load Diff
@ -1,74 +0,0 @@
|
|||||||
// Created on: 2009-12-15
|
|
||||||
// Created by: Sergey ZERCHANINOV
|
|
||||||
// Copyright (c) 2009-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.
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_WireSplitter::BOP_WireSplitter
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
inline BOP_WireSplitter::BOP_WireSplitter()
|
|
||||||
: myIsDone(Standard_False),
|
|
||||||
myNothingToDo(Standard_False)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: SetFace
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
inline void BOP_WireSplitter::SetFace(const TopoDS_Face& aFace)
|
|
||||||
{
|
|
||||||
myFace=aFace;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: Face
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
inline const TopoDS_Face& BOP_WireSplitter::Face() const
|
|
||||||
{
|
|
||||||
return myFace;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: IsNothingToDo
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
inline Standard_Boolean BOP_WireSplitter::IsNothingToDo() const
|
|
||||||
{
|
|
||||||
return myNothingToDo;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: IsDone
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
inline Standard_Boolean BOP_WireSplitter::IsDone() const
|
|
||||||
{
|
|
||||||
return myIsDone;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: Shapes
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
inline const BOPTColStd_ListOfListOfShape& BOP_WireSplitter::Shapes() const
|
|
||||||
{
|
|
||||||
return myShapes;
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
-- Created on: 2002-02-01
|
|
||||||
-- Created by: Peter KURNEV
|
|
||||||
-- Copyright (c) 2002-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 WireWire from BOP inherits WireShape from BOP
|
|
||||||
|
|
||||||
---Purpose:
|
|
||||||
---
|
|
||||||
--- Performs Boolean Operations (BO)
|
|
||||||
--- Common,Cut,Fuse for wires as
|
|
||||||
--- arguments
|
|
||||||
uses
|
|
||||||
DSFiller from BOPTools,
|
|
||||||
PDSFiller from BOPTools,
|
|
||||||
ListOfShape from TopTools
|
|
||||||
|
|
||||||
--raises
|
|
||||||
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns WireWire from BOP;
|
|
||||||
---Purpose:
|
|
||||||
--- Empty constructor;
|
|
||||||
---
|
|
||||||
Do (me:out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- (See base classes, please)
|
|
||||||
---
|
|
||||||
DoWithFiller (me:out;
|
|
||||||
aDSF: DSFiller from BOPTools)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- (See base classes, please)
|
|
||||||
---
|
|
||||||
Destroy (me: in out)
|
|
||||||
is redefined;
|
|
||||||
---C++: alias "Standard_EXPORT virtual ~BOP_WireWire(){Destroy();}"
|
|
||||||
---Purpose:
|
|
||||||
--- Destructor
|
|
||||||
---
|
|
||||||
BuildResult (me:out)
|
|
||||||
is redefined;
|
|
||||||
---Purpose:
|
|
||||||
--- See base classes, please
|
|
||||||
---
|
|
||||||
|
|
||||||
--fields
|
|
||||||
|
|
||||||
end WireWire;
|
|
@ -1,133 +0,0 @@
|
|||||||
// Created on: 2002-02-01
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2002-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 <BOP_WireWire.ixx>
|
|
||||||
|
|
||||||
#include <Standard_Failure.hxx>
|
|
||||||
#include <Standard_ErrorHandler.hxx>
|
|
||||||
|
|
||||||
#include <BooleanOperations_ShapesDataStructure.hxx>
|
|
||||||
|
|
||||||
#include <BOPTColStd_Dump.hxx>
|
|
||||||
|
|
||||||
#include <BOPTools_DSFiller.hxx>
|
|
||||||
#include <BOPTools_PaveFiller.hxx>
|
|
||||||
#include <BOPTools_WireStateFiller.hxx>
|
|
||||||
|
|
||||||
#include <BOP_CorrectTolerances.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BOP_WireWire::BOP_WireWire
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOP_WireWire::BOP_WireWire()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Destroy
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireWire::Destroy()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Do
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireWire::Do()
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
myIsDone=Standard_False;
|
|
||||||
//
|
|
||||||
// Filling the DS
|
|
||||||
BOPTools_DSFiller aDSFiller;
|
|
||||||
aDSFiller.SetShapes (myShape1, myShape2);
|
|
||||||
//
|
|
||||||
aDSFiller.Perform ();
|
|
||||||
//
|
|
||||||
DoWithFiller(aDSFiller);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: DoWithFiller
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireWire::DoWithFiller(const BOPTools_DSFiller& aDSFiller)
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
myIsDone=Standard_False;
|
|
||||||
//
|
|
||||||
myResultMap.Clear();
|
|
||||||
myModifiedMap.Clear();
|
|
||||||
//
|
|
||||||
myDSFiller=(BOPTools_DSFiller*) &aDSFiller;
|
|
||||||
//
|
|
||||||
try {
|
|
||||||
OCC_CATCH_SIGNALS
|
|
||||||
// modified by NIZHNY-MKK Fri Sep 3 15:14:17 2004.BEGIN
|
|
||||||
if(!myDSFiller->IsDone()) {
|
|
||||||
myErrorStatus = 1;
|
|
||||||
BOPTColStd_Dump::PrintMessage("DSFiller is invalid: Can not build result\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// modified by NIZHNY-MKK Fri Sep 3 15:14:20 2004.END
|
|
||||||
|
|
||||||
Standard_Boolean bIsNewFiller;
|
|
||||||
bIsNewFiller=aDSFiller.IsNewFiller();
|
|
||||||
|
|
||||||
if (bIsNewFiller) {
|
|
||||||
//
|
|
||||||
// Preparing;
|
|
||||||
// 1 States
|
|
||||||
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
|
|
||||||
BOPTools_WireStateFiller aStateFiller(aPaveFiller);
|
|
||||||
aStateFiller.Do();
|
|
||||||
|
|
||||||
aDSFiller.SetNewFiller(!bIsNewFiller);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
//DoNewFaces();
|
|
||||||
//
|
|
||||||
BuildResult();
|
|
||||||
//
|
|
||||||
BOP_CorrectTolerances::CorrectTolerances(myResult, 0.01);
|
|
||||||
//
|
|
||||||
FillModified();
|
|
||||||
myIsDone=Standard_True;
|
|
||||||
}
|
|
||||||
catch ( Standard_Failure ) {
|
|
||||||
myErrorStatus = 1;
|
|
||||||
BOPTColStd_Dump::PrintMessage("Can not build result\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function: BuildResult
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOP_WireWire::BuildResult()
|
|
||||||
{
|
|
||||||
AddSplitPartsINOUT();
|
|
||||||
AddSplitPartsON();
|
|
||||||
//
|
|
||||||
MakeResult();
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
|||||||
BOP_SolidSolid_1.cxx
|
|
||||||
BOP_ShellSolid_1.cxx
|
|
||||||
BOP_ShellSolid_2.cxx
|
|
||||||
BOP_ShellSolid_3.cxx
|
|
91
src/BOPAlgo/BOPAlgo.cdl
Normal file
91
src/BOPAlgo/BOPAlgo.cdl
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
-- Created by: Peter KURNEV
|
||||||
|
-- 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.
|
||||||
|
|
||||||
|
|
||||||
|
package BOPAlgo
|
||||||
|
---Purpose:
|
||||||
|
|
||||||
|
uses
|
||||||
|
gp,
|
||||||
|
TopAbs,
|
||||||
|
Geom,
|
||||||
|
GeomAPI,
|
||||||
|
BRepClass3d,
|
||||||
|
TopoDS,
|
||||||
|
TopTools,
|
||||||
|
IntTools,
|
||||||
|
IntSurf,
|
||||||
|
--
|
||||||
|
BOPDS,
|
||||||
|
BOPInt,
|
||||||
|
BOPCol,
|
||||||
|
BOPTools
|
||||||
|
is
|
||||||
|
enumeration Operation is
|
||||||
|
COMMON,
|
||||||
|
FUSE,
|
||||||
|
CUT,
|
||||||
|
CUT21,
|
||||||
|
SECTION,
|
||||||
|
UNKNOWN
|
||||||
|
end Operation;
|
||||||
|
|
||||||
|
enumeration CheckStatus is
|
||||||
|
CheckUnknown,
|
||||||
|
BadType,
|
||||||
|
SelfIntersect,
|
||||||
|
TooSmallEdge,
|
||||||
|
NonRecoverableFace,
|
||||||
|
IncompatibilityOfVertex,
|
||||||
|
IncompatibilityOfEdge,
|
||||||
|
IncompatibilityOfFace,
|
||||||
|
OperationAborted,
|
||||||
|
NotValid
|
||||||
|
end CheckStatus;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- classes
|
||||||
|
--
|
||||||
|
deferred class Algo;
|
||||||
|
deferred class BuilderShape;
|
||||||
|
class PaveFiller;
|
||||||
|
class Builder;
|
||||||
|
class BOP;
|
||||||
|
--
|
||||||
|
deferred class BuilderArea;
|
||||||
|
class BuilderFace;
|
||||||
|
class WireEdgeSet;
|
||||||
|
class WireSplitter;
|
||||||
|
class BuilderSolid;
|
||||||
|
class Tools;
|
||||||
|
class SectionAttribute;
|
||||||
|
class CheckerSI;
|
||||||
|
class ArgumentAnalyzer;
|
||||||
|
class CheckResult;
|
||||||
|
--
|
||||||
|
-- pointers
|
||||||
|
--
|
||||||
|
pointer PPaveFiller to PaveFiller from BOPAlgo;
|
||||||
|
pointer PWireEdgeSet to WireEdgeSet from BOPAlgo;
|
||||||
|
pointer PBOP to BOP from BOPAlgo;
|
||||||
|
pointer PBuilder to Builder from BOPAlgo;
|
||||||
|
pointer PArgumentAnalyzer to ArgumentAnalyzer from BOPAlgo;
|
||||||
|
--
|
||||||
|
imported ListOfCheckResult;
|
||||||
|
|
||||||
|
end BOPAlgo;
|
63
src/BOPAlgo/BOPAlgo_Algo.cdl
Normal file
63
src/BOPAlgo/BOPAlgo_Algo.cdl
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
-- Created by: Peter KURNEV
|
||||||
|
-- Copyright (c) 2010-2012 OPEN CASCADE SAS
|
||||||
|
-- Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
|
-- Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
|
||||||
|
-- EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
|
--
|
||||||
|
-- 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.
|
||||||
|
|
||||||
|
|
||||||
|
deferred class Algo from BOPAlgo
|
||||||
|
---Purpose: provides the root interface for algorithms
|
||||||
|
|
||||||
|
uses
|
||||||
|
BaseAllocator from BOPCol
|
||||||
|
|
||||||
|
--raises
|
||||||
|
|
||||||
|
is
|
||||||
|
Initialize
|
||||||
|
returns Algo from BOPAlgo;
|
||||||
|
---C++: alias "Standard_EXPORT virtual ~BOPAlgo_Algo();"
|
||||||
|
|
||||||
|
Initialize (theAllocator: BaseAllocator from BOPCol)
|
||||||
|
returns Algo from BOPAlgo;
|
||||||
|
|
||||||
|
Perform(me:out)
|
||||||
|
is deferred;
|
||||||
|
|
||||||
|
ErrorStatus (me)
|
||||||
|
returns Integer from Standard;
|
||||||
|
|
||||||
|
WarningStatus (me)
|
||||||
|
returns Integer from Standard;
|
||||||
|
|
||||||
|
CheckData(me:out)
|
||||||
|
is virtual protected;
|
||||||
|
|
||||||
|
CheckResult(me:out)
|
||||||
|
is virtual protected;
|
||||||
|
|
||||||
|
Allocator(me)
|
||||||
|
returns BaseAllocator from BOPCol;
|
||||||
|
---C++: return const &
|
||||||
|
|
||||||
|
fields
|
||||||
|
myAllocator : BaseAllocator from BOPCol is protected;
|
||||||
|
myErrorStatus : Integer from Standard is protected;
|
||||||
|
myWarningStatus : Integer from Standard is protected;
|
||||||
|
|
||||||
|
end Algo;
|
110
src/BOPTools/BOPTools_Curve.cxx → src/BOPAlgo/BOPAlgo_Algo.cxx
Executable file → Normal file
110
src/BOPTools/BOPTools_Curve.cxx → src/BOPAlgo/BOPAlgo_Algo.cxx
Executable file → Normal file
@ -1,6 +1,8 @@
|
|||||||
// Created on: 2001-05-08
|
|
||||||
// Created by: Peter KURNEV
|
// Created by: Peter KURNEV
|
||||||
// Copyright (c) 2001-2012 OPEN CASCADE SAS
|
// Copyright (c) 2010-2012 OPEN CASCADE SAS
|
||||||
|
// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
|
// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
|
||||||
|
// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
//
|
//
|
||||||
// The content of this file is subject to the Open CASCADE Technology Public
|
// 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
|
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||||
@ -18,70 +20,78 @@
|
|||||||
// and conditions governing the rights and limitations under the License.
|
// and conditions governing the rights and limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
|
#include <BOPAlgo_Algo.ixx>
|
||||||
|
|
||||||
#include <BOPTools_Curve.ixx>
|
#include <NCollection_BaseAllocator.hxx>
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function: BOPTools_Curve::BOPTools_Curve
|
// function:
|
||||||
// purpose:
|
// purpose:
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
BOPTools_Curve::BOPTools_Curve()
|
BOPAlgo_Algo::BOPAlgo_Algo()
|
||||||
|
:
|
||||||
|
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
|
||||||
|
myErrorStatus(1),
|
||||||
|
myWarningStatus(0)
|
||||||
{}
|
{}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function: BOPTools_Curve::BOPTools_Curve
|
// function:
|
||||||
// purpose:
|
// purpose:
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
BOPTools_Curve::BOPTools_Curve (const IntTools_Curve& aIC)
|
BOPAlgo_Algo::BOPAlgo_Algo(const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||||
{
|
:
|
||||||
myCurve=aIC;
|
myAllocator(theAllocator),
|
||||||
}
|
myErrorStatus(1),
|
||||||
//=======================================================================
|
myWarningStatus(0)
|
||||||
// function: SetCurve
|
{}
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
void BOPTools_Curve::SetCurve (const IntTools_Curve& aIC)
|
|
||||||
{
|
|
||||||
myCurve=aIC;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Curve
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
const IntTools_Curve& BOPTools_Curve::Curve () const
|
|
||||||
{
|
|
||||||
return myCurve;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
// function: Set
|
|
||||||
// purpose:
|
|
||||||
//=======================================================================
|
|
||||||
BOPTools_PaveSet& BOPTools_Curve::Set()
|
|
||||||
{
|
|
||||||
return myPaveSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : AppendNewBlock
|
// function: ~
|
||||||
//purpose :
|
// purpose:
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BOPTools_Curve::AppendNewBlock(const BOPTools_PaveBlock& aPB)
|
BOPAlgo_Algo::~BOPAlgo_Algo()
|
||||||
{
|
{
|
||||||
myNewPBs.Append(aPB);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NewPaveBlocks
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const BOPTools_ListOfPaveBlock& BOPTools_Curve::NewPaveBlocks() const
|
|
||||||
{
|
|
||||||
return myNewPBs;
|
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : TechnoVertices
|
//function : Allocator
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
TColStd_ListOfInteger& BOPTools_Curve::TechnoVertices()
|
const Handle(NCollection_BaseAllocator)& BOPAlgo_Algo::Allocator()const
|
||||||
{
|
{
|
||||||
return myTechnoVertices;
|
return myAllocator;
|
||||||
}
|
}
|
||||||
|
//=======================================================================
|
||||||
|
// function: CheckData
|
||||||
|
// purpose:
|
||||||
|
//=======================================================================
|
||||||
|
void BOPAlgo_Algo::CheckData()
|
||||||
|
{
|
||||||
|
myErrorStatus=0;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
// function: CheckResult
|
||||||
|
// purpose:
|
||||||
|
//=======================================================================
|
||||||
|
void BOPAlgo_Algo::CheckResult()
|
||||||
|
{
|
||||||
|
myErrorStatus=0;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
// function: ErrorStatus
|
||||||
|
// purpose:
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Integer BOPAlgo_Algo::ErrorStatus()const
|
||||||
|
{
|
||||||
|
return myErrorStatus;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
// function: WarningStatus
|
||||||
|
// purpose:
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Integer BOPAlgo_Algo::WarningStatus()const
|
||||||
|
{
|
||||||
|
return myWarningStatus;
|
||||||
|
}
|
||||||
|
// myErrorStatus
|
||||||
|
//
|
||||||
|
// 1 - object is just initialized
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user