0023429: BRepFeat_SplitShape algorithm misses some section edges while building resul...
[occt.git] / src / LocOpe / LocOpe_Builder.cdl
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
5 --
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.
10 --
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.
13 --
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.
20
21
22
23 class Builder from LocOpe
24
25         ---Purpose: Provides    a  basic  tool    to  implement  local
26         --          topological operations.
27
28 uses
29     Shape          from TopoDS,
30     ListOfShape    from TopTools,
31 --    HBuilder       from TopOpeBRepBuild,
32 --    DSAccess       from BRepAlgo,
33     HistoryCollector from BOP,
34     TopOpe         from BRepAlgo, 
35     MapOfShape     from TopTools  
36   
37      
38 raises
39     NotDone           from StdFail,
40     ConstructionError from Standard
41
42
43 is
44
45     Create
46         ---Purpose: Empty constructor.
47         returns Builder from LocOpe;
48         
49         
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.
55
56
57     Create(S: Shape from TopoDS; Tool: Shape from TopoDS)
58         ---Purpose: Creates a builder for local operations between <S>
59         --          and  <Tool>.
60         returns Builder from LocOpe
61         raises ConstructionError from Standard;
62         --- The exception is raised if <S> or <Tool> is a null shape .
63
64
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.
69         is static;
70
71
72     Init(me: in out; S: Shape from TopoDS; Tool: Shape from TopoDS)
73         ---Purpose: Initializes a builder for local operations between
74         --          <S>  and <Tool>.
75         raises ConstructionError from Standard
76         --- The exception is raised if <S> or <Tool>is a null shape.
77         is static;
78
79
80     Perform(me: in out; Tool : Shape       from TopoDS;
81                         L    : ListOfShape from TopTools;
82                         Fuse : Boolean     from Standard)
83
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.
91         --          
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
98         --          result. 
99
100         raises ConstructionError from Standard
101         -- The exception is raised if <Tool> is null or same as the shape.
102
103         is static;
104
105
106     Perform(me: in out; LShape : ListOfShape from TopTools;
107                         LTool  : ListOfShape from TopTools;
108                         Fuse   : Boolean from Standard)
109
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
118         --          used. 
119         --          
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
126         --          result. 
127
128         is static;
129
130
131
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.
136         is static;
137     
138
139     PartsOfTool(me)
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
146         -- been done. 
147         is static;
148
149
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
154         -- been done. 
155         is static;
156
157
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
164         -- been done. 
165         is static;
166         
167         
168
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.
174         is static;
175
176
177     IsDone(me)
178         ---Purpose: Returns  Standard_True  if the operation  has been
179         --          successfuly done.
180         returns Boolean from Standard
181         ---C++: inline
182         is static;
183
184     IsInvDone(me)
185         ---Purpose: Returns  Standard_True  if the Invalidate Parts 
186         --          operation  has been successfuly done.
187         returns Boolean from Standard
188         ---C++: inline
189         is static;
190
191     ResultingShape(me)
192         ---Purpose: Returns the result of the operation.
193
194         returns Shape from  TopoDS
195         ---C++: return const&
196         ---C++: inline
197         raises NotDone from StdFail
198         -- The exception is raised if IsDone returns Standard_False.
199         is static;
200     
201     
202     OriginalShape(me)
203         ---Purpose: Returns the shape on which the operation is defined.
204         returns Shape from TopoDS
205         ---C++: return const&
206         ---C++: inline
207         is static;
208
209
210     Tool(me)
211         ---Purpose: Returns the "tool" used to perform the local operation.
212         returns Shape from TopoDS
213         ---C++: return const&
214         ---C++: inline
215         is static;
216
217
218 --    Builder(me)  
219 --      returns HBuilder from TopOpeBRepBuild
220
221     History(me)     
222         returns HistoryCollector from BOP
223         ---C++: inline
224         ---C++: return const&
225         is static;
226
227
228 --- Private implementation methods
229 --  
230
231     InvalidateParts(me: in out)
232     
233         is static;
234
235     Edges(me)
236
237         returns ListOfShape from TopTools
238         ---C++: return const&
239         is static;
240         
241     TgtEdges(me)
242
243         returns ListOfShape from TopTools
244         ---C++: return const&
245         is static;
246
247
248 fields
249
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;
266
267 end Builder;
268
269
270