1 -- Created on: 1994-06-17
2 -- Created by: Modeling
3 -- Copyright (c) 1994-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class MakeFillet from BRepFilletAPI inherits LocalOperation from BRepFilletAPI
19 ---Purpose: Describes functions to build fillets on the broken edges of a shell or solid.
20 -- A MakeFillet object provides a framework for:
21 -- - initializing the construction algorithm with a given shape,
22 -- - acquiring the data characterizing the fillets,
23 -- - building the fillets and constructing the resulting shape, and
24 -- - consulting the result.
29 Array1OfPnt2d from TColgp,
37 ListOfShape from TopTools,
38 SecHArray1 from ChFiDS,
39 ErrorStatus from ChFiDS,
40 FilBuilder from ChFi3d,
41 FilletShape from ChFi3d,
42 HBuilder from TopOpeBRepBuild,
43 MapOfShape from TopTools,
44 ShapeModification from BRepBuilderAPI
47 NotDone from StdFail ,
48 NoSuchObject from Standard
51 Create(S : Shape from TopoDS;
52 FShape: FilletShape from ChFi3d = ChFi3d_Rational)
53 ---Purpose: Initializes the computation of the fillets.
54 -- <FShape> sets the type of fillet surface. The
55 -- default value is ChFi3d_Rational (classical nurbs
56 -- representation of circles). ChFi3d_QuasiAngular
57 -- corresponds to a nurbs representation of circles
58 -- which parameterisation matches the circle one.
59 -- ChFi3d_Polynomial corresponds to a polynomial
60 -- representation of circles.
62 returns MakeFillet from BRepFilletAPI;
64 SetParams(me : in out;
65 Tang, Tesp, T2d, TApp3d, TolApp2d, Fleche: Real from Standard)
69 SetContinuity(me : in out;
70 InternalContinuity : Shape from GeomAbs;
71 AngularTolerance : Real);
72 ---Purpose: Changes the parameters of continiuity
73 -- InternalContinuity to produce fillet'surfaces with
74 -- an continuity Ci (i=0,1 or 2).
75 -- By defaultInternalContinuity = GeomAbs_C1.
76 -- AngularTolerance is the G1 tolerance between fillet
81 Add(me : in out; E : Edge from TopoDS)
82 ---Purpose: Adds a fillet contour in the builder (builds a
83 -- contour of tangent edges).
84 -- The Radius must be set after.
89 Add(me : in out; Radius : Real; E : Edge from TopoDS)
90 ---Purpose: Adds a fillet description in the builder
91 -- - builds a contour of tangent edges,
97 Add(me : in out; R1,R2 : Real; E : Edge from TopoDS)
98 ---Purpose: Adds a fillet description in the builder
99 -- - builds a contour of tangent edges,
100 -- - sets a linear radius evolution law between
101 -- the first and last vertex of the spine.
106 Add(me : in out; L : Function from Law; E : Edge from TopoDS)
107 ---Purpose: Adds a fillet description in the builder
108 -- - builds a contour of tangent edges,
109 -- - sest the radius evolution law.
114 Add(me : in out; UandR : Array1OfPnt2d from TColgp; E : Edge from TopoDS)
115 ---Purpose: Adds a fillet description in the builder
116 -- - builds a contour of tangent edges,
117 -- - sets the radius evolution law interpolating the values
118 -- given in the array UandR :
120 -- p2d.X() = relative parameter on the spine [0,1]
121 -- p2d.Y() = value of the radius.
126 SetRadius(me : in out;
127 Radius : Real from Standard;
128 IC : Integer from Standard;
129 IinC : Integer from Standard)
130 ---Purpose: Sets the parameters of the fillet
131 -- along the contour of index IC generated using the Add function
132 -- in the internal data structure of
133 -- this algorithm, where Radius is the radius of the fillet.
136 SetRadius(me : in out;
137 R1,R2 : Real from Standard;
138 IC : Integer from Standard;
139 IinC : Integer from Standard)
140 ---Purpose: Sets the parameters of the fillet
141 -- along the contour of index IC generated using the Add function
142 -- in the internal data structure of this algorithm, where the radius of the
143 -- fillet evolves according to a linear evolution law defined
144 -- from R1 to R2, between the first and last vertices of the contour of index IC.
147 SetRadius(me : in out;
148 L : Function from Law;
149 IC : Integer from Standard;
150 IinC : Integer from Standard)
151 ---Purpose: Sets the parameters of the fillet
152 -- along the contour of index IC generated using the Add function
153 -- in the internal data structure of this algorithm, where the radius of the
154 -- fillet evolves according to the evolution law L, between the
155 -- first and last vertices of the contour of index IC.
158 SetRadius(me : in out;
159 UandR : Array1OfPnt2d from TColgp;
160 IC : Integer from Standard;
161 IinC : Integer from Standard)
162 ---Purpose: Sets the parameters of the fillet
163 -- along the contour of index IC generated using the Add function
164 -- in the internal data structure of this algorithm,
165 -- where the radius of the fillet evolves according to the evolution law
166 -- which interpolates the set of parameter and radius pairs given
167 -- in the array UandR as follows:
168 -- - the X coordinate of a point in UandR defines a
169 -- relative parameter on the contour (i.e. a parameter between 0 and 1),
170 -- - the Y coordinate of a point in UandR gives the
171 -- corresponding value of the radius, and the radius evolves
172 -- between the first and last vertices of the contour of index IC.
175 ResetContour(me : in out;
176 IC : Integer from Standard)
177 ---Purpose: Erases the radius information on the contour of index
178 -- IC in the internal data structure of this algorithm.
179 -- Use the SetRadius function to reset this data.
181 -- Nothing is done if IC is outside the bounds of the table of contours.
184 IsConstant(me : in out;
185 IC : Integer from Standard)
186 returns Boolean from Standard
187 ---Purpose: Returns true if the radius of the fillet along the contour of index IC
188 -- in the internal data structure of this algorithm is constant,
190 -- False is returned if IC is outside the bounds of the table
191 -- of contours or if E does not belong to the contour of index IC.
195 IC : Integer from Standard)
196 returns Real from Standard
197 ---Purpose: Returns the radius of the fillet along the contour of index IC in the
198 -- internal data structure of this algorithm
200 -- - Use this function only if the radius is constant.
201 -- - -1. is returned if IC is outside the bounds of the
202 -- table of contours or if E does not belong to the contour of index IC.
206 IsConstant(me : in out;
207 IC : Integer from Standard;
208 E : Edge from TopoDS)
209 returns Boolean from Standard
210 ---Purpose: Returns true if the radius of the fillet along the edge E of the
211 -- contour of index IC in the internal data structure of
212 -- this algorithm is constant.
214 -- False is returned if IC is outside the bounds of the table
215 -- of contours or if E does not belong to the contour of index IC.
219 IC : Integer from Standard;
220 E : Edge from TopoDS)
221 returns Real from Standard
222 ---Purpose: Returns the radius of the fillet along the edge E of the contour of index
223 -- IC in the internal data structure of this algorithm.
225 -- - Use this function only if the radius is constant.
226 -- - -1 is returned if IC is outside the bounds of the
227 -- table of contours or if E does not belong to the contour of index IC.
230 SetRadius(me : in out;
232 IC : Integer from Standard;
233 E : Edge from TopoDS)
234 ---Purpose: Assigns Radius as the radius of the fillet on the edge E
237 SetRadius(me : in out;
239 IC : Integer from Standard;
240 V : Vertex from TopoDS)
241 --Purpose: Assigns Radius as the radius of the fillet on the vertex V.
242 -- These two functions are only used on contours where
243 -- the radius has not been defined. They enable radius
244 -- values to be assigned locally either to points on the
245 -- contour (in particular, the first and last vertices) or to
246 -- portions of the contour. During construction of the fillet,
247 -- an interpolation using the given values is carried out.
249 -- Nothing is done if:
250 -- - the edge E does not belong to the contour of index IC, or
251 -- - IC is outside the bound of the table of contours, or
256 GetBounds(me : in out;
257 IC : Integer from Standard;
258 E : Edge from TopoDS;
259 F,L : out Real from Standard)
260 returns Boolean from Standard;
263 IC : Integer from Standard;
264 E : Edge from TopoDS)
265 returns Function from Law;
268 IC : Integer from Standard;
269 E : Edge from TopoDS;
270 L : Function from Law);
274 ------------------------------------------------------------------
276 SetFilletShape(me: in out; FShape: FilletShape from ChFi3d)
277 ---Purpose: Assigns FShape as the type of fillet shape built by this algorithm.
281 ---Purpose: Returns the type of fillet shape built by this algorithm.
282 returns FilletShape from ChFi3d
286 ---Purpose: Returns the number of contours generated using the
287 -- Add function in the internal data structure of this algorithm.
288 returns Integer from Standard is static;
290 Contour(me; E : Edge from TopoDS)
291 ---Purpose: Returns the index of the contour in the internal data
292 -- structure of this algorithm which contains the edge E of the shape.
293 -- This function returns 0 if the edge E does not belong to any contour.
295 -- This index can change if a contour is removed from the
296 -- internal data structure of this algorithm using the function Remove.
297 returns Integer from Standard is static;
299 NbEdges(me; I : Integer from Standard)
300 ---Purpose: Returns the number of edges in the contour of index I in
301 -- the internal data structure of this algorithm.
303 -- Returns 0 if I is outside the bounds of the table of contours.
304 returns Integer from Standard
307 Edge(me; I,J : Integer from Standard)
308 ---Purpose: Returns the edge of index J in the contour of index I in
309 -- the internal data structure of this algorithm.
311 -- Returns a null shape if:
312 -- - I is outside the bounds of the table of contours, or
313 -- - J is outside the bounds of the table of edges of the index I contour.
314 ---C++: return const &
315 returns Edge from TopoDS
318 Remove(me : in out; E : Edge from TopoDS)
319 ---Purpose: Removes the contour in the internal data structure of
320 -- this algorithm which contains the edge E of the shape.
322 -- Nothing is done if the edge E does not belong to the
323 -- contour in the internal data structure of this algorithm.
326 Length(me; IC : Integer from Standard) returns Real from Standard
327 ---Purpose: Returns the length of the contour of index IC in the
328 -- internal data structure of this algorithm.
330 -- Returns -1. if IC is outside the bounds of the table of contours.
333 FirstVertex(me; IC : Integer from Standard) returns Vertex from TopoDS
334 ---Purpose: Returns the first vertex of the contour of index IC
335 -- in the internal data structure of this algorithm.
337 -- Returns a null shape if IC is outside the bounds of the table of contours.
340 LastVertex(me; IC : Integer from Standard) returns Vertex from TopoDS
341 ---Purpose: Returns the last vertex of the contour of index IC
342 -- in the internal data structure of this algorithm.
344 -- Returns a null shape if IC is outside the bounds of the table of contours.
348 IC : Integer from Standard;
349 V : Vertex from TopoDS)
350 returns Real from Standard
351 ---Purpose: Returns the curvilinear abscissa of the vertex V on the
352 -- contour of index IC in the internal data structure of this algorithm.
355 -- - IC is outside the bounds of the table of contours, or
356 -- - V is not on the contour of index IC.
360 IC : Integer from Standard;
361 V : Vertex from TopoDS)
362 returns Real from Standard
363 ---Purpose: Returns the relative curvilinear abscissa (i.e. between 0
364 -- and 1) of the vertex V on the contour of index IC in the
365 -- internal data structure of this algorithm.
368 -- - IC is outside the bounds of the table of contours, or
369 -- - V is not on the contour of index IC.
372 ClosedAndTangent(me; IC : Integer from Standard)
373 returns Boolean from Standard
374 ---Purpose: Returns true if the contour of index IC in the internal
375 -- data structure of this algorithm is closed and tangential
376 -- at the point of closure.
378 -- Returns false if IC is outside the bounds of the table of contours.
381 Closed(me; IC : Integer from Standard)
382 returns Boolean from Standard
383 ---Purpose: Returns true if the contour of index IC in the internal
384 -- data structure of this algorithm is closed.
386 -- Returns false if IC is outside the bounds of the table of contours.
391 ---Purpose: Builds the fillets on all the contours in the internal data
392 -- structure of this algorithm and constructs the resulting shape.
393 -- Use the function IsDone to verify that the filleted shape
394 -- is built. Use the function Shape to retrieve the filleted shape.
396 -- The construction of fillets implements highly complex
397 -- construction algorithms. Consequently, there may be
398 -- instances where the algorithm fails, for example if the
399 -- data defining the radius of the fillet is not compatible
400 -- with the geometry of the initial shape. There is no initial
401 -- analysis of errors and they only become evident at the
402 -- construction stage.
403 -- Additionally, in the current software release, the
404 -- following cases are not handled:
405 -- - the end point of the contour is the point of
406 -- intersection of 4 or more edges of the shape, or
407 -- - the intersection of the fillet with a face which limits
408 -- the contour is not fully contained in this face.
411 ---Purpose: Reinitializes this algorithm, thus canceling the effects of the Build function.
412 -- This function allows modifications to be made to the
413 -- contours and fillet parameters in order to rebuild the shape.
416 Builder(me) returns HBuilder from TopOpeBRepBuild
417 ---Purpose: Returns the internal topology building algorithm.
422 -------------------------------------------
423 -- Methods usefull for historical utilities --
424 -------------------------------------------
425 Generated (me: in out; EorV : Shape from TopoDS)
426 ---Purpose: Returns the list of shapes generated from the
428 ---C++: return const &
430 returns ListOfShape from TopTools
431 is redefined virtual;
434 Modified (me: in out; F : Shape from TopoDS)
435 ---Purpose: Returns the list of shapes modified from the shape
437 ---C++: return const &
439 returns ListOfShape from TopTools
440 is redefined virtual;
443 IsDeleted (me: in out; F : Shape from TopoDS)
445 is redefined virtual;
447 -------------------------------------------
448 -- Methods usefull for BRepCtx utilities --
449 -------------------------------------------
452 ---Purpose: returns the number of surfaces
453 -- after the shape creation.
455 returns Integer from Standard;
458 NewFaces(me: in out; I: Integer)
459 ---Purpose: Return the faces created for surface <I>.
460 ---C++: return const &
462 returns ListOfShape from TopTools;
464 -------------------------------
465 ---Methods for quick simulation
466 -------------------------------
468 Simulate(me : in out;
469 IC : Integer from Standard);
471 NbSurf(me; IC : Integer from Standard)
472 returns Integer from Standard;
474 Sect(me; IC, IS : Integer from Standard)
475 returns SecHArray1 from ChFiDS;
478 -------------------------------------
479 --- Methods for managing errors
480 -------------------------------------
483 ---Purpose: Returns the number of contours where the computation
484 -- of the fillet failed
485 returns Integer from Standard is static;
487 FaultyContour(me; I : Integer from Standard)
488 ---Purpose: for each I in [1.. NbFaultyContours] returns the index IC of
489 -- the contour where the computation of the fillet failed.
490 -- the method NbEdges(IC) gives the number of edges in the contour IC
491 -- the method Edge(IC,ie) gives the edge number ie of the contour IC
492 returns Integer from Standard is static;
494 NbComputedSurfaces(me; IC : Integer from Standard)
495 ---Purpose: returns the number of surfaces which have been
496 -- computed on the contour IC
497 returns Integer from Standard is static;
499 ComputedSurface(me; IC, IS : Integer from Standard)
500 ---Purpose: returns the surface number IS concerning the contour IC
501 returns Surface from Geom is static;
504 ---Purpose: returns the number of vertices where the computation failed
505 returns Integer from Standard is static;
507 FaultyVertex(me; IV : Integer from Standard)
508 ---Purpose: returns the vertex where the computation failed
509 returns Vertex from TopoDS is static;
511 HasResult(me) returns Boolean from Standard is static;
512 ---Purpose: returns true if a part of the result has been computed
513 -- if the filling in a corner failed a shape with a hole is returned
515 BadShape(me) returns Shape from TopoDS
516 ---Purpose: if (HasResult()) returns the partial result
517 raises NoSuchObject from Standard
520 StripeStatus(me;IC : Integer from Standard) returns ErrorStatus from ChFiDS
521 ---Purpose: returns the status concerning the contour IC in case of error
522 -- ChFiDS_Ok : the computation is Ok
523 -- ChFiDS_StartsolFailure : the computation can't start, perhaps the
524 -- the radius is too big
525 -- ChFiDS_TwistedSurface : the computation failed because of a twisted
527 -- ChFiDS_WalkingFailure : there is a problem in the walking
528 -- ChFiDS_Error: other error different from above
533 myBuilder : FilBuilder from ChFi3d;
534 myMap : MapOfShape from TopTools;