b311480e |
1 | -- Created on: 1995-04-26 |
2 | -- Created by: Modelistation |
3 | -- Copyright (c) 1995-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
8 | -- This library is free software; you can redistribute it and/or modify it under |
9 | -- the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | -- by the Free Software Foundation, with special exception defined in the file |
11 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | -- distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class ChBuilder from ChFi3d inherits Builder from ChFi3d |
18 | |
19 | ---Purpose: construction tool for 3D chamfers on edges. |
20 | |
21 | uses |
22 | Shape from TopoDS, |
23 | Edge from TopoDS, |
24 | Face from TopoDS, |
25 | Vertex from TopoDS, |
26 | State from TopAbs, |
27 | Orientation from TopAbs, |
28 | HElSpine from ChFiDS, |
29 | SequenceOfSurfData from ChFiDS, |
30 | SurfData from ChFiDS, |
31 | Stripe from ChFiDS, |
32 | ListOfStripe from ChFiDS, |
33 | Spine from ChFiDS, |
34 | SecHArray1 from ChFiDS, |
35 | Function from Blend, |
36 | HCurve from Adaptor3d, |
37 | HCurve2d from BRepAdaptor, |
38 | HSurface from BRepAdaptor, |
39 | HCurve from Adaptor3d, |
40 | TopolTool from Adaptor3d, |
41 | Vector from math, |
42 | ChamfMethod from ChFiDS , |
43 | Pnt2d from gp |
44 | |
45 | raises |
46 | ConstructionError from Standard, |
47 | DomainError from Standard |
48 | |
49 | is |
50 | |
51 | Create(S : Shape from TopoDS; Ta : Real from Standard = 1.0e-2) |
52 | returns ChBuilder from ChFi3d; |
53 | ---Purpose: initializes the Builder with the Shape <S> for the |
54 | -- computation of chamfers |
55 | |
56 | |
57 | Add(me : in out; E : Edge from TopoDS) |
58 | ---Purpose: initializes a contour with the edge <E> as first |
59 | -- (the next are found by propagation ). |
60 | -- The two distances (parameters of the chamfer) must |
61 | -- be set after. |
62 | raises ConstructionError from Standard |
63 | ---Purpose: if the edge <E> has more than 2 adjacent faces |
64 | is static; |
65 | |
66 | Add(me : in out; |
67 | Dis : Real from Standard; |
68 | E : Edge from TopoDS; |
69 | F : Face from TopoDS) |
70 | ---Purpose: initializes a new contour with the edge <E> as first |
71 | -- (the next are found by propagation ), and the |
72 | -- distance <Dis> |
73 | raises ConstructionError from Standard |
74 | ---Purpose: if the edge <E> has more than 2 adjacent faces |
75 | is static; |
76 | |
77 | SetDist(me : in out; |
78 | Dis : Real; |
79 | IC : Integer from Standard; |
80 | F : Face from TopoDS) |
81 | ---Purpose: set the distance <Dis> of the fillet |
82 | -- contour of index <IC> in the DS with <Dis> on <F>. |
83 | raises DomainError from Standard |
84 | ---Purpose: if the face <F> is not one of common faces |
85 | -- of an edge of the contour <IC> |
86 | is static; |
87 | |
88 | |
89 | GetDist(me ; |
90 | IC : Integer from Standard; |
91 | Dis : out Real from Standard) |
92 | ---Purpose: gives the distances <Dis> of the fillet |
93 | -- contour of index <IC> in the DS |
94 | is static; |
95 | |
96 | Add(me : in out; |
97 | Dis1, Dis2 : Real from Standard; |
98 | E : Edge from TopoDS; |
99 | F : Face from TopoDS) |
100 | ---Purpose: initializes a new contour with the edge <E> as first |
101 | -- (the next are found by propagation ), and the |
102 | -- distance <Dis1> and <Dis2> |
103 | raises ConstructionError from Standard |
104 | ---Purpose: if the edge <E> has more than 2 adjacent faces |
105 | is static; |
106 | |
107 | SetDists(me : in out; |
108 | Dis1, Dis2 : Real; |
109 | IC : Integer from Standard; |
110 | F : Face from TopoDS) |
111 | ---Purpose: set the distances <Dis1> and <Dis2> of the fillet |
112 | -- contour of index <IC> in the DS with <Dis1> on <F>. |
113 | raises DomainError from Standard |
114 | ---Purpose: if the face <F> is not one of common faces |
115 | -- of an edge of the contour <IC> |
116 | is static; |
117 | |
118 | |
119 | Dists(me ; |
120 | IC : Integer from Standard; |
121 | Dis1, Dis2 : out Real from Standard) |
122 | ---Purpose: gives the distances <Dis1> and <Dis2> of the fillet |
123 | -- contour of index <IC> in the DS |
124 | is static; |
125 | |
126 | |
127 | AddDA(me : in out; |
128 | Dis : Real from Standard; |
129 | Angle : Real from Standard; |
130 | E : Edge from TopoDS; |
131 | F : Face from TopoDS) |
132 | ---Purpose: initializes a new contour with the edge <E> as first |
133 | -- (the next are found by propagation ), and the |
134 | -- distance <Dis1> and <Angle> |
135 | raises ConstructionError from Standard |
136 | ---Purpose: if the edge <E> has more than 2 adjacent faces |
137 | is static; |
138 | |
139 | |
140 | SetDistAngle(me : in out; |
141 | Dis : Real from Standard; |
142 | Angle : Real from Standard; |
143 | IC : Integer from Standard; |
144 | F : Face from TopoDS) |
145 | ---Purpose: set the distance <Dis> and <Angle> of the fillet |
146 | -- contour of index <IC> in the DS with <Dis> on <F>. |
147 | raises DomainError from Standard |
148 | ---Purpose: if the face <F> is not one of common faces |
149 | -- of an edge of the contour <IC> |
150 | is static; |
151 | |
152 | |
153 | GetDistAngle(me ; |
154 | IC : Integer from Standard; |
155 | Dis : in out Real from Standard; |
156 | Angle : in out Real from Standard; |
157 | DisOnFace1 : in out Boolean from Standard) |
158 | ---Purpose: gives the distances <Dis> and <Angle> of the fillet |
159 | -- contour of index <IC> in the DS |
160 | is static; |
161 | |
162 | IsChamfer(me; |
163 | IC : Integer from Standard) |
164 | returns ChamfMethod from ChFiDS is static; |
165 | ---Purpose: renvoi la methode des chanfreins utilisee |
166 | |
167 | ResetContour(me : in out; |
168 | IC : Integer from Standard) |
169 | ---Purpose: Reset tous rayons du contour IC. |
170 | is static; |
171 | |
172 | ---Methods for quick simulation |
173 | ------------------------------- |
174 | |
175 | Simulate(me : in out; |
176 | IC : Integer from Standard); |
177 | |
178 | NbSurf(me; IC : Integer from Standard) |
179 | returns Integer from Standard; |
180 | |
181 | Sect(me; IC, IS : Integer from Standard) |
6e33d3ce |
182 | returns SecHArray1 from ChFiDS; |
7fd59977 |
183 | |
6e33d3ce |
184 | SimulKPart(me; SD : SurfData from ChFiDS) |
7fd59977 |
185 | is protected; |
186 | |
187 | SimulSurf(me : in out; |
188 | Data : out SurfData from ChFiDS; |
189 | Guide : HElSpine from ChFiDS; |
190 | Spine : Spine from ChFiDS; |
191 | Choix : Integer from Standard; |
192 | S1 : HSurface from BRepAdaptor; |
193 | I1 : TopolTool from Adaptor3d; |
194 | S2 : HSurface from BRepAdaptor; |
195 | I2 : TopolTool from Adaptor3d; |
196 | TolGuide : Real from Standard; |
197 | First,Last : in out Real from Standard; |
198 | Inside,Appro : Boolean from Standard; |
199 | Forward : Boolean from Standard; |
200 | RecOnS1,RecOnS2 : Boolean from Standard; |
201 | Soldep : Vector from math; |
202 | Intf,Intl : in out Boolean from Standard) |
203 | returns Boolean |
204 | is protected; |
205 | |
206 | SimulSurf(me : in out; |
207 | Data : out SurfData from ChFiDS; |
208 | Guide : HElSpine from ChFiDS; |
209 | Spine : Spine from ChFiDS; |
210 | Choix : Integer from Standard; |
211 | S1 : HSurface from BRepAdaptor; |
212 | I1 : TopolTool from Adaptor3d; |
213 | PC1 : HCurve2d from BRepAdaptor; |
214 | Sref1 : HSurface from BRepAdaptor; |
215 | PCref1 : HCurve2d from BRepAdaptor; |
216 | Decroch1 : out Boolean from Standard; |
217 | S2 : HSurface from BRepAdaptor; |
218 | I2 : TopolTool from Adaptor3d; |
219 | Or2 : Orientation from TopAbs; |
220 | Fleche : Real from Standard; |
221 | TolGuide : Real from Standard; |
222 | First,Last : in out Real from Standard; |
223 | Inside,Appro,Forward : Boolean from Standard; |
224 | RecP,RecS,RecRst : Boolean from Standard; |
225 | Soldep : Vector from math) |
226 | is redefined; |
227 | |
228 | SimulSurf(me : in out; |
229 | Data : out SurfData from ChFiDS; |
230 | Guide : HElSpine from ChFiDS; |
231 | Spine : Spine from ChFiDS; |
232 | Choix : Integer from Standard; |
233 | S1 : HSurface from BRepAdaptor; |
234 | I1 : TopolTool from Adaptor3d; |
235 | Or1 : Orientation from TopAbs; |
236 | S2 : HSurface from BRepAdaptor; |
237 | I2 : TopolTool from Adaptor3d; |
238 | PC2 : HCurve2d from BRepAdaptor; |
239 | Sref2 : HSurface from BRepAdaptor; |
240 | PCref2 : HCurve2d from BRepAdaptor; |
241 | Decroch2 : out Boolean from Standard; |
242 | Fleche : Real from Standard; |
243 | TolGuide : Real from Standard; |
244 | First,Last : in out Real from Standard; |
245 | Inside,Appro,Forward : Boolean from Standard; |
246 | RecP,RecS,RecRst : Boolean from Standard; |
247 | Soldep : Vector from math) |
248 | |
249 | is redefined; |
250 | |
251 | SimulSurf(me : in out; |
252 | Data : out SurfData from ChFiDS; |
253 | Guide : HElSpine from ChFiDS; |
254 | Spine : Spine from ChFiDS; |
255 | Choix : Integer from Standard; |
256 | S1 : HSurface from BRepAdaptor; |
257 | I1 : TopolTool from Adaptor3d; |
258 | PC1 : HCurve2d from BRepAdaptor; |
259 | Sref1 : HSurface from BRepAdaptor; |
260 | PCref1 : HCurve2d from BRepAdaptor; |
261 | Decroch1 : out Boolean from Standard; |
262 | Or1 : Orientation from TopAbs; |
263 | S2 : HSurface from BRepAdaptor; |
264 | I2 : TopolTool from Adaptor3d; |
265 | PC2 : HCurve2d from BRepAdaptor; |
266 | Sref2 : HSurface from BRepAdaptor; |
267 | PCref2 : HCurve2d from BRepAdaptor; |
268 | Decroch2 : out Boolean from Standard; |
269 | Or2 : Orientation from TopAbs; |
270 | Fleche : Real from Standard; |
271 | TolGuide : Real from Standard; |
272 | First,Last : in out Real from Standard; |
273 | Inside,Appro,Forward : Boolean from Standard; |
274 | RecP1,RecRst1 : Boolean from Standard; |
275 | RecP2,RecRst2 : Boolean from Standard; |
276 | Soldep : Vector from math) |
277 | |
278 | is redefined; |
279 | |
280 | ---Methods for computation |
281 | -------------------------- |
282 | |
283 | PerformFirstSection(me ; |
284 | S : Spine from ChFiDS; |
285 | HGuide : HElSpine from ChFiDS; |
286 | Choix : Integer from Standard; |
287 | S1,S2 : in out HSurface from BRepAdaptor; |
288 | I1,I2 : TopolTool from Adaptor3d; |
289 | Par : Real from Standard; |
290 | SolDep : in out Vector from math; |
291 | Pos1,Pos2 : out State from TopAbs) |
292 | returns Boolean from Standard |
293 | is protected; |
294 | |
295 | PerformSurf(me : in out; |
296 | Data : out SequenceOfSurfData from ChFiDS; |
297 | Guide : HElSpine from ChFiDS; |
298 | Spine : Spine from ChFiDS; |
299 | Choix : Integer from Standard; |
300 | S1 : HSurface from BRepAdaptor; |
301 | I1 : TopolTool from Adaptor3d; |
302 | S2 : HSurface from BRepAdaptor; |
303 | I2 : TopolTool from Adaptor3d; |
304 | MaxStep : Real from Standard; |
305 | Fleche : Real from Standard; |
306 | TolGuide : Real from Standard; |
307 | First,Last : in out Real from Standard; |
308 | Inside,Appro : Boolean from Standard; |
309 | Forward : Boolean from Standard; |
310 | RecOnS1,RecOnS2 : Boolean from Standard; |
311 | Soldep : Vector from math; |
312 | Intf,Intl : in out Boolean from Standard) |
313 | returns Boolean |
314 | is redefined; |
315 | ---Purpose: Methode, implemented in inheritants, calculates |
316 | -- the elements of construction of the surface (fillet |
317 | -- or chamfer). |
318 | |
319 | PerformSurf(me : in out; |
320 | Data : out SequenceOfSurfData from ChFiDS; |
321 | Guide : HElSpine from ChFiDS; |
322 | Spine : Spine from ChFiDS; |
323 | Choix : Integer from Standard; |
324 | S1 : HSurface from BRepAdaptor; |
325 | I1 : TopolTool from Adaptor3d; |
326 | PC1 : HCurve2d from BRepAdaptor; |
327 | Sref1 : HSurface from BRepAdaptor; |
328 | PCref1 : HCurve2d from BRepAdaptor; |
329 | Decroch1 : out Boolean from Standard; |
330 | S2 : HSurface from BRepAdaptor; |
331 | I2 : TopolTool from Adaptor3d; |
332 | Or2 : Orientation from TopAbs; |
333 | MaxStep : Real from Standard; |
334 | Fleche : Real from Standard; |
335 | TolGuide : Real from Standard; |
336 | First,Last : in out Real from Standard; |
337 | Inside,Appro,Forward : Boolean from Standard; |
338 | RecP,RecS,RecRst : Boolean from Standard; |
339 | Soldep : Vector from math) |
340 | |
341 | is redefined; |
342 | ---Purpose: Method, implemented in the inheritants, calculates |
343 | -- the elements of construction of the surface (fillet |
344 | -- or chamfer) contact edge/face. |
345 | |
346 | PerformSurf(me : in out; |
347 | Data : out SequenceOfSurfData from ChFiDS; |
348 | Guide : HElSpine from ChFiDS; |
349 | Spine : Spine from ChFiDS; |
350 | Choix : Integer from Standard; |
351 | S1 : HSurface from BRepAdaptor; |
352 | I1 : TopolTool from Adaptor3d; |
353 | Or1 : Orientation from TopAbs; |
354 | S2 : HSurface from BRepAdaptor; |
355 | I2 : TopolTool from Adaptor3d; |
356 | PC2 : HCurve2d from BRepAdaptor; |
357 | Sref2 : HSurface from BRepAdaptor; |
358 | PCref2 : HCurve2d from BRepAdaptor; |
359 | Decroch2 : out Boolean from Standard; |
360 | MaxStep : Real from Standard; |
361 | Fleche : Real from Standard; |
362 | TolGuide : Real from Standard; |
363 | First,Last : in out Real from Standard; |
364 | Inside,Appro,Forward : Boolean from Standard; |
365 | RecP,RecS,RecRst : Boolean from Standard; |
366 | Soldep : Vector from math) |
367 | |
368 | is redefined; |
369 | ---Purpose: Method, implemented in inheritants, calculates |
370 | -- the elements of construction of the surface (fillet |
371 | -- or chamfer) contact edge/face. |
372 | |
373 | PerformSurf(me : in out; |
374 | Data : out SequenceOfSurfData from ChFiDS; |
375 | Guide : HElSpine from ChFiDS; |
376 | Spine : Spine from ChFiDS; |
377 | Choix : Integer from Standard; |
378 | S1 : HSurface from BRepAdaptor; |
379 | I1 : TopolTool from Adaptor3d; |
380 | PC1 : HCurve2d from BRepAdaptor; |
381 | Sref1 : HSurface from BRepAdaptor; |
382 | PCref1 : HCurve2d from BRepAdaptor; |
383 | Decroch1 : out Boolean from Standard; |
384 | Or1 : Orientation from TopAbs; |
385 | S2 : HSurface from BRepAdaptor; |
386 | I2 : TopolTool from Adaptor3d; |
387 | PC2 : HCurve2d from BRepAdaptor; |
388 | Sref2 : HSurface from BRepAdaptor; |
389 | PCref2 : HCurve2d from BRepAdaptor; |
390 | Decroch2 : out Boolean from Standard; |
391 | Or2 : Orientation from TopAbs; |
392 | MaxStep : Real from Standard; |
393 | Fleche : Real from Standard; |
394 | TolGuide : Real from Standard; |
395 | First,Last : in out Real from Standard; |
396 | Inside,Appro,Forward : Boolean from Standard; |
397 | RecP1,RecRst1 : Boolean from Standard; |
398 | RecP2,RecRst2 : Boolean from Standard; |
399 | Soldep : Vector from math) |
400 | |
401 | is redefined; |
402 | ---Purpose: Method, implemented in inheritants, calculates |
403 | -- the elements of construction of the surface (fillet |
404 | -- or chamfer) contact edge/edge. |
405 | |
406 | PerformTwoCorner(me : in out ; |
407 | Index : Integer from Standard) |
408 | is protected; |
409 | ---Purpose: computes the intersection of two chamfers on |
410 | -- the vertex of index <Index> in myVDataMap. |
411 | |
412 | PerformThreeCorner(me : in out ; |
413 | Index : Integer from Standard) |
414 | is protected; |
415 | ---Purpose: computes the intersection of three chamfers on |
416 | -- the vertex of index <Index> in myVDataMap. |
417 | |
418 | |
419 | ExtentOneCorner(me : in out; |
420 | V : Vertex from TopoDS; |
421 | S : Stripe from ChFiDS) |
422 | is protected; |
423 | ---Purpose: extends the spine of the Stripe <S> at the |
424 | -- extremity of the vertex <V>. |
425 | |
426 | |
427 | ExtentTwoCorner(me : in out; |
428 | V : Vertex from TopoDS; |
429 | LS : ListOfStripe from ChFiDS) |
430 | is protected; |
431 | ---Purpose: extends the spine of the 2 stripes of <LS> at the |
432 | -- extremity of the vertex <V> |
433 | |
434 | |
435 | ExtentThreeCorner(me : in out; |
436 | V : Vertex from TopoDS; |
437 | LS : ListOfStripe from ChFiDS) |
438 | is protected; |
439 | ---Purpose: extends the spine of the 2 stripes of <LS> at the |
440 | -- extremity of the vertex <V> |
441 | |
442 | |
443 | SetRegul(me : in out) is protected; |
444 | ---Purpose: set the regularities |
445 | |
446 | |
447 | ConexFaces(me; |
448 | Sp : Spine from ChFiDS; |
449 | IEdge : Integer from Standard; |
450 | F1, F2 : out Face from TopoDS) |
451 | is static private; |
452 | |
453 | FindChoiceDistAngle(me; |
454 | Choice : Integer from Standard; |
455 | DisOnF1 : Boolean from Standard) |
456 | returns Integer from Standard |
457 | is static; |
458 | |
459 | end ChBuilder; |
460 | |
461 | |