b311480e |
1 | -- Created on: 1995-08-31 |
2 | -- Created by: Remi LEQUETTE |
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 MakeFillet2d from BRepFilletAPI inherits MakeShape from BRepBuilderAPI |
18 | |
19 | ---Purpose: Describes functions to build fillets and chamfers on the |
20 | -- vertices of a planar face. |
21 | -- Fillets and Chamfers on the Vertices of a Planar Face |
22 | -- A MakeFillet2d object provides a framework for: |
23 | -- - initializing the construction algorithm with a given face, |
24 | -- - acquiring the data characterizing the fillets and chamfers, |
25 | -- - building the fillets and chamfers, and constructing the |
26 | -- resulting shape, and |
27 | -- - consulting the result. |
28 | -- Warning |
29 | -- Only segments of straight lines and arcs of circles are |
30 | -- treated. BSplines are not processed. |
31 | |
32 | uses |
33 | Builder from ChFi2d, |
34 | ConstructionError from ChFi2d, |
35 | Face from TopoDS, |
36 | Edge from TopoDS, |
37 | Vertex from TopoDS, |
38 | Shape from TopoDS, |
39 | ShapeModification from BRepBuilderAPI, |
40 | SequenceOfShape from TopTools, |
41 | ListOfShape from TopTools |
42 | |
43 | is |
44 | |
45 | |
46 | Create returns MakeFillet2d from BRepFilletAPI; |
47 | ---Purpose: Initializes an empty algorithm for computing fillets and |
48 | -- chamfers. The face on which the fillets and |
49 | -- chamfers are built is defined using the Init function. |
50 | -- The vertices on which fillets or chamfers are built are |
51 | -- defined using the AddFillet or AddChamfer function. |
52 | -- Warning |
53 | -- The status of the initialization, as given by the Status |
54 | -- function, can be one of the following: |
55 | -- - ChFi2d_Ready if the initialization is correct, |
56 | -- - ChFi2d_NotPlanar if F is not planar, |
57 | -- - ChFi2d_NoFace if F is a null face. |
58 | |
59 | Create ( F : Face ) returns MakeFillet2d from BRepFilletAPI; |
60 | ---Purpose: Initializes an algorithm for computing fillets and chamfers on the face F. |
61 | -- The vertices on which fillets or chamfers are built are |
62 | -- defined using the AddFillet or AddChamfer function. |
63 | -- Warning |
64 | -- The status of the initialization, as given by the Status |
65 | -- function, can be one of the following: |
66 | -- - ChFi2d_Ready if the initialization is correct, |
67 | -- - ChFi2d_NotPlanar if F is not planar, |
68 | -- - ChFi2d_NoFace if F is a null face. |
69 | |
70 | |
71 | Init( me : in out; F : Face ); |
72 | ---Purpose: Initializes this algorithm for constructing fillets or |
73 | -- chamfers with the face F. |
74 | -- Warning |
75 | -- The status of the initialization, as given by the Status |
76 | -- function, can be one of the following: |
77 | -- - ChFi2d_Ready if the initialization is correct, |
78 | -- - ChFi2d_NotPlanar if F is not planar, |
79 | -- - ChFi2d_NoFace if F is a null face. |
80 | |
81 | Init( me : in out; RefFace, ModFace : Face ); |
82 | ---Purpose: This initialize method allow to init the builder |
83 | -- from a face <RefFace> and another face <ModFace> |
84 | -- which derive from <RefFace>. This is usefull to |
85 | -- modify a fillet or a chamfer already created on |
86 | -- <ModFace> . |
87 | |
88 | |
89 | AddFillet ( me : in out; V : Vertex; Radius : Real ) returns Edge; |
90 | ---Purpose: Adds a fillet of radius Radius between the two edges |
91 | -- adjacent to the vertex V on the face modified by this |
92 | -- algorithm. The two edges do not need to be rectilinear. |
93 | -- This function returns the fillet and builds the resulting face. |
94 | -- Warning |
95 | -- The status of the construction, as given by the Status |
96 | -- function, can be one of the following: |
97 | -- - ChFi2d_IsDone if the fillet is built, |
98 | -- - ChFi2d_ConnexionError if V does not belong to the initial face, |
99 | -- - ChFi2d_ComputationError if Radius is too large |
100 | -- to build a fillet between the two adjacent edges, |
101 | -- - ChFi2d_NotAuthorized |
102 | -- - if one of the two edges connected to V is a fillet or chamfer, or |
103 | -- - if a curve other than a straight line or an arc of a |
104 | -- circle is used as E, E1 or E2. |
105 | -- Do not use the returned fillet if the status of the construction is not ChFi2d_IsDone. |
106 | -- Exceptions |
107 | -- Standard_NegativeValue if Radius is less than or equal to zero. |
108 | |
109 | |
110 | ModifyFillet ( me : in out; Fillet : Edge; Radius : Real) |
111 | returns Edge; |
112 | ---Purpose: Assigns the radius Radius to the fillet Fillet already |
113 | -- built on the face modified by this algorithm. |
114 | -- This function returns the new fillet and modifies the existing face. |
115 | -- Warning |
116 | -- The status of the construction, as given by the Status |
117 | -- function, can be one of the following: |
118 | -- - ChFi2d_IsDone if the new fillet is built, |
119 | -- - ChFi2d_ConnexionError if Fillet does not |
120 | -- belong to the existing face, |
121 | -- - ChFi2d_ComputationError if Radius is too |
122 | -- large to build a fillet between the two adjacent edges. |
123 | -- Do not use the returned fillet if the status of the |
124 | -- construction is not ChFi2d_IsDone. |
125 | -- Exceptions |
126 | -- Standard_NegativeValue if Radius is less than or equal to zero. |
127 | |
128 | RemoveFillet( me : in out; Fillet : Edge) |
129 | returns Vertex; |
130 | ---Purpose: Removes the fillet Fillet already built on the face |
131 | -- modified by this algorithm. |
132 | -- This function returns the vertex connecting the two |
133 | -- adjacent edges of Fillet and modifies the existing face. |
134 | -- Warning |
135 | -- - The returned vertex is only valid if the Status |
136 | -- function returns ChFi2d_IsDone. |
137 | -- - A null vertex is returned if the edge Fillet does not |
138 | -- belong to the initial face. |
139 | |
140 | |
141 | AddChamfer ( me : in out; E1, E2 : Edge; D1, D2 : Real ) |
142 | returns Edge; |
143 | ---Purpose: Adds a chamfer on the face modified by this algorithm |
144 | -- between the two adjacent edges E1 and E2, where |
145 | -- the extremities of the chamfer are on E1 and E2 at |
146 | -- distances D1 and D2 respectively |
147 | -- In cases where the edges are not rectilinear, distances |
148 | -- are measured using the curvilinear abscissa of the |
149 | -- edges and the angle is measured with respect to the |
150 | -- tangent at the corresponding point. |
151 | -- The angle Ang is given in radians. |
152 | -- This function returns the chamfer and builds the resulting face. |
153 | |
154 | AddChamfer ( me : in out; E : Edge; V : Vertex; D, Ang : Real ) |
155 | returns Edge; |
156 | ---Purpose: Adds a chamfer on the face modified by this algorithm |
157 | -- between the two edges connected by the vertex V, |
158 | -- where E is one of the two edges. The chamfer makes |
159 | -- an angle Ang with E and one of its extremities is on |
160 | -- E at distance D from V. |
161 | -- In cases where the edges are not rectilinear, distances |
162 | -- are measured using the curvilinear abscissa of the |
163 | -- edges and the angle is measured with respect to the |
164 | -- tangent at the corresponding point. |
165 | -- The angle Ang is given in radians. |
166 | -- This function returns the chamfer and builds the resulting face. |
167 | -- Warning |
168 | -- The status of the construction, as given by the Status function, can |
169 | -- be one of the following: |
170 | -- - ChFi2d_IsDone if the chamfer is built, |
171 | -- - ChFi2d_ParametersError if D1, D2, D or Ang is less than or equal to zero, |
172 | -- - ChFi2d_ConnexionError if: |
173 | -- - the edge E, E1 or E2 does not belong to the initial face, or |
174 | -- - the edges E1 and E2 are not adjacent, or |
175 | -- - the vertex V is not one of the limit points of the edge E, |
176 | -- - ChFi2d_ComputationError if the parameters of the chamfer |
177 | -- are too large to build a chamfer between the two adjacent edges, |
178 | -- - ChFi2d_NotAuthorized if: |
179 | -- - the edge E1, E2 or one of the two edges connected to V is a fillet or chamfer, or |
180 | -- - a curve other than a straight line or an arc of a circle is used as E, E1 or E2. |
181 | -- Do not use the returned chamfer if |
182 | -- the status of the construction is not ChFi2d_IsDone. |
183 | |
184 | ModifyChamfer ( me : in out; Chamfer : Edge; |
185 | E1 : Edge; E2 : Edge; D1, D2 : Real) |
186 | returns Edge; |
187 | ---Purpose: Modifies the chamfer Chamfer on the face modified |
188 | -- by this algorithm, where: |
189 | -- E1 and E2 are the two adjacent edges on which |
190 | -- Chamfer is already built; the extremities of the new |
191 | -- chamfer are on E1 and E2 at distances D1 and D2 respectively. |
192 | |
193 | |
194 | ModifyChamfer ( me : in out; Chamfer, E : Edge; D, Ang : Real) |
195 | returns Edge; |
196 | ---Purpose: Modifies the chamfer Chamfer on the face modified |
197 | -- by this algorithm, where: |
198 | -- E is one of the two adjacent edges on which |
199 | -- Chamfer is already built; the new chamfer makes |
200 | -- an angle Ang with E and one of its extremities is |
201 | -- on E at distance D from the vertex on which the chamfer is built. |
202 | -- In cases where the edges are not rectilinear, the |
203 | -- distances are measured using the curvilinear abscissa |
204 | -- of the edges and the angle is measured with respect |
205 | -- to the tangent at the corresponding point. |
206 | -- The angle Ang is given in radians. |
207 | -- This function returns the new chamfer and modifies the existing face. |
208 | -- Warning |
209 | -- The status of the construction, as given by the Status |
210 | -- function, can be one of the following: |
211 | -- - ChFi2d_IsDone if the chamfer is built, |
212 | -- - ChFi2d_ParametersError if D1, D2, D or Ang is less than or equal to zero, |
213 | -- - ChFi2d_ConnexionError if: |
214 | -- - the edge E, E1, E2 or Chamfer does not belong |
215 | -- to the existing face, or |
216 | -- - the edges E1 and E2 are not adjacent, |
217 | -- - ChFi2d_ComputationError if the parameters of |
218 | -- the chamfer are too large to build a chamfer |
219 | -- between the two adjacent edges, |
220 | -- - ChFi2d_NotAuthorized if E1 or E2 is a fillet or chamfer. |
221 | -- Do not use the returned chamfer if the status of the |
222 | -- construction is not ChFi2d_IsDone. |
223 | |
224 | RemoveChamfer( me : in out; Chamfer : Edge) |
225 | returns Vertex; |
226 | ---Purpose: Removes the chamfer Chamfer already built on the face |
227 | -- modified by this algorithm. |
228 | -- This function returns the vertex connecting the two |
229 | -- adjacent edges of Chamfer and modifies the existing face. |
230 | -- Warning |
231 | -- - The returned vertex is only valid if the Status |
232 | -- function returns ChFi2d_IsDone. |
233 | -- - A null vertex is returned if the edge Chamfer does |
234 | -- not belong to the initial face. |
235 | |
236 | ---------------------------------------------- |
237 | -- Results |
238 | ---------------------------------------------- |
239 | |
240 | IsModified( me; E : Edge ) returns Boolean; |
241 | ---Purpose: Returns true if the edge E on the face modified by this |
242 | -- algorithm is chamfered or filleted. |
243 | -- Warning |
244 | -- Returns false if E does not belong to the face modified by this algorithm. |
245 | ---C++: inline |
246 | |
247 | |
248 | FilletEdges( me ) returns SequenceOfShape; |
249 | ---Purpose: Returns the table of fillets on the face modified by this algorithm. |
250 | ---C++: return const & |
251 | ---C++: inline |
252 | |
253 | NbFillet( me ) returns Integer; |
254 | ---Purpose: Returns the number of fillets on the face modified by this algorithm. |
255 | ---C++: inline |
256 | |
257 | |
258 | ChamferEdges( me ) returns SequenceOfShape; |
259 | ---Purpose: Returns the table of chamfers on the face modified by this algorithm. |
260 | ---C++: return const & |
261 | ---C++: inline |
262 | |
263 | NbChamfer( me ) returns Integer; |
264 | ---Purpose: Returns the number of chamfers on the face modified by this algorithm. |
265 | ---C++: inline |
266 | |
267 | ------------------------------------------- |
268 | -- Methods usefull for historical utilities -- |
269 | ------------------------------------------- |
270 | |
271 | Modified (me: in out; S : Shape from TopoDS) |
272 | ---Purpose: Returns the list of shapes modified from the shape |
273 | -- <S>. |
274 | ---C++: return const & |
275 | ---Level: Public |
276 | returns ListOfShape from TopTools |
277 | is redefined virtual; |
278 | |
279 | NbCurves(me) |
280 | ---Purpose: returns the number of new curves |
281 | -- after the shape creation. |
282 | ---Level: Public |
283 | returns Integer from Standard; |
284 | |
285 | |
286 | |
287 | NewEdges(me: in out; I: Integer from Standard) |
288 | ---Purpose: Return the Edges created for curve I. |
289 | ---C++: return const & |
290 | ---Level: Public |
291 | returns ListOfShape from TopTools; |
292 | |
293 | |
294 | |
295 | HasDescendant( me; E : Edge) returns Boolean; |
296 | ---C++: inline |
297 | |
298 | |
299 | DescendantEdge( me; E : Edge) returns Edge; |
300 | ---Purpose: Returns the chamfered or filleted edge built from the |
301 | -- edge E on the face modified by this algorithm. If E has |
302 | -- not been modified, this function returns E. |
303 | -- Exceptions |
304 | -- Standard_NoSuchObject if the edge E does not |
305 | -- belong to the initial face. |
306 | ---C++: return const & |
307 | ---C++: inline |
308 | |
309 | |
310 | BasisEdge( me; E : Edge) returns Edge; |
311 | ---Purpose: Returns the basis edge on the face modified by this |
312 | -- algorithm from which the chamfered or filleted edge E is |
313 | -- built. If E has not been modified, this function returns E. |
314 | -- Warning |
315 | -- E is returned if it does not belong to the initial face. |
316 | ---C++: return const & |
317 | |
318 | Status(me) returns ConstructionError from ChFi2d; |
319 | ---C++: inline |
320 | |
321 | |
322 | Build(me : in out) |
323 | ---Purpose: Update the result and set the Done flag |
324 | ---Level: Public |
325 | is redefined; |
326 | |
327 | |
328 | fields |
329 | |
330 | myMakeChFi2d : Builder from ChFi2d; |
331 | |
332 | end MakeFillet2d; |