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