0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / BRepFilletAPI / BRepFilletAPI_MakeFillet2d.hxx
CommitLineData
42cf5bc1 1// Created on: 1995-08-31
2// Created by: Remi LEQUETTE
3// Copyright (c) 1995-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _BRepFilletAPI_MakeFillet2d_HeaderFile
18#define _BRepFilletAPI_MakeFillet2d_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <ChFi2d_Builder.hxx>
25#include <BRepBuilderAPI_MakeShape.hxx>
26#include <Standard_Real.hxx>
27#include <Standard_Boolean.hxx>
28#include <TopTools_SequenceOfShape.hxx>
29#include <Standard_Integer.hxx>
30#include <TopTools_ListOfShape.hxx>
31#include <ChFi2d_ConstructionError.hxx>
32class TopoDS_Face;
33class TopoDS_Edge;
34class TopoDS_Vertex;
35class TopoDS_Shape;
36
9fd2d2c3 37// resolve name collisions with X11 headers
38#ifdef Status
39 #undef Status
40#endif
42cf5bc1 41
42//! Describes functions to build fillets and chamfers on the
43//! vertices of a planar face.
44//! Fillets and Chamfers on the Vertices of a Planar Face
45//! A MakeFillet2d object provides a framework for:
46//! - initializing the construction algorithm with a given face,
47//! - acquiring the data characterizing the fillets and chamfers,
48//! - building the fillets and chamfers, and constructing the
49//! resulting shape, and
50//! - consulting the result.
51//! Warning
52//! Only segments of straight lines and arcs of circles are
53//! treated. BSplines are not processed.
54class BRepFilletAPI_MakeFillet2d : public BRepBuilderAPI_MakeShape
55{
56public:
57
58 DEFINE_STANDARD_ALLOC
59
60
61 //! Initializes an empty algorithm for computing fillets and
62 //! chamfers. The face on which the fillets and
63 //! chamfers are built is defined using the Init function.
64 //! The vertices on which fillets or chamfers are built are
65 //! defined using the AddFillet or AddChamfer function.
66 //! Warning
67 //! The status of the initialization, as given by the Status
68 //! function, can be one of the following:
69 //! - ChFi2d_Ready if the initialization is correct,
70 //! - ChFi2d_NotPlanar if F is not planar,
71 //! - ChFi2d_NoFace if F is a null face.
72 Standard_EXPORT BRepFilletAPI_MakeFillet2d();
73
74 //! Initializes an algorithm for computing fillets and chamfers on the face F.
75 //! The vertices on which fillets or chamfers are built are
76 //! defined using the AddFillet or AddChamfer function.
77 //! Warning
78 //! The status of the initialization, as given by the Status
79 //! function, can be one of the following:
80 //! - ChFi2d_Ready if the initialization is correct,
81 //! - ChFi2d_NotPlanar if F is not planar,
82 //! - ChFi2d_NoFace if F is a null face.
83 Standard_EXPORT BRepFilletAPI_MakeFillet2d(const TopoDS_Face& F);
84
85 //! Initializes this algorithm for constructing fillets or
86 //! chamfers with the face F.
87 //! Warning
88 //! The status of the initialization, as given by the Status
89 //! function, can be one of the following:
90 //! - ChFi2d_Ready if the initialization is correct,
91 //! - ChFi2d_NotPlanar if F is not planar,
92 //! - ChFi2d_NoFace if F is a null face.
93 Standard_EXPORT void Init (const TopoDS_Face& F);
94
95 //! This initialize method allow to init the builder
96 //! from a face <RefFace> and another face <ModFace>
97 //! which derive from <RefFace>. This is usefull to
98 //! modify a fillet or a chamfer already created on
99 //! <ModFace> .
100 Standard_EXPORT void Init (const TopoDS_Face& RefFace, const TopoDS_Face& ModFace);
101
102 //! Adds a fillet of radius Radius between the two edges
103 //! adjacent to the vertex V on the face modified by this
104 //! algorithm. The two edges do not need to be rectilinear.
105 //! This function returns the fillet and builds the resulting face.
106 //! Warning
107 //! The status of the construction, as given by the Status
108 //! function, can be one of the following:
109 //! - ChFi2d_IsDone if the fillet is built,
110 //! - ChFi2d_ConnexionError if V does not belong to the initial face,
111 //! - ChFi2d_ComputationError if Radius is too large
112 //! to build a fillet between the two adjacent edges,
113 //! - ChFi2d_NotAuthorized
114 //! - if one of the two edges connected to V is a fillet or chamfer, or
115 //! - if a curve other than a straight line or an arc of a
116 //! circle is used as E, E1 or E2.
117 //! Do not use the returned fillet if the status of the construction is not ChFi2d_IsDone.
118 //! Exceptions
119 //! Standard_NegativeValue if Radius is less than or equal to zero.
120 Standard_EXPORT TopoDS_Edge AddFillet (const TopoDS_Vertex& V, const Standard_Real Radius);
121
122 //! Assigns the radius Radius to the fillet Fillet already
123 //! built on the face modified by this algorithm.
124 //! This function returns the new fillet and modifies the existing face.
125 //! Warning
126 //! The status of the construction, as given by the Status
127 //! function, can be one of the following:
128 //! - ChFi2d_IsDone if the new fillet is built,
129 //! - ChFi2d_ConnexionError if Fillet does not
130 //! belong to the existing face,
131 //! - ChFi2d_ComputationError if Radius is too
132 //! large to build a fillet between the two adjacent edges.
133 //! Do not use the returned fillet if the status of the
134 //! construction is not ChFi2d_IsDone.
135 //! Exceptions
136 //! Standard_NegativeValue if Radius is less than or equal to zero.
137 Standard_EXPORT TopoDS_Edge ModifyFillet (const TopoDS_Edge& Fillet, const Standard_Real Radius);
138
139 //! Removes the fillet Fillet already built on the face
140 //! modified by this algorithm.
141 //! This function returns the vertex connecting the two
142 //! adjacent edges of Fillet and modifies the existing face.
143 //! Warning
144 //! - The returned vertex is only valid if the Status
145 //! function returns ChFi2d_IsDone.
146 //! - A null vertex is returned if the edge Fillet does not
147 //! belong to the initial face.
148 Standard_EXPORT TopoDS_Vertex RemoveFillet (const TopoDS_Edge& Fillet);
149
150 //! Adds a chamfer on the face modified by this algorithm
151 //! between the two adjacent edges E1 and E2, where
152 //! the extremities of the chamfer are on E1 and E2 at
153 //! distances D1 and D2 respectively
154 //! In cases where the edges are not rectilinear, distances
155 //! are measured using the curvilinear abscissa of the
156 //! edges and the angle is measured with respect to the
157 //! tangent at the corresponding point.
158 //! The angle Ang is given in radians.
159 //! This function returns the chamfer and builds the resulting face.
160 Standard_EXPORT TopoDS_Edge AddChamfer (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2);
161
162 //! Adds a chamfer on the face modified by this algorithm
163 //! between the two edges connected by the vertex V,
164 //! where E is one of the two edges. The chamfer makes
165 //! an angle Ang with E and one of its extremities is on
166 //! E at distance D from V.
167 //! In cases where the edges are not rectilinear, distances
168 //! are measured using the curvilinear abscissa of the
169 //! edges and the angle is measured with respect to the
170 //! tangent at the corresponding point.
171 //! The angle Ang is given in radians.
172 //! This function returns the chamfer and builds the resulting face.
173 //! Warning
174 //! The status of the construction, as given by the Status function, can
175 //! be one of the following:
176 //! - ChFi2d_IsDone if the chamfer is built,
177 //! - ChFi2d_ParametersError if D1, D2, D or Ang is less than or equal to zero,
178 //! - ChFi2d_ConnexionError if:
179 //! - the edge E, E1 or E2 does not belong to the initial face, or
180 //! - the edges E1 and E2 are not adjacent, or
181 //! - the vertex V is not one of the limit points of the edge E,
182 //! - ChFi2d_ComputationError if the parameters of the chamfer
183 //! are too large to build a chamfer between the two adjacent edges,
184 //! - ChFi2d_NotAuthorized if:
185 //! - the edge E1, E2 or one of the two edges connected to V is a fillet or chamfer, or
186 //! - a curve other than a straight line or an arc of a circle is used as E, E1 or E2.
187 //! Do not use the returned chamfer if
188 //! the status of the construction is not ChFi2d_IsDone.
189 Standard_EXPORT TopoDS_Edge AddChamfer (const TopoDS_Edge& E, const TopoDS_Vertex& V, const Standard_Real D, const Standard_Real Ang);
190
191 //! Modifies the chamfer Chamfer on the face modified
192 //! by this algorithm, where:
193 //! E1 and E2 are the two adjacent edges on which
194 //! Chamfer is already built; the extremities of the new
195 //! chamfer are on E1 and E2 at distances D1 and D2 respectively.
196 Standard_EXPORT TopoDS_Edge ModifyChamfer (const TopoDS_Edge& Chamfer, const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2);
197
198 //! Modifies the chamfer Chamfer on the face modified
199 //! by this algorithm, where:
200 //! E is one of the two adjacent edges on which
201 //! Chamfer is already built; the new chamfer makes
202 //! an angle Ang with E and one of its extremities is
203 //! on E at distance D from the vertex on which the chamfer is built.
204 //! In cases where the edges are not rectilinear, the
205 //! distances are measured using the curvilinear abscissa
206 //! of the edges and the angle is measured with respect
207 //! to the tangent at the corresponding point.
208 //! The angle Ang is given in radians.
209 //! This function returns the new chamfer and modifies the existing face.
210 //! Warning
211 //! The status of the construction, as given by the Status
212 //! function, can be one of the following:
213 //! - ChFi2d_IsDone if the chamfer is built,
214 //! - ChFi2d_ParametersError if D1, D2, D or Ang is less than or equal to zero,
215 //! - ChFi2d_ConnexionError if:
216 //! - the edge E, E1, E2 or Chamfer does not belong
217 //! to the existing face, or
218 //! - the edges E1 and E2 are not adjacent,
219 //! - ChFi2d_ComputationError if the parameters of
220 //! the chamfer are too large to build a chamfer
221 //! between the two adjacent edges,
222 //! - ChFi2d_NotAuthorized if E1 or E2 is a fillet or chamfer.
223 //! Do not use the returned chamfer if the status of the
224 //! construction is not ChFi2d_IsDone.
225 Standard_EXPORT TopoDS_Edge ModifyChamfer (const TopoDS_Edge& Chamfer, const TopoDS_Edge& E, const Standard_Real D, const Standard_Real Ang);
226
227 //! Removes the chamfer Chamfer already built on the face
228 //! modified by this algorithm.
229 //! This function returns the vertex connecting the two
230 //! adjacent edges of Chamfer and modifies the existing face.
231 //! Warning
232 //! - The returned vertex is only valid if the Status
233 //! function returns ChFi2d_IsDone.
234 //! - A null vertex is returned if the edge Chamfer does
235 //! not belong to the initial face.
236 Standard_EXPORT TopoDS_Vertex RemoveChamfer (const TopoDS_Edge& Chamfer);
237
238 //! Returns true if the edge E on the face modified by this
239 //! algorithm is chamfered or filleted.
240 //! Warning
241 //! Returns false if E does not belong to the face modified by this algorithm.
242 Standard_Boolean IsModified (const TopoDS_Edge& E) const;
243
244 //! Returns the table of fillets on the face modified by this algorithm.
245 const TopTools_SequenceOfShape& FilletEdges() const;
246
247 //! Returns the number of fillets on the face modified by this algorithm.
248 Standard_Integer NbFillet() const;
249
250 //! Returns the table of chamfers on the face modified by this algorithm.
251 const TopTools_SequenceOfShape& ChamferEdges() const;
252
253 //! Returns the number of chamfers on the face modified by this algorithm.
254 Standard_Integer NbChamfer() const;
255
256 //! Returns the list of shapes modified from the shape
257 //! <S>.
258 Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& S) Standard_OVERRIDE;
259
260 //! returns the number of new curves
261 //! after the shape creation.
262 Standard_EXPORT Standard_Integer NbCurves() const;
263
264 //! Return the Edges created for curve I.
265 Standard_EXPORT const TopTools_ListOfShape& NewEdges (const Standard_Integer I);
266
267 Standard_Boolean HasDescendant (const TopoDS_Edge& E) const;
268
269 //! Returns the chamfered or filleted edge built from the
270 //! edge E on the face modified by this algorithm. If E has
271 //! not been modified, this function returns E.
272 //! Exceptions
273 //! Standard_NoSuchObject if the edge E does not
274 //! belong to the initial face.
275 const TopoDS_Edge& DescendantEdge (const TopoDS_Edge& E) const;
276
277 //! Returns the basis edge on the face modified by this
278 //! algorithm from which the chamfered or filleted edge E is
279 //! built. If E has not been modified, this function returns E.
280 //! Warning
281 //! E is returned if it does not belong to the initial face.
282 Standard_EXPORT const TopoDS_Edge& BasisEdge (const TopoDS_Edge& E) const;
283
284 ChFi2d_ConstructionError Status() const;
285
286 //! Update the result and set the Done flag
287 Standard_EXPORT virtual void Build() Standard_OVERRIDE;
288
289
290
291
292protected:
293
294
295
296
297
298private:
299
300
301
302 ChFi2d_Builder myMakeChFi2d;
303
304
305};
306
307
308#include <BRepFilletAPI_MakeFillet2d.lxx>
309
310
311
312
313
314#endif // _BRepFilletAPI_MakeFillet2d_HeaderFile