1 -- Created on: 1995-04-25
2 -- Created by: Jacques GOUSSARD
3 -- Copyright (c) 1995-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
23 class Builder from LocOpe
25 ---Purpose: Provides a basic tool to implement local
26 -- topological operations.
30 ListOfShape from TopTools,
31 -- HBuilder from TopOpeBRepBuild,
32 -- DSAccess from BRepAlgo,
33 HistoryCollector from BOP,
35 MapOfShape from TopTools
40 ConstructionError from Standard
46 ---Purpose: Empty constructor.
47 returns Builder from LocOpe;
50 Create(S: Shape from TopoDS)
51 ---Purpose: Creates a builder for local operations on <S>.
52 returns Builder from LocOpe
53 raises ConstructionError from Standard;
54 --- The exception is raised if <S> is a null shape.
57 Create(S: Shape from TopoDS; Tool: Shape from TopoDS)
58 ---Purpose: Creates a builder for local operations between <S>
60 returns Builder from LocOpe
61 raises ConstructionError from Standard;
62 --- The exception is raised if <S> or <Tool> is a null shape .
65 Init(me: in out; S: Shape from TopoDS)
66 ---Purpose: Initializes a builder for local operations on <S>.
67 raises ConstructionError from Standard
68 --- The exception is raised if <S> is a null shape.
72 Init(me: in out; S: Shape from TopoDS; Tool: Shape from TopoDS)
73 ---Purpose: Initializes a builder for local operations between
75 raises ConstructionError from Standard
76 --- The exception is raised if <S> or <Tool>is a null shape.
80 Perform(me: in out; Tool : Shape from TopoDS;
81 L : ListOfShape from TopTools;
82 Fuse : Boolean from Standard)
84 ---Purpose: Performs the local operation on the formerly given
85 -- shape. <L> defines a set of faces of the
86 -- shape. The whole tool is used. The list may not be
87 -- empty. The boolean <Fuse> gives the type of
88 -- operation. If set to Standard_True, the operation
89 -- is a fusion. If set to Standard_False, the
90 -- operation is a cutting one.
92 -- The Perform process stops just before constructing
93 -- any result in order to authorize the selection of
94 -- parts of the tool. After a call to Perform, it is
95 -- possible to call BuilPartsOfTool, then
96 -- RemovePart/ActivatePart to select valid parts, and
97 -- it is necessary to call PerformResult to get any
100 raises ConstructionError from Standard
101 -- The exception is raised if <Tool> is null or same as the shape.
106 Perform(me: in out; LShape : ListOfShape from TopTools;
107 LTool : ListOfShape from TopTools;
108 Fuse : Boolean from Standard)
110 ---Purpose: Performs the local operation on the formerly given
111 -- shape and tool. <LShape> defines a set of faces
112 -- of the shape. <LTool> defines a set of faces of
113 -- the tool. The boolean <Fuse> gives the type of
114 -- operation. If set to Standard_True, the operation
115 -- is a fusion. If set to Standard_False, the
116 -- operation is a cutting one. If <LShape> (resp.
117 -- <LTool>) is empty, the whole shape (resp. tool) is
120 -- The Perform process stops just before constructing
121 -- any result in order to authorize the selection of
122 -- parts of the tool. After a call to Perform, it is
123 -- possible to call BuilPartsOfTool, then
124 -- RemovePart/ActivatePart to select valid parts, and
125 -- it is necessary to call PerformResult to get any
132 BuildPartsOfTool(me: in out)
133 ---Purpose: Builds every valid parts of the tool.
134 raises NotDone from StdFail
135 -- The exception is raised if no call to Perform has been done.
140 ---Purpose: Returns the list of the parts of tool. Each of
141 -- this part is a TopoDS_Shell.
142 returns ListOfShape from TopTools
143 ---C++: return const&
144 raises NotDone from StdFail
145 -- The exception is raised if no call to BuildPartsOfTool has
150 RemovePart(me: in out; S: Shape from TopoDS)
151 ---Purpose: Removes <S> from the list of valid parts of tool.
152 raises NotDone from StdFail
153 -- The exception is raised if no call to BuildPartsOfTool has
158 ActivatePart(me: in out; S: Shape from TopoDS)
159 ---Purpose: Removes <S> from the list of invalid parts of
160 -- tool. By default, all parts of tool are valid for
161 -- the local operation.
162 raises NotDone from StdFail
163 -- The exception is raised if no call to BuildPartsOfTool has
169 PerformResult(me: in out)
170 ---Purpose: Invalidates the given parts of tools if any, and
171 -- performs the result of the local operation.
172 raises NotDone from StdFail
173 -- The exception is raised if no call to Perform has been done.
178 ---Purpose: Returns Standard_True if the operation has been
180 returns Boolean from Standard
185 ---Purpose: Returns Standard_True if the Invalidate Parts
186 -- operation has been successfuly done.
187 returns Boolean from Standard
192 ---Purpose: Returns the result of the operation.
194 returns Shape from TopoDS
195 ---C++: return const&
197 raises NotDone from StdFail
198 -- The exception is raised if IsDone returns Standard_False.
203 ---Purpose: Returns the shape on which the operation is defined.
204 returns Shape from TopoDS
205 ---C++: return const&
211 ---Purpose: Returns the "tool" used to perform the local operation.
212 returns Shape from TopoDS
213 ---C++: return const&
219 -- returns HBuilder from TopOpeBRepBuild
222 returns HistoryCollector from BOP
224 ---C++: return const&
228 --- Private implementation methods
231 InvalidateParts(me: in out)
237 returns ListOfShape from TopTools
238 ---C++: return const&
243 returns ListOfShape from TopTools
244 ---C++: return const&
250 myDone : Boolean from Standard;
251 myShape : Shape from TopoDS;
252 myTool : Shape from TopoDS;
253 myResult : Shape from TopoDS;
254 myParts : ListOfShape from TopTools;
255 myRemoved : ListOfShape from TopTools;
256 myPdone : Boolean from Standard;
257 myPerfdone: Boolean from Standard;
258 myInvDone : Boolean from Standard;
259 myFuse : Boolean from Standard;
260 myEdges : ListOfShape from TopTools;
261 myTgtEdges: ListOfShape from TopTools;
262 -- myAlgo : DSAccess from BRepAlgo;
263 myAlgo : TopOpe from BRepAlgo;
264 myShapeMap: MapOfShape from TopTools;
265 myToolMap : MapOfShape from TopTools;