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