Salome HOME
Dump Python extension
[modules/geom.git] / src / GEOM_I / GEOM_I3DPrimOperations_i.cc
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 #include <Standard_Stream.hxx>
21
22 #include "GEOM_I3DPrimOperations_i.hh"
23
24 #include "utilities.h"
25 #include "OpUtil.hxx"
26 #include "Utils_ExceptHandlers.hxx"
27
28 #include "GEOM_Engine.hxx"
29 #include "GEOM_Object.hxx"
30
31 //=============================================================================
32 /*!
33  *   constructor:
34  */
35 //=============================================================================
36 GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_I3DPrimOperations* theImpl)
37 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
38 {
39   MESSAGE("GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i");
40 }
41
42 //=============================================================================
43 /*!
44  *  destructor
45  */
46 //=============================================================================
47 GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i()
48 {
49   MESSAGE("GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i");
50 }
51
52
53 //=============================================================================
54 /*!
55  *  MakeBoxDXDYDZ
56  */
57 //=============================================================================
58 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double theDX,
59                                                                CORBA::Double theDY,
60                                                                CORBA::Double theDZ)
61 {
62   GEOM::GEOM_Object_var aGEOMObject;
63
64   //Set a not done flag
65   GetOperations()->SetNotDone();
66    
67   //Create the Box
68   Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ);
69   if (!GetOperations()->IsDone() || anObject.IsNull())
70     return aGEOMObject._retn();
71   GetObject(anObject)->SetParameters(GetParameters());
72     
73   return GetObject(anObject);
74 }
75
76 //=============================================================================
77 /*!
78  *  MakeBoxTwoPnt
79  */
80 //=============================================================================
81 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
82                       (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
83 {
84   GEOM::GEOM_Object_var aGEOMObject;
85
86   //Set a not done flag
87   GetOperations()->SetNotDone();
88
89   if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn();
90
91   //Get the reference points
92   Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
93     (thePnt1->GetStudyID(), thePnt1->GetEntry());
94   Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
95     (thePnt2->GetStudyID(), thePnt2->GetEntry());
96
97   if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
98
99   //Create the Box
100   Handle(GEOM_Object) anObject = GetOperations()->MakeBoxTwoPnt(aPnt1, aPnt2);
101   if (!GetOperations()->IsDone() || anObject.IsNull())
102     return aGEOMObject._retn();
103
104   return GetObject(anObject);
105 }
106
107 //=============================================================================
108 /*!
109  *  MakeFaceHW
110  */
111 //=============================================================================
112 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH,
113                                                             CORBA::Double theW,
114                                                             CORBA::Short  theOrientation)
115 {
116   GEOM::GEOM_Object_var aGEOMObject;
117
118   //Set a not done flag
119   GetOperations()->SetNotDone();
120
121   if (theH == 0 || theW == 0)
122     return aGEOMObject._retn();
123
124   //Create the Face
125   Handle(GEOM_Object) anObject = GetOperations()->MakeFaceHW(theH, theW, theOrientation);
126   if (!GetOperations()->IsDone() || anObject.IsNull())
127     return aGEOMObject._retn();
128
129   return GetObject(anObject);
130 }
131
132 //=============================================================================
133 /*!
134  *  MakeFaceObjHW
135  */
136 //=============================================================================
137 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW
138                                                (GEOM::GEOM_Object_ptr theObj,
139                                                 CORBA::Double theH,
140                                                 CORBA::Double theW)
141 {
142   GEOM::GEOM_Object_var aGEOMObject;
143
144   //Set a not done flag
145   GetOperations()->SetNotDone();
146
147   if (theObj == NULL || theH == 0 || theW == 0)
148     return aGEOMObject._retn();
149
150   //Get the reference points
151   Handle(GEOM_Object) anObj = GetOperations()->GetEngine()->GetObject
152     (theObj->GetStudyID(), theObj->GetEntry());
153
154   if (anObj.IsNull())
155     return aGEOMObject._retn();
156
157   //Create the Face
158   Handle(GEOM_Object) anObject = GetOperations()->MakeFaceObjHW(anObj, theH, theW);
159   if (!GetOperations()->IsDone() || anObject.IsNull())
160     return aGEOMObject._retn();
161
162   return GetObject(anObject);
163 }
164
165 //=============================================================================
166 /*!
167  *  MakeDiskPntVecR
168  */
169 //=============================================================================
170 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR
171                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
172                        CORBA::Double theR)
173 {
174   GEOM::GEOM_Object_var aGEOMObject;
175
176   //Set a not done flag
177   GetOperations()->SetNotDone();
178
179   if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
180
181   //Get the reference points
182   Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
183     (thePnt->GetStudyID(), thePnt->GetEntry());
184   Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
185     (theVec->GetStudyID(), theVec->GetEntry());
186
187   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
188
189   // Make Disk
190   Handle(GEOM_Object) anObject =
191     GetOperations()->MakeDiskPntVecR(aPnt, aVec, theR);
192   if (!GetOperations()->IsDone() || anObject.IsNull())
193     return aGEOMObject._retn();
194
195   return GetObject(anObject);
196 }
197
198 //=============================================================================
199 /*!
200  *  MakeDiskThreePnt
201  */
202 //=============================================================================
203 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt
204                       (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
205                        GEOM::GEOM_Object_ptr thePnt3)
206 {
207   GEOM::GEOM_Object_var aGEOMObject;
208
209   //Set a not done flag
210   GetOperations()->SetNotDone();
211
212   if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn();
213
214   //Get the reference points
215   Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
216     (thePnt1->GetStudyID(), thePnt1->GetEntry());
217   Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
218     (thePnt2->GetStudyID(), thePnt2->GetEntry());
219   Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject
220     (thePnt3->GetStudyID(), thePnt3->GetEntry());
221
222   if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn();
223
224   // Make Disk
225   Handle(GEOM_Object) anObject =
226       GetOperations()->MakeDiskThreePnt(aPnt1, aPnt2, aPnt3);
227   if (!GetOperations()->IsDone() || anObject.IsNull())
228     return aGEOMObject._retn();
229
230   return GetObject(anObject);
231 }
232
233 //=============================================================================
234 /*!
235  *  MakeDiskR
236  */
237 //=============================================================================
238 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
239                                                            CORBA::Short  theOrientation)
240 {
241   GEOM::GEOM_Object_var aGEOMObject;
242
243   //Set a not done flag
244   GetOperations()->SetNotDone();
245
246   if (theR == 0)
247     return aGEOMObject._retn();
248
249   //Create the Face
250   Handle(GEOM_Object) anObject = GetOperations()->MakeDiskR(theR, theOrientation);
251   if (!GetOperations()->IsDone() || anObject.IsNull())
252     return aGEOMObject._retn();
253
254   return GetObject(anObject);
255 }
256
257 //=============================================================================
258 /*!
259  *  MakeCylinderRH
260  */
261 //=============================================================================
262 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
263                                                                 CORBA::Double theH)
264 {
265   GEOM::GEOM_Object_var aGEOMObject;
266
267   //Set a not done flag
268   GetOperations()->SetNotDone();
269
270   //Create the Cylinder
271   Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
272   if (!GetOperations()->IsDone() || anObject.IsNull())
273     return aGEOMObject._retn();
274
275   return GetObject(anObject);
276 }
277
278 //=============================================================================
279 /*!
280  *  MakeCylinderPntVecRH
281  */
282 //=============================================================================
283 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
284                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
285                        CORBA::Double theR, CORBA::Double theH)
286 {
287   GEOM::GEOM_Object_var aGEOMObject;
288
289   //Set a not done flag
290   GetOperations()->SetNotDone();
291
292   if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
293
294   //Get the reference points
295   Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
296     (thePnt->GetStudyID(), thePnt->GetEntry());
297   Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
298     (theVec->GetStudyID(), theVec->GetEntry());
299
300   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
301
302   //Create the Cylinder
303   Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
304   if (!GetOperations()->IsDone() || anObject.IsNull())
305     return aGEOMObject._retn();
306
307   return GetObject(anObject);
308 }
309
310 //=============================================================================
311 /*!
312  *  MakeConeR1R2H
313  */
314 //=============================================================================
315 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
316                                                                CORBA::Double theR2,
317                                                                CORBA::Double theH)
318 {
319   GEOM::GEOM_Object_var aGEOMObject;
320
321   //Set a not done flag
322   GetOperations()->SetNotDone();
323
324   //Create the Cone
325   Handle(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH);
326   if (!GetOperations()->IsDone() || anObject.IsNull())
327     return aGEOMObject._retn();
328
329   return GetObject(anObject);
330 }
331
332 //=============================================================================
333 /*!
334  *  MakeConePntVecR1R2H
335  */
336 //=============================================================================
337 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
338                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
339                        CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
340 {
341   GEOM::GEOM_Object_var aGEOMObject;
342
343   //Set a not done flag
344   GetOperations()->SetNotDone();
345
346   if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
347
348   //Get the reference points
349   Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
350     (thePnt->GetStudyID(), thePnt->GetEntry());
351   Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
352     (theVec->GetStudyID(), theVec->GetEntry());
353
354   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
355
356   //Create the Cone
357   Handle(GEOM_Object) anObject =
358       GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH);
359   if (!GetOperations()->IsDone() || anObject.IsNull())
360     return aGEOMObject._retn();
361
362   return GetObject(anObject);
363 }
364
365 //=============================================================================
366 /*!
367  *  MakeSphereR
368  */
369 //=============================================================================
370 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
371 {
372   GEOM::GEOM_Object_var aGEOMObject;
373
374   //Set a not done flag
375   GetOperations()->SetNotDone();
376
377   //Create the Cone
378   Handle(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR);
379   if (!GetOperations()->IsDone() || anObject.IsNull())
380     return aGEOMObject._retn();
381
382   return GetObject(anObject);
383 }
384
385 //=============================================================================
386 /*!
387  *  MakeSpherePntR
388  */
389 //=============================================================================
390 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
391                       (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR)
392 {
393   GEOM::GEOM_Object_var aGEOMObject;
394
395   //Set a not done flag
396   GetOperations()->SetNotDone();
397
398   if (thePnt == NULL) return aGEOMObject._retn();
399
400   //Get the reference point
401   CORBA::String_var entry=thePnt->GetEntry();
402   Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
403     (thePnt->GetStudyID(), entry);
404
405   if (aPnt.IsNull()) return aGEOMObject._retn();
406
407   //Create the Sphere
408   Handle(GEOM_Object) anObject =
409       GetOperations()->MakeSpherePntR(aPnt, theR);
410   if (!GetOperations()->IsDone() || anObject.IsNull())
411     return aGEOMObject._retn();
412
413   return GetObject(anObject);
414 }
415
416 //=============================================================================
417 /*!
418  *  MakeTorusRR
419  */
420 //=============================================================================
421 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
422                       (CORBA::Double theRMajor, CORBA::Double theRMinor)
423 {
424   GEOM::GEOM_Object_var aGEOMObject;
425
426   //Set a not done flag
427   GetOperations()->SetNotDone();
428
429   // Make Torus
430   Handle(GEOM_Object) anObject =
431     GetOperations()->MakeTorusRR(theRMajor, theRMinor);
432   if (!GetOperations()->IsDone() || anObject.IsNull())
433     return aGEOMObject._retn();
434
435   return GetObject(anObject);
436 }
437
438 //=============================================================================
439 /*!
440  *  MakeTorusPntVecRR
441  */
442 //=============================================================================
443 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
444                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
445                        CORBA::Double theRMajor, CORBA::Double theRMinor)
446 {
447   GEOM::GEOM_Object_var aGEOMObject;
448
449   //Set a not done flag
450   GetOperations()->SetNotDone();
451
452   if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
453
454   //Get the reference points
455   Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
456     (thePnt->GetStudyID(), thePnt->GetEntry());
457   Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
458     (theVec->GetStudyID(), theVec->GetEntry());
459
460   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
461
462   // Make Torus
463   Handle(GEOM_Object) anObject =
464     GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
465   if (!GetOperations()->IsDone() || anObject.IsNull())
466     return aGEOMObject._retn();
467
468   return GetObject(anObject);
469 }
470
471 //=============================================================================
472 /*!
473  *  MakePrismVecH
474  */
475 //=============================================================================
476 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
477                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
478                        CORBA::Double theH)
479 {
480   GEOM::GEOM_Object_var aGEOMObject;
481
482   //Set a not done flag
483   GetOperations()->SetNotDone();
484
485   if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
486
487   //Get the reference objects
488   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
489     (theBase->GetStudyID(), theBase->GetEntry());
490   Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
491     (theVec->GetStudyID(), theVec->GetEntry());
492
493   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
494
495   //Create the Prism
496   Handle(GEOM_Object) anObject =
497       GetOperations()->MakePrismVecH(aBase, aVec, theH);
498   if (!GetOperations()->IsDone() || anObject.IsNull())
499     return aGEOMObject._retn();
500
501   return GetObject(anObject);
502 }
503
504 //=============================================================================
505 /*!
506  *  MakePrismVecH2Ways
507  */
508 //=============================================================================
509 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
510                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
511                        CORBA::Double theH)
512 {
513   GEOM::GEOM_Object_var aGEOMObject;
514
515   //Set a not done flag
516   GetOperations()->SetNotDone();
517
518   if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
519
520   //Get the reference objects
521   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
522     (theBase->GetStudyID(), theBase->GetEntry());
523   Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
524     (theVec->GetStudyID(), theVec->GetEntry());
525
526   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
527
528   //Create the Prism
529   Handle(GEOM_Object) anObject =
530       GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
531   if (!GetOperations()->IsDone() || anObject.IsNull())
532     return aGEOMObject._retn();
533
534   return GetObject(anObject);
535 }
536
537 //=============================================================================
538 /*!
539  *  MakePrismTwoPnt
540  */
541 //=============================================================================
542 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
543                                              (GEOM::GEOM_Object_ptr theBase,
544                                               GEOM::GEOM_Object_ptr thePoint1,
545                                               GEOM::GEOM_Object_ptr thePoint2)
546 {
547   GEOM::GEOM_Object_var aGEOMObject;
548
549   //Set a not done flag
550   GetOperations()->SetNotDone();
551
552   if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
553     return aGEOMObject._retn();
554
555   //Get the reference objects
556   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
557     (theBase->GetStudyID(), theBase->GetEntry());
558   Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
559     (thePoint1->GetStudyID(), thePoint1->GetEntry());
560   Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
561     (thePoint2->GetStudyID(), thePoint2->GetEntry());
562
563   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
564     return aGEOMObject._retn();
565
566   //Create the Prism
567   Handle(GEOM_Object) anObject =
568     GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
569   if (!GetOperations()->IsDone() || anObject.IsNull())
570     return aGEOMObject._retn();
571
572   return GetObject(anObject);
573 }
574
575 //=============================================================================
576 /*!
577  *  MakePrismTwoPnt2Ways
578  */
579 //=============================================================================
580 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
581                                              (GEOM::GEOM_Object_ptr theBase,
582                                               GEOM::GEOM_Object_ptr thePoint1,
583                                               GEOM::GEOM_Object_ptr thePoint2)
584 {
585   GEOM::GEOM_Object_var aGEOMObject;
586
587   //Set a not done flag
588   GetOperations()->SetNotDone();
589
590   if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
591     return aGEOMObject._retn();
592
593   //Get the reference objects
594   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
595     (theBase->GetStudyID(), theBase->GetEntry());
596   Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
597     (thePoint1->GetStudyID(), thePoint1->GetEntry());
598   Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
599     (thePoint2->GetStudyID(), thePoint2->GetEntry());
600
601   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
602     return aGEOMObject._retn();
603
604   //Create the Prism
605   Handle(GEOM_Object) anObject =
606     GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
607   if (!GetOperations()->IsDone() || anObject.IsNull())
608     return aGEOMObject._retn();
609
610   return GetObject(anObject);
611 }
612
613 //=============================================================================
614 /*!
615  *  MakePrismDXDYDZ
616  */
617 //=============================================================================
618 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
619                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
620                        CORBA::Double theDY, CORBA::Double theDZ)
621 {
622   GEOM::GEOM_Object_var aGEOMObject;
623
624   //Set a not done flag
625   GetOperations()->SetNotDone();
626
627   if (theBase == NULL) return aGEOMObject._retn();
628
629   //Get the reference objects
630   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
631     (theBase->GetStudyID(), theBase->GetEntry());
632
633   if (aBase.IsNull()) return aGEOMObject._retn();
634
635   //Create the Prism
636   Handle(GEOM_Object) anObject =
637       GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ);
638   if (!GetOperations()->IsDone() || anObject.IsNull())
639     return aGEOMObject._retn();
640
641   return GetObject(anObject);
642 }
643
644 //=============================================================================
645 /*!
646  *  MakePrismDXDYDZ2Ways
647  */
648 //=============================================================================
649 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways
650                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
651                        CORBA::Double theDY, CORBA::Double theDZ)
652 {
653   GEOM::GEOM_Object_var aGEOMObject;
654
655   //Set a not done flag
656   GetOperations()->SetNotDone();
657
658   if (theBase == NULL) return aGEOMObject._retn();
659
660   //Get the reference objects
661   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
662     (theBase->GetStudyID(), theBase->GetEntry());
663
664   if (aBase.IsNull()) return aGEOMObject._retn();
665
666   //Create the Prism
667   Handle(GEOM_Object) anObject =
668       GetOperations()->MakePrismDXDYDZ2Ways(aBase, theDX, theDY, theDZ);
669   if (!GetOperations()->IsDone() || anObject.IsNull())
670     return aGEOMObject._retn();
671
672   return GetObject(anObject);
673 }
674
675 //=============================================================================
676 /*!
677  *  MakePipe
678  */
679 //=============================================================================
680 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
681                  (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
682 {
683   GEOM::GEOM_Object_var aGEOMObject;
684
685   //Set a not done flag
686   GetOperations()->SetNotDone();
687
688   if (theBase == NULL || thePath == NULL) return aGEOMObject._retn();
689
690   //Get the reference objects
691   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
692     (theBase->GetStudyID(), theBase->GetEntry());
693   Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
694     (thePath->GetStudyID(), thePath->GetEntry());
695
696   if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
697
698   //Create the Pipe
699   Handle(GEOM_Object) anObject =
700     GetOperations()->MakePipe(aBase, aPath);
701   if (!GetOperations()->IsDone() || anObject.IsNull())
702     return aGEOMObject._retn();
703
704   return GetObject(anObject);
705 }
706
707 //=============================================================================
708 /*!
709  *  MakeRevolutionAxisAngle
710  */
711 //=============================================================================
712 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
713                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
714                        CORBA::Double theAngle)
715 {
716   GEOM::GEOM_Object_var aGEOMObject;
717
718   //Set a not done flag
719   GetOperations()->SetNotDone();
720
721   if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
722
723   //Get the reference objects
724   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
725     (theBase->GetStudyID(), theBase->GetEntry());
726   Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
727     (theAxis->GetStudyID(), theAxis->GetEntry());
728
729   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
730
731   //Create the Revolution
732   Handle(GEOM_Object) anObject =
733       GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
734   if (!GetOperations()->IsDone() || anObject.IsNull())
735     return aGEOMObject._retn();
736
737   return GetObject(anObject);
738 }
739
740 //=============================================================================
741 /*!
742  *  MakeRevolutionAxisAngle2Ways
743  */
744 //=============================================================================
745 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
746                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
747                        CORBA::Double theAngle)
748 {
749   GEOM::GEOM_Object_var aGEOMObject;
750
751   //Set a not done flag
752   GetOperations()->SetNotDone();
753
754   if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
755
756   //Get the reference objects
757   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
758     (theBase->GetStudyID(), theBase->GetEntry());
759   Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
760     (theAxis->GetStudyID(), theAxis->GetEntry());
761
762   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
763
764   //Create the Revolution
765   Handle(GEOM_Object) anObject =
766       GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
767   if (!GetOperations()->IsDone() || anObject.IsNull())
768     return aGEOMObject._retn();
769
770   return GetObject(anObject);
771 }
772
773 //=============================================================================
774 /*!
775  *  MakeFilling
776  */
777 //=============================================================================
778 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
779                                                             CORBA::Long theMinDeg,
780                                                             CORBA::Long theMaxDeg,
781                                                             CORBA::Double theTol2D,
782                                                             CORBA::Double theTol3D,
783                                                             CORBA::Long theNbIter,
784                                                             CORBA::Boolean theApprox)
785 {
786   GEOM::GEOM_Object_var aGEOMObject;
787
788   //Set a not done flag
789   GetOperations()->SetNotDone();
790
791   if (theShape == NULL) return aGEOMObject._retn();
792
793   //Get the reference objects
794   Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
795     (theShape->GetStudyID(), theShape->GetEntry());
796
797   if (aShape.IsNull()) return aGEOMObject._retn();
798
799   //Create the Solid
800   Handle(GEOM_Object) anObject = GetOperations()->MakeFilling(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, theApprox);
801   if (!GetOperations()->IsDone() || anObject.IsNull())
802     return aGEOMObject._retn();
803
804   return GetObject(anObject);
805 }
806
807 //=============================================================================
808 /*!
809  *  MakeThruSections
810  */
811 //=============================================================================
812 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
813                                                                  CORBA::Boolean theModeSolid,
814                                                                  CORBA::Double thePreci,
815                                                                  CORBA::Boolean theRuled)
816 {
817    GEOM::GEOM_Object_var aGEOMObject;
818
819   //Set a not done flag
820   GetOperations()->SetNotDone();
821   Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
822   int ind, aLen;
823
824   //Get the shapes
825   aLen = theSeqSections.length();
826   for (ind = 0; ind < aLen; ind++) {
827     if (theSeqSections[ind] == NULL) continue;
828     Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
829       (theSeqSections[ind]->GetStudyID(), theSeqSections[ind]->GetEntry());
830     if (!aSh.IsNull())
831       aSeqSections->Append(aSh);
832   }
833   if(!aSeqSections->Length())
834     return aGEOMObject._retn();
835
836   // Make shell or solid
837   Handle(GEOM_Object) anObject =
838     GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
839   if (!GetOperations()->IsDone() || anObject.IsNull())
840     return aGEOMObject._retn();
841
842   return GetObject(anObject);
843 }
844
845 //=============================================================================
846 /*!
847  *  MakePipeWithDifferentSections
848  */
849 //=============================================================================
850 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
851                                                                               const GEOM::ListOfGO& theLocations,
852                                                                               GEOM::GEOM_Object_ptr thePath,
853                                                                               CORBA::Boolean theWithContact,
854                                                                               CORBA::Boolean theWithCorrections)
855 {
856    GEOM::GEOM_Object_var aGEOMObject;
857
858   //Set a not done flag
859   GetOperations()->SetNotDone();
860   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
861   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
862   int ind=0, aNbBases =0,aNbLocs=0;
863   
864   //Get the shapes
865   aNbBases = theBases.length();
866   aNbLocs = theLocations.length();
867
868   if( aNbLocs &&  aNbBases != aNbLocs)
869     return aGEOMObject._retn();
870   
871    Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
872       (thePath->GetStudyID(), thePath->GetEntry());
873    if(aPath.IsNull())
874      return aGEOMObject._retn();
875
876   for (ind = 0; ind < aNbBases; ind++) {
877     if (theBases[ind] == NULL) continue;
878     Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject(theBases[ind]->GetStudyID(), 
879                         theBases[ind]->GetEntry());
880     if(aBase.IsNull())
881       continue;
882     if(aNbLocs)
883     {
884       Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
885         (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
886       if(aLoc.IsNull())
887         continue;
888       aSeqLocations->Append(aLoc);
889     }
890     aSeqBases->Append(aBase);
891   }
892   if(!aSeqBases->Length())
893     return aGEOMObject._retn();
894
895   // Make pipe
896   Handle(GEOM_Object) anObject =
897     GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
898                                                    theWithContact,theWithCorrections);
899   if (!GetOperations()->IsDone() || anObject.IsNull())
900     return aGEOMObject._retn();
901
902   return GetObject(anObject);
903 }
904
905
906 //=============================================================================
907 /*!
908  *  MakePipeWithShellSections
909  */
910 //=============================================================================
911 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
912                  (const GEOM::ListOfGO& theBases,
913                   const GEOM::ListOfGO& theSubBases,
914                   const GEOM::ListOfGO& theLocations,
915                   GEOM::GEOM_Object_ptr thePath,
916                   CORBA::Boolean theWithContact,
917                   CORBA::Boolean theWithCorrections)
918 {
919   GEOM::GEOM_Object_var aGEOMObject;
920
921   //Set a not done flag
922   GetOperations()->SetNotDone();
923   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
924   Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
925   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
926   int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
927   
928   //Get the shapes
929   aNbBases = theBases.length();
930   aNbSubBases = theSubBases.length();
931   aNbLocs = theLocations.length();
932
933   if( aNbLocs &&  aNbBases != aNbLocs)
934     return aGEOMObject._retn();
935   
936    Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
937       (thePath->GetStudyID(), thePath->GetEntry());
938    if(aPath.IsNull())
939      return aGEOMObject._retn();
940
941   for (ind = 0; ind < aNbBases; ind++) {
942     if (theBases[ind] == NULL) continue;
943     Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
944       GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
945     if(aBase.IsNull())
946       continue;
947     if(aNbLocs) {
948       Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
949         (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
950       if(aLoc.IsNull())
951         continue;
952       aSeqLocations->Append(aLoc);
953     }
954     aSeqBases->Append(aBase);
955
956     if(aNbSubBases>=aNbBases) {
957       Handle(GEOM_Object) aSubBase = GetOperations()->GetEngine()->
958         GetObject(theSubBases[ind]->GetStudyID(), theSubBases[ind]->GetEntry());
959       if(aSubBase.IsNull()) {
960         aSeqSubBases->Clear();
961         aNbSubBases = 0;
962         continue;
963       }
964       aSeqSubBases->Append(aSubBase);
965     }
966
967   }
968   if(!aSeqBases->Length())
969     return aGEOMObject._retn();
970
971   // Make pipe
972   Handle(GEOM_Object) anObject =
973     GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
974                                                aSeqLocations, aPath,
975                                                theWithContact, theWithCorrections);
976   if (!GetOperations()->IsDone() || anObject.IsNull())
977     return aGEOMObject._retn();
978
979   return GetObject(anObject);
980 }
981
982
983 //=============================================================================
984 /*!
985  *  MakePipeShellsWithoutPath
986  */
987 //=============================================================================
988 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
989                  (const GEOM::ListOfGO& theBases,
990                   const GEOM::ListOfGO& theLocations)
991 {
992   GEOM::GEOM_Object_var aGEOMObject;
993
994   //Set a not done flag
995   GetOperations()->SetNotDone();
996   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
997   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
998   int ind=0, aNbBases=0, aNbLocs=0;
999   
1000   //Get the shapes
1001   aNbBases = theBases.length();
1002   aNbLocs = theLocations.length();
1003
1004   if( aNbLocs &&  aNbBases != aNbLocs)
1005     return aGEOMObject._retn();
1006   
1007   for (ind = 0; ind < aNbBases; ind++) {
1008     if (theBases[ind] == NULL) continue;
1009     Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
1010       GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
1011     if(aBase.IsNull())
1012       continue;
1013     if(aNbLocs) {
1014       Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
1015         (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
1016       if(aLoc.IsNull())
1017         continue;
1018       aSeqLocations->Append(aLoc);
1019     }
1020     aSeqBases->Append(aBase);
1021   }
1022
1023   if(!aSeqBases->Length())
1024     return aGEOMObject._retn();
1025
1026   // Make pipe
1027   Handle(GEOM_Object) anObject =
1028     GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
1029
1030   if (!GetOperations()->IsDone() || anObject.IsNull())
1031     return aGEOMObject._retn();
1032
1033   return GetObject(anObject);
1034 }
1035
1036
1037 //=============================================================================
1038 /*!
1039  *  MakePipeBiNormalAlongVector
1040  */
1041 //=============================================================================
1042 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
1043                  (GEOM::GEOM_Object_ptr theBase, 
1044                   GEOM::GEOM_Object_ptr thePath, 
1045                   GEOM::GEOM_Object_ptr theVec)
1046 {
1047   GEOM::GEOM_Object_var aGEOMObject;
1048
1049   //Set a not done flag
1050   GetOperations()->SetNotDone();
1051
1052   if (theBase == NULL || thePath == NULL || theVec == NULL) return aGEOMObject._retn();
1053
1054   //Get the reference objects
1055   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
1056     (theBase->GetStudyID(), theBase->GetEntry());
1057   Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
1058     (thePath->GetStudyID(), thePath->GetEntry());
1059   Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
1060     (theVec->GetStudyID(), theVec->GetEntry());
1061
1062   if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
1063
1064   //Create the Pipe
1065   Handle(GEOM_Object) anObject =
1066     GetOperations()->MakePipeBiNormalAlongVector(aBase, aPath, aVec);
1067   if (!GetOperations()->IsDone() || anObject.IsNull())
1068     return aGEOMObject._retn();
1069
1070   return GetObject(anObject);
1071 }