0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BRepBuilderAPI / BRepBuilderAPI_MakeFace.cxx
CommitLineData
b311480e 1// Created on: 1993-07-23
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//
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
7fd59977 17
42cf5bc1 18#include <BRepBuilderAPI_MakeFace.hxx>
19#include <Geom_Surface.hxx>
20#include <gp_Cone.hxx>
21#include <gp_Cylinder.hxx>
22#include <gp_Pln.hxx>
23#include <gp_Sphere.hxx>
24#include <gp_Torus.hxx>
25#include <StdFail_NotDone.hxx>
26#include <TopoDS_Face.hxx>
27#include <TopoDS_Wire.hxx>
7fd59977 28
29//=======================================================================
30//function : BRepBuilderAPI_MakeFace
31//purpose :
32//=======================================================================
7fd59977 33BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace()
34{
35}
36
37
38//=======================================================================
39//function : BRepBuilderAPI_MakeFace
40//purpose :
41//=======================================================================
42
43BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const TopoDS_Face& F)
44: myMakeFace(F)
45{
46 if ( myMakeFace.IsDone()) {
47 Done();
48 myShape = myMakeFace.Shape();
49 }
50}
51
52
53//=======================================================================
54//function : BRepBuilderAPI_MakeFace
55//purpose :
56//=======================================================================
57
58BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Pln& P)
59: myMakeFace(P)
60{
61 if ( myMakeFace.IsDone()) {
62 Done();
63 myShape = myMakeFace.Shape();
64 }
65}
66
67
68//=======================================================================
69//function : BRepBuilderAPI_MakeFace
70//purpose :
71//=======================================================================
72
73BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Cylinder& C)
74: myMakeFace(C)
75{
76 if ( myMakeFace.IsDone()) {
77 Done();
78 myShape = myMakeFace.Shape();
79 }
80}
81
82
83//=======================================================================
84//function : BRepBuilderAPI_MakeFace
85//purpose :
86//=======================================================================
87
88BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Cone& C)
89: myMakeFace(C)
90{
91 if ( myMakeFace.IsDone()) {
92 Done();
93 myShape = myMakeFace.Shape();
94 }
95}
96
97
98//=======================================================================
99//function : BRepBuilderAPI_MakeFace
100//purpose :
101//=======================================================================
102
103BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Sphere& S)
104: myMakeFace(S)
105{
106 if ( myMakeFace.IsDone()) {
107 Done();
108 myShape = myMakeFace.Shape();
109 }
110}
111
112
113//=======================================================================
114//function : BRepBuilderAPI_MakeFace
115//purpose :
116//=======================================================================
117
118BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Torus& T)
119: myMakeFace(T)
120{
121 if ( myMakeFace.IsDone()) {
122 Done();
123 myShape = myMakeFace.Shape();
124 }
125}
126
127
128//=======================================================================
129//function : BRepBuilderAPI_MakeFace
130//purpose :
131//=======================================================================
132
1c72dff6
S
133BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S,
134 const Standard_Real TolDegen)
135: myMakeFace(S, TolDegen)
7fd59977 136{
137 if ( myMakeFace.IsDone()) {
138 Done();
139 myShape = myMakeFace.Shape();
140 }
141}
142
143
144//=======================================================================
145//function : BRepBuilderAPI_MakeFace
146//purpose :
147//=======================================================================
148
149BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Pln& P,
150 const Standard_Real UMin,
151 const Standard_Real UMax,
152 const Standard_Real VMin,
153 const Standard_Real VMax)
154: myMakeFace(P,UMin,UMax,VMin,VMax)
155{
156 if ( myMakeFace.IsDone()) {
157 Done();
158 myShape = myMakeFace.Shape();
159 }
160}
161
162
163//=======================================================================
164//function : BRepBuilderAPI_MakeFace
165//purpose :
166//=======================================================================
167
168BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Cylinder& C,
169 const Standard_Real UMin,
170 const Standard_Real UMax,
171 const Standard_Real VMin,
172 const Standard_Real VMax)
173: myMakeFace(C,UMin,UMax,VMin,VMax)
174{
175 if ( myMakeFace.IsDone()) {
176 Done();
177 myShape = myMakeFace.Shape();
178 }
179}
180
181
182//=======================================================================
183//function : BRepBuilderAPI_MakeFace
184//purpose :
185//=======================================================================
186
187BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Cone& C,
188 const Standard_Real UMin,
189 const Standard_Real UMax,
190 const Standard_Real VMin,
191 const Standard_Real VMax)
192: myMakeFace(C,UMin,UMax,VMin,VMax)
193{
194 if ( myMakeFace.IsDone()) {
195 Done();
196 myShape = myMakeFace.Shape();
197 }
198}
199
200
201//=======================================================================
202//function : BRepBuilderAPI_MakeFace
203//purpose :
204//=======================================================================
205
206BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Sphere& S,
207 const Standard_Real UMin,
208 const Standard_Real UMax,
209 const Standard_Real VMin,
210 const Standard_Real VMax)
211: myMakeFace(S,UMin,UMax,VMin,VMax)
212{
213 if ( myMakeFace.IsDone()) {
214 Done();
215 myShape = myMakeFace.Shape();
216 }
217}
218
219
220//=======================================================================
221//function : BRepBuilderAPI_MakeFace
222//purpose :
223//=======================================================================
224
225BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Torus& T,
226 const Standard_Real UMin,
227 const Standard_Real UMax,
228 const Standard_Real VMin,
229 const Standard_Real VMax)
230: myMakeFace(T,UMin,UMax,VMin,VMax)
231{
232 if ( myMakeFace.IsDone()) {
233 Done();
234 myShape = myMakeFace.Shape();
235 }
236}
237
238
239//=======================================================================
240//function : BRepBuilderAPI_MakeFace
241//purpose :
242//=======================================================================
243
1c72dff6
S
244BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace (const Handle(Geom_Surface)& S,
245 const Standard_Real UMin,
246 const Standard_Real UMax,
247 const Standard_Real VMin,
248 const Standard_Real VMax,
249 const Standard_Real TolDegen)
250: myMakeFace (S, UMin, UMax, VMin, VMax, TolDegen)
7fd59977 251{
252 if ( myMakeFace.IsDone()) {
253 Done();
254 myShape = myMakeFace.Shape();
255 }
256}
257
258
259//=======================================================================
260//function : BRepBuilderAPI_MakeFace
261//purpose :
262//=======================================================================
263
264BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const TopoDS_Wire& W,
265 const Standard_Boolean OnlyPlane)
266: myMakeFace(W,OnlyPlane)
267{
268 if ( myMakeFace.IsDone()) {
269 Done();
270 myShape = myMakeFace.Shape();
271 }
272}
273
274
275//=======================================================================
276//function : BRepBuilderAPI_MakeFace
277//purpose :
278//=======================================================================
279
280BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Pln& P,
281 const TopoDS_Wire& W,
282 const Standard_Boolean Inside)
283: myMakeFace(P,W,Inside)
284{
285 if ( myMakeFace.IsDone()) {
286 Done();
287 myShape = myMakeFace.Shape();
288 }
289}
290
291
292//=======================================================================
293//function : BRepBuilderAPI_MakeFace
294//purpose :
295//=======================================================================
296
297BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Cylinder& C,
298 const TopoDS_Wire& W,
299 const Standard_Boolean Inside)
300: myMakeFace(C,W,Inside)
301{
302 if ( myMakeFace.IsDone()) {
303 Done();
304 myShape = myMakeFace.Shape();
305 }
306}
307
308
309//=======================================================================
310//function : BRepBuilderAPI_MakeFace
311//purpose :
312//=======================================================================
313
314BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Cone& C,
315 const TopoDS_Wire& W,
316 const Standard_Boolean Inside)
317: myMakeFace(C,W,Inside)
318{
319 if ( myMakeFace.IsDone()) {
320 Done();
321 myShape = myMakeFace.Shape();
322 }
323}
324
325
326//=======================================================================
327//function : BRepBuilderAPI_MakeFace
328//purpose :
329//=======================================================================
330
331BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Sphere& S,
332 const TopoDS_Wire& W,
333 const Standard_Boolean Inside)
334: myMakeFace(S,W,Inside)
335{
336 if ( myMakeFace.IsDone()) {
337 Done();
338 myShape = myMakeFace.Shape();
339 }
340}
341
342
343//=======================================================================
344//function : BRepBuilderAPI_MakeFace
345//purpose :
346//=======================================================================
347
348BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Torus& T,
349 const TopoDS_Wire& W,
350 const Standard_Boolean Inside)
351: myMakeFace(T,W,Inside)
352{
353 if ( myMakeFace.IsDone()) {
354 Done();
355 myShape = myMakeFace.Shape();
356 }
357}
358
359
360//=======================================================================
361//function : BRepBuilderAPI_MakeFace
362//purpose :
363//=======================================================================
364
365BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S,
366 const TopoDS_Wire& W,
367 const Standard_Boolean Inside)
368: myMakeFace(S,W,Inside)
369{
370 if ( myMakeFace.IsDone()) {
371 Done();
372 myShape = myMakeFace.Shape();
373 }
374}
375
376
377//=======================================================================
378//function : BRepBuilderAPI_MakeFace
379//purpose :
380//=======================================================================
381
382BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const TopoDS_Face& F,
383 const TopoDS_Wire& W)
384: myMakeFace(F,W)
385{
386 if ( myMakeFace.IsDone()) {
387 Done();
388 myShape = myMakeFace.Shape();
389 }
390}
391
392//=======================================================================
393//function : Init
394//purpose :
395//=======================================================================
396
397void BRepBuilderAPI_MakeFace::Init(const TopoDS_Face& F)
398{
399 myMakeFace.Init(F);
400 if ( myMakeFace.IsDone()) {
401 Done();
402 myShape = myMakeFace.Shape();
403 }
404}
405
406//=======================================================================
407//function : Init
408//purpose :
409//=======================================================================
410
411void BRepBuilderAPI_MakeFace::Init(const Handle(Geom_Surface)& S,
1c72dff6
S
412 const Standard_Boolean Bound,
413 const Standard_Real TolDegen)
7fd59977 414{
1c72dff6 415 myMakeFace.Init(S, Bound, TolDegen);
7fd59977 416 if ( myMakeFace.IsDone()) {
417 Done();
418 myShape = myMakeFace.Shape();
419 }
420}
421
422
423//=======================================================================
424//function : Init
425//purpose :
426//=======================================================================
427
1c72dff6
S
428void BRepBuilderAPI_MakeFace::Init (const Handle(Geom_Surface)& SS,
429 const Standard_Real Um,
430 const Standard_Real UM,
431 const Standard_Real Vm,
432 const Standard_Real VM,
433 const Standard_Real TolDegen)
7fd59977 434{
1c72dff6 435 myMakeFace.Init (SS, Um, UM, Vm, VM, TolDegen);
7fd59977 436 if ( myMakeFace.IsDone()) {
437 Done();
438 myShape = myMakeFace.Shape();
439 }
440}
441
442
443//=======================================================================
444//function : Add
445//purpose :
446//=======================================================================
447
448void BRepBuilderAPI_MakeFace::Add(const TopoDS_Wire& W)
449{
450 myMakeFace.Add(W);
451 if ( myMakeFace.IsDone()) {
452 Done();
453 myShape = myMakeFace.Shape();
454 }
455}
456
457
458//=======================================================================
459//function : Face
460//purpose :
461//=======================================================================
462
463const TopoDS_Face& BRepBuilderAPI_MakeFace::Face()const
464{
465 return myMakeFace.Face();
466}
467
468
469
470//=======================================================================
471//function : operator
472//purpose :
473//=======================================================================
474
475BRepBuilderAPI_MakeFace::operator TopoDS_Face() const
476{
477 return Face();
478}
479
480//=======================================================================
481//function : IsDone
482//purpose :
483//=======================================================================
484
485Standard_Boolean BRepBuilderAPI_MakeFace::IsDone() const
486{
487 return myMakeFace.IsDone();
488}
489
490
491//=======================================================================
492//function : Error
493//purpose :
494//=======================================================================
495
496BRepBuilderAPI_FaceError BRepBuilderAPI_MakeFace::Error() const
497{
498 switch ( myMakeFace.Error()) {
499
500 case BRepLib_FaceDone:
501 return BRepBuilderAPI_FaceDone;
502
503 case BRepLib_NoFace:
504 return BRepBuilderAPI_NoFace;
505
506 case BRepLib_NotPlanar:
507 return BRepBuilderAPI_NotPlanar;
508
509 case BRepLib_CurveProjectionFailed:
510 return BRepBuilderAPI_CurveProjectionFailed;
511
512 case BRepLib_ParametersOutOfRange:
513 return BRepBuilderAPI_ParametersOutOfRange;
514
515 }
516
517 // Portage WNT
518 return BRepBuilderAPI_FaceDone;
519}