b311480e |
1 | -- Created on: 1993-07-06 |
2 | -- Created by: Remi LEQUETTE |
3 | -- Copyright (c) 1993-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 | -- |
973c2be1 |
8 | -- This library is free software; you can redistribute it and / or modify it |
9 | -- under the terms of the GNU Lesser General Public version 2.1 as published |
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 MakeEdge from BRepBuilderAPI inherits MakeShape from BRepBuilderAPI |
18 | |
19 | ---Purpose: Provides methods to build edges. |
20 | -- |
21 | -- The methods have the following syntax, where |
22 | -- TheCurve is one of Lin, Circ, ... |
23 | -- |
24 | -- Create(C : TheCurve) |
25 | -- |
26 | -- Makes an edge on the whole curve. Add vertices |
27 | -- on finite curves. |
28 | -- |
29 | -- Create(C : TheCurve; p1,p2 : Real) |
30 | -- |
31 | -- Make an edge on the curve between parameters p1 |
32 | -- and p2. if p2 < p1 the edge will be REVERSED. If |
33 | -- p1 or p2 is infinite the curve will be open in |
34 | -- that direction. Vertices are created for finite |
35 | -- values of p1 and p2. |
36 | -- |
37 | -- Create(C : TheCurve; P1, P2 : Pnt from gp) |
38 | -- |
39 | -- Make an edge on the curve between the points P1 |
40 | -- and P2. The points are projected on the curve |
41 | -- and the previous method is used. An error is |
42 | -- raised if the points are not on the curve. |
43 | -- |
44 | -- Create(C : TheCurve; V1, V2 : Vertex from TopoDS) |
45 | -- |
46 | -- Make an edge on the curve between the vertices |
47 | -- V1 and V2. Same as the previous but no vertices |
48 | -- are created. If a vertex is Null the curve will |
49 | -- be open in this direction. |
50 | |
51 | uses |
52 | EdgeError from BRepBuilderAPI, |
53 | Edge from TopoDS, |
54 | Vertex from TopoDS, |
55 | Pnt from gp, |
56 | Lin from gp, |
57 | Circ from gp, |
58 | Elips from gp, |
59 | Hypr from gp, |
60 | Parab from gp, |
61 | Curve from Geom2d, |
62 | Curve from Geom, |
63 | Surface from Geom, |
64 | MakeEdge from BRepLib |
65 | |
66 | raises |
67 | NotDone from StdFail |
68 | |
69 | is |
70 | |
71 | Create returns MakeEdge from BRepBuilderAPI; |
72 | |
73 | ---------------------------------------- |
74 | -- Points |
75 | ---------------------------------------- |
76 | |
77 | Create(V1, V2 : Vertex from TopoDS) |
78 | ---Level: Public |
79 | returns MakeEdge from BRepBuilderAPI; |
80 | |
81 | Create(P1, P2 : Pnt from gp) |
82 | ---Level: Public |
83 | returns MakeEdge from BRepBuilderAPI; |
84 | |
85 | |
86 | ---------------------------------------- |
87 | -- Lin |
88 | ---------------------------------------- |
89 | |
90 | Create(L : Lin from gp) |
91 | ---Level: Public |
92 | returns MakeEdge from BRepBuilderAPI; |
93 | |
94 | Create(L : Lin from gp; p1,p2 : Real) |
95 | ---Level: Public |
96 | returns MakeEdge from BRepBuilderAPI; |
97 | |
98 | Create(L : Lin from gp; P1,P2 : Pnt from gp) |
99 | ---Level: Public |
100 | returns MakeEdge from BRepBuilderAPI; |
101 | |
102 | Create(L : Lin from gp; V1, V2 : Vertex from TopoDS) |
103 | ---Level: Public |
104 | returns MakeEdge from BRepBuilderAPI; |
105 | |
106 | ---------------------------------------- |
107 | -- Circ |
108 | ---------------------------------------- |
109 | |
110 | Create(L : Circ from gp) |
111 | ---Level: Public |
112 | returns MakeEdge from BRepBuilderAPI; |
113 | |
114 | Create(L : Circ from gp; p1,p2 : Real) |
115 | ---Level: Public |
116 | returns MakeEdge from BRepBuilderAPI; |
117 | |
118 | Create(L : Circ from gp; P1,P2 : Pnt from gp) |
119 | ---Level: Public |
120 | returns MakeEdge from BRepBuilderAPI; |
121 | |
122 | Create(L : Circ from gp; V1, V2 : Vertex from TopoDS) |
123 | ---Level: Public |
124 | returns MakeEdge from BRepBuilderAPI; |
125 | |
126 | |
127 | ---------------------------------------- |
128 | -- Elips |
129 | ---------------------------------------- |
130 | |
131 | Create(L : Elips from gp) |
132 | ---Level: Public |
133 | returns MakeEdge from BRepBuilderAPI; |
134 | |
135 | Create(L : Elips from gp; p1,p2 : Real) |
136 | ---Level: Public |
137 | returns MakeEdge from BRepBuilderAPI; |
138 | |
139 | Create(L : Elips from gp; P1,P2 : Pnt from gp) |
140 | ---Level: Public |
141 | returns MakeEdge from BRepBuilderAPI; |
142 | |
143 | Create(L : Elips from gp; V1, V2 : Vertex from TopoDS) |
144 | ---Level: Public |
145 | returns MakeEdge from BRepBuilderAPI; |
146 | |
147 | ---------------------------------------- |
148 | -- Hypr |
149 | ---------------------------------------- |
150 | |
151 | Create(L : Hypr from gp) |
152 | ---Level: Public |
153 | returns MakeEdge from BRepBuilderAPI; |
154 | |
155 | Create(L : Hypr from gp; p1,p2 : Real) |
156 | ---Level: Public |
157 | returns MakeEdge from BRepBuilderAPI; |
158 | |
159 | Create(L : Hypr from gp; P1,P2 : Pnt from gp) |
160 | ---Level: Public |
161 | returns MakeEdge from BRepBuilderAPI; |
162 | |
163 | Create(L : Hypr from gp; V1, V2 : Vertex from TopoDS) |
164 | ---Level: Public |
165 | returns MakeEdge from BRepBuilderAPI; |
166 | |
167 | ---------------------------------------- |
168 | -- Parab |
169 | ---------------------------------------- |
170 | |
171 | Create(L : Parab from gp) |
172 | ---Level: Public |
173 | returns MakeEdge from BRepBuilderAPI; |
174 | |
175 | Create(L : Parab from gp; p1,p2 : Real) |
176 | ---Level: Public |
177 | returns MakeEdge from BRepBuilderAPI; |
178 | |
179 | Create(L : Parab from gp; P1,P2 : Pnt from gp) |
180 | ---Level: Public |
181 | returns MakeEdge from BRepBuilderAPI; |
182 | |
183 | Create(L : Parab from gp; V1, V2 : Vertex from TopoDS) |
184 | ---Level: Public |
185 | returns MakeEdge from BRepBuilderAPI; |
186 | |
187 | ---------------------------------------- |
188 | -- Curve |
189 | ---------------------------------------- |
190 | |
191 | Create(L : Curve from Geom) |
192 | ---Level: Public |
193 | returns MakeEdge from BRepBuilderAPI; |
194 | |
195 | Create(L : Curve from Geom; p1,p2 : Real) |
196 | ---Level: Public |
197 | returns MakeEdge from BRepBuilderAPI; |
198 | |
199 | Create(L : Curve from Geom; |
200 | P1,P2 : Pnt from gp) |
201 | ---Level: Public |
202 | returns MakeEdge from BRepBuilderAPI; |
203 | |
204 | Create(L : Curve from Geom; |
205 | V1, V2 : Vertex from TopoDS) |
206 | ---Level: Public |
207 | returns MakeEdge from BRepBuilderAPI; |
208 | |
209 | Create(L : Curve from Geom; |
210 | P1,P2 : Pnt from gp; p1,p2 : Real) |
211 | ---Level: Public |
212 | returns MakeEdge from BRepBuilderAPI; |
213 | |
214 | Create(L : Curve from Geom; |
215 | V1, V2 : Vertex from TopoDS; |
216 | p1, p2 :Real) |
217 | ---Level: Public |
218 | returns MakeEdge from BRepBuilderAPI; |
219 | |
220 | ---------------------------------------- |
221 | -- Curve and surface |
222 | ---------------------------------------- |
223 | |
224 | Create(L : Curve from Geom2d; S : Surface from Geom) |
225 | ---Level: Public |
226 | returns MakeEdge from BRepBuilderAPI; |
227 | |
228 | Create(L : Curve from Geom2d; S : Surface from Geom; p1,p2 : Real) |
229 | ---Level: Public |
230 | returns MakeEdge from BRepBuilderAPI; |
231 | |
232 | Create(L : Curve from Geom2d; S : Surface from Geom; |
233 | P1,P2 : Pnt from gp) |
234 | ---Level: Public |
235 | returns MakeEdge from BRepBuilderAPI; |
236 | |
237 | Create(L : Curve from Geom2d; S : Surface from Geom; |
238 | V1, V2 : Vertex from TopoDS) |
239 | ---Level: Public |
240 | returns MakeEdge from BRepBuilderAPI; |
241 | |
242 | Create(L : Curve from Geom2d; S : Surface from Geom; |
243 | P1,P2 : Pnt from gp; p1,p2 : Real) |
244 | ---Level: Public |
245 | returns MakeEdge from BRepBuilderAPI; |
246 | |
247 | Create(L : Curve from Geom2d; S : Surface from Geom; |
248 | V1, V2 : Vertex from TopoDS; |
249 | p1, p2 :Real) |
250 | ---Level: Public |
251 | returns MakeEdge from BRepBuilderAPI; |
252 | |
253 | |
254 | ---Purpose: The general method to directly create an edge is to give |
255 | -- - a 3D curve C as the support (geometric domain) of the edge, |
256 | -- - two vertices V1 and V2 to limit the curve (definition of the restriction of |
257 | -- the edge), and |
258 | -- - two real values p1 and p2 which are the parameters for the vertices V1 and V2 |
259 | -- on the curve. |
260 | -- The curve may be defined as a 2d curve in the parametric space of a surface: a |
261 | -- pcurve. The surface on which the edge is built is then kept at the level of the edge. |
262 | -- The default tolerance will be associated with this edge. |
263 | -- Rules applied to the arguments: |
264 | -- For the curve: |
265 | -- - The curve must not be a 'null handle'. |
266 | -- - If the curve is a trimmed curve the basis curve is used. |
267 | -- For the vertices: |
268 | -- - Vertices may be null shapes. When V1 or V2 is null the edge is open in the |
269 | -- corresponding direction and the parameter value p1 or p2 must be infinite |
270 | -- (remember that Precision::Infinite() defines an infinite value). |
271 | -- - The two vertices must be identical if they have the same 3D location. |
272 | -- Identical vertices are used in particular when the curve is closed. |
273 | -- For the parameters: |
274 | -- - The parameters must be in the parametric range of the curve (or the basis |
275 | -- curve if the curve is trimmed). If this condition is not satisfied the edge is not |
276 | -- built, and the Error function will return BRepAPI_ParameterOutOfRange. |
277 | -- - Parameter values must not be equal. If this condition is not satisfied (i.e. |
278 | -- if | p1 - p2 | ) the edge is not built, and the Error function will return |
279 | -- BRepAPI_LineThroughIdenticPoints. |
280 | -- Parameter values are expected to be given in increasing order: |
281 | -- C->FirstParameter() |
282 | -- - If the parameter values are given in decreasing order the vertices are switched, |
283 | -- i.e. the "first vertex" is on the point of parameter p2 and the "second vertex" is |
284 | -- on the point of parameter p1. In such a case, to keep the original intent of the |
285 | -- construction, the edge will be oriented "reversed". |
286 | -- - On a periodic curve the parameter values p1 and p2 are adjusted by adding or |
287 | -- subtracting the period to obtain p1 in the parametric range of the curve, and p2] |
288 | -- such that [ p1 , where Period is the period of the curve. |
289 | -- - A parameter value may be infinite. The edge is open in the corresponding |
290 | -- direction. However the corresponding vertex must be a null shape. If this condition |
291 | -- is not satisfied the edge is not built, and the Error function will return |
292 | -- BRepAPI_PointWithInfiniteParameter. |
293 | -- - The distance between the vertex and the point evaluated on the curve with the |
294 | -- parameter, must be lower than the precision of the vertex. If this condition is not |
295 | -- satisfied the edge is not built, and the Error function will return |
296 | -- BRepAPI_DifferentsPointAndParameter. |
297 | -- Other edge constructions |
298 | -- - The parameter values can be omitted, they will be computed by projecting the |
299 | -- vertices on the curve. Note that projection is the only way to evaluate the |
300 | -- parameter values of the vertices on the curve: vertices must be given on the curve, |
301 | -- i.e. the distance from a vertex to the curve must be less than or equal to the |
302 | -- precision of the vertex. If this condition is not satisfied the edge is not built, |
303 | -- and the Error function will return BRepAPI_PointProjectionFailed. |
304 | -- - 3D points can be given in place of vertices. Vertices will be created from the |
305 | -- points (with the default topological precision Precision::Confusion()). |
306 | -- Note: |
307 | -- - Giving vertices is useful when creating a connected edge. |
308 | -- - If the parameter values correspond to the extremities of a closed curve, |
309 | -- points must be identical, or at least coincident. If this condition is not |
310 | -- satisfied the edge is not built, and the Error function will return |
311 | -- BRepAPI_DifferentPointsOnClosedCurve. |
312 | -- - The vertices or points can be omitted if the parameter values are given. The |
313 | -- points will be computed from the parameters on the curve. |
314 | -- The vertices or points and the parameter values can be omitted. The first and last |
315 | -- parameters of the curve will then be used. |
316 | ---------------------------------------- |
317 | -- Auxiliary methods |
318 | ---------------------------------------- |
319 | |
320 | Init(me : in out; C : Curve from Geom) |
321 | ---Level: Public |
322 | is static; |
323 | |
324 | Init(me : in out; C : Curve from Geom; |
325 | p1, p2 : Real) |
326 | ---Level: Public |
327 | is static; |
328 | |
329 | Init(me : in out; C : Curve from Geom; |
330 | P1, P2 : Pnt from gp) |
331 | ---Level: Public |
332 | is static; |
333 | |
334 | Init(me : in out; C : Curve from Geom; |
335 | V1, V2 : Vertex from TopoDS) |
336 | ---Level: Public |
337 | is static; |
338 | |
339 | Init(me : in out; C : Curve from Geom; |
340 | P1, P2 : Pnt from gp; |
341 | p1, p2 : Real) |
342 | ---Level: Public |
343 | is static; |
344 | |
345 | Init(me : in out; C : Curve from Geom; |
346 | V1, V2 : Vertex from TopoDS; |
347 | p1, p2 : Real) |
348 | ---Level: Public |
349 | is static; |
350 | |
351 | Init(me : in out; C : Curve from Geom2d; S : Surface from Geom) |
352 | ---Level: Public |
353 | is static; |
354 | |
355 | Init(me : in out; C : Curve from Geom2d; S : Surface from Geom; |
356 | p1, p2 : Real) |
357 | ---Level: Public |
358 | is static; |
359 | |
360 | Init(me : in out; C : Curve from Geom2d; S : Surface from Geom; |
361 | P1, P2 : Pnt from gp) |
362 | ---Level: Public |
363 | is static; |
364 | |
365 | Init(me : in out; C : Curve from Geom2d; S : Surface from Geom; |
366 | V1, V2 : Vertex from TopoDS) |
367 | ---Level: Public |
368 | is static; |
369 | |
370 | Init(me : in out; C : Curve from Geom2d; S : Surface from Geom; |
371 | P1, P2 : Pnt from gp; |
372 | p1, p2 : Real) |
373 | ---Level: Public |
374 | is static; |
375 | |
376 | Init(me : in out; C : Curve from Geom2d; S : Surface from Geom; |
377 | V1, V2 : Vertex from TopoDS; |
378 | p1, p2 : Real) |
379 | ---Level: Public |
380 | is static; |
381 | ---Purpose: Defines or redefines the arguments for the construction of an edge. |
382 | -- This function is currently used after the empty constructor BRepAPI_MakeEdge(). |
383 | |
384 | ---------------------------------------- |
385 | -- Results |
386 | ---------------------------------------- |
387 | |
388 | IsDone(me) returns Boolean |
389 | ---Purpose: Returns true if the edge is built. |
390 | is redefined; |
391 | |
392 | Error(me) returns EdgeError from BRepBuilderAPI |
393 | ---Purpose: Returns the construction status |
394 | -- - BRepBuilderAPI_EdgeDone if the edge is built, or |
395 | -- - another value of the BRepBuilderAPI_EdgeError |
396 | -- enumeration indicating the reason of construction failure. |
397 | is static; |
398 | |
399 | Edge(me) returns Edge from TopoDS |
400 | ---C++: return const & |
401 | ---C++: alias "Standard_EXPORT operator TopoDS_Edge() const;" |
402 | --- Purpose: |
403 | -- Returns the constructed edge. |
404 | -- Exceptions StdFail_NotDone if the edge is not built. |
405 | raises |
406 | NotDone from StdFail |
407 | is static; |
408 | |
409 | Vertex1(me) returns Vertex from TopoDS |
410 | ---Purpose: Returns the first vertex of the edge. May be Null. |
411 | -- |
412 | ---C++: return const & |
413 | ---Level: Public |
414 | is static; |
415 | |
416 | Vertex2(me) returns Vertex from TopoDS |
417 | ---C++: return const & |
418 | ---Purpose: Returns the second vertex of the edge. May be Null. |
419 | -- |
420 | -- Warning |
421 | -- The returned vertex in each function corresponds respectively to |
422 | -- - the lowest, or |
423 | -- - the highest parameter on the curve along which the edge is built. |
424 | -- It does not correspond to the first or second vertex |
425 | -- given at the time of the construction, if the edge is oriented reversed. |
426 | -- Exceptions |
427 | -- StdFail_NotDone if the edge is not built. |
428 | is static; |
429 | |
430 | fields |
431 | |
432 | myMakeEdge : MakeEdge from BRepLib; |
433 | |
434 | end MakeEdge; |