Salome HOME
NPAL 16548, 16820, 16218, 16547
[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  
72   return GetObject(anObject);
73 }
74
75 //=============================================================================
76 /*!
77  *  MakeBoxTwoPnt
78  */
79 //=============================================================================
80 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
81                       (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
82 {
83   GEOM::GEOM_Object_var aGEOMObject;
84
85   //Set a not done flag
86   GetOperations()->SetNotDone();
87
88   if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn();
89
90   //Get the reference points
91   Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
92     (thePnt1->GetStudyID(), thePnt1->GetEntry());
93   Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
94     (thePnt2->GetStudyID(), thePnt2->GetEntry());
95
96   if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
97
98   //Create the Box
99   Handle(GEOM_Object) anObject = GetOperations()->MakeBoxTwoPnt(aPnt1, aPnt2);
100   if (!GetOperations()->IsDone() || anObject.IsNull())
101     return aGEOMObject._retn();
102
103   return GetObject(anObject);
104 }
105
106 //=============================================================================
107 /*!
108  *  MakeCylinderRH
109  */
110 //=============================================================================
111 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
112                                                                 CORBA::Double theH)
113 {
114   GEOM::GEOM_Object_var aGEOMObject;
115
116   //Set a not done flag
117   GetOperations()->SetNotDone();
118
119   //Create the Cylinder
120   Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
121   if (!GetOperations()->IsDone() || anObject.IsNull())
122     return aGEOMObject._retn();
123
124   return GetObject(anObject);
125 }
126
127 //=============================================================================
128 /*!
129  *  MakeCylinderPntVecRH
130  */
131 //=============================================================================
132 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
133                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
134                        CORBA::Double theR, CORBA::Double theH)
135 {
136   GEOM::GEOM_Object_var aGEOMObject;
137
138   //Set a not done flag
139   GetOperations()->SetNotDone();
140
141   if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
142
143   //Get the reference points
144   Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
145     (thePnt->GetStudyID(), thePnt->GetEntry());
146   Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
147     (theVec->GetStudyID(), theVec->GetEntry());
148
149   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
150
151   //Create the Cylinder
152   Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
153   if (!GetOperations()->IsDone() || anObject.IsNull())
154     return aGEOMObject._retn();
155
156   return GetObject(anObject);
157 }
158
159 //=============================================================================
160 /*!
161  *  MakeConeR1R2H
162  */
163 //=============================================================================
164 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
165                                                                CORBA::Double theR2,
166                                                                CORBA::Double theH)
167 {
168   GEOM::GEOM_Object_var aGEOMObject;
169
170   //Set a not done flag
171   GetOperations()->SetNotDone();
172
173   //Create the Cone
174   Handle(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH);
175   if (!GetOperations()->IsDone() || anObject.IsNull())
176     return aGEOMObject._retn();
177
178   return GetObject(anObject);
179 }
180
181 //=============================================================================
182 /*!
183  *  MakeConePntVecR1R2H
184  */
185 //=============================================================================
186 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
187                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
188                        CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
189 {
190   GEOM::GEOM_Object_var aGEOMObject;
191
192   //Set a not done flag
193   GetOperations()->SetNotDone();
194
195   if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
196
197   //Get the reference points
198   Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
199     (thePnt->GetStudyID(), thePnt->GetEntry());
200   Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
201     (theVec->GetStudyID(), theVec->GetEntry());
202
203   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
204
205   //Create the Cone
206   Handle(GEOM_Object) anObject =
207       GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH);
208   if (!GetOperations()->IsDone() || anObject.IsNull())
209     return aGEOMObject._retn();
210
211   return GetObject(anObject);
212 }
213
214 //=============================================================================
215 /*!
216  *  MakeSphereR
217  */
218 //=============================================================================
219 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
220 {
221   GEOM::GEOM_Object_var aGEOMObject;
222
223   //Set a not done flag
224   GetOperations()->SetNotDone();
225
226   //Create the Cone
227   Handle(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR);
228   if (!GetOperations()->IsDone() || anObject.IsNull())
229     return aGEOMObject._retn();
230
231   return GetObject(anObject);
232 }
233
234 //=============================================================================
235 /*!
236  *  MakeSpherePntR
237  */
238 //=============================================================================
239 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
240                       (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR)
241 {
242   GEOM::GEOM_Object_var aGEOMObject;
243
244   //Set a not done flag
245   GetOperations()->SetNotDone();
246
247   if (thePnt == NULL) return aGEOMObject._retn();
248
249   //Get the reference point
250   Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
251     (thePnt->GetStudyID(), thePnt->GetEntry());
252
253   if (aPnt.IsNull()) return aGEOMObject._retn();
254
255   //Create the Sphere
256   Handle(GEOM_Object) anObject =
257       GetOperations()->MakeSpherePntR(aPnt, theR);
258   if (!GetOperations()->IsDone() || anObject.IsNull())
259     return aGEOMObject._retn();
260
261   return GetObject(anObject);
262 }
263
264 //=============================================================================
265 /*!
266  *  MakeTorusRR
267  */
268 //=============================================================================
269 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
270                       (CORBA::Double theRMajor, CORBA::Double theRMinor)
271 {
272   GEOM::GEOM_Object_var aGEOMObject;
273
274   //Set a not done flag
275   GetOperations()->SetNotDone();
276
277   // Make Torus
278   Handle(GEOM_Object) anObject =
279     GetOperations()->MakeTorusRR(theRMajor, theRMinor);
280   if (!GetOperations()->IsDone() || anObject.IsNull())
281     return aGEOMObject._retn();
282
283   return GetObject(anObject);
284 }
285
286 //=============================================================================
287 /*!
288  *  MakeTorusPntVecRR
289  */
290 //=============================================================================
291 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
292                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
293                        CORBA::Double theRMajor, CORBA::Double theRMinor)
294 {
295   GEOM::GEOM_Object_var aGEOMObject;
296
297   //Set a not done flag
298   GetOperations()->SetNotDone();
299
300   if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
301
302   //Get the reference points
303   Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
304     (thePnt->GetStudyID(), thePnt->GetEntry());
305   Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
306     (theVec->GetStudyID(), theVec->GetEntry());
307
308   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
309
310   // Make Torus
311   Handle(GEOM_Object) anObject =
312     GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
313   if (!GetOperations()->IsDone() || anObject.IsNull())
314     return aGEOMObject._retn();
315
316   return GetObject(anObject);
317 }
318
319 //=============================================================================
320 /*!
321  *  MakePrismVecH
322  */
323 //=============================================================================
324 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
325                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
326                        CORBA::Double theH)
327 {
328   GEOM::GEOM_Object_var aGEOMObject;
329
330   //Set a not done flag
331   GetOperations()->SetNotDone();
332
333   if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
334
335   //Get the reference objects
336   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
337     (theBase->GetStudyID(), theBase->GetEntry());
338   Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
339     (theVec->GetStudyID(), theVec->GetEntry());
340
341   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
342
343   //Create the Prism
344   Handle(GEOM_Object) anObject =
345       GetOperations()->MakePrismVecH(aBase, aVec, theH);
346   if (!GetOperations()->IsDone() || anObject.IsNull())
347     return aGEOMObject._retn();
348
349   return GetObject(anObject);
350 }
351
352 //=============================================================================
353 /*!
354  *  MakePrismVecH2Ways
355  */
356 //=============================================================================
357 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
358                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
359                        CORBA::Double theH)
360 {
361   GEOM::GEOM_Object_var aGEOMObject;
362
363   //Set a not done flag
364   GetOperations()->SetNotDone();
365
366   if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
367
368   //Get the reference objects
369   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
370     (theBase->GetStudyID(), theBase->GetEntry());
371   Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
372     (theVec->GetStudyID(), theVec->GetEntry());
373
374   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
375
376   //Create the Prism
377   Handle(GEOM_Object) anObject =
378       GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
379   if (!GetOperations()->IsDone() || anObject.IsNull())
380     return aGEOMObject._retn();
381
382   return GetObject(anObject);
383 }
384
385 //=============================================================================
386 /*!
387  *  MakePrismTwoPnt
388  */
389 //=============================================================================
390 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
391                                              (GEOM::GEOM_Object_ptr theBase,
392                                               GEOM::GEOM_Object_ptr thePoint1,
393                                               GEOM::GEOM_Object_ptr thePoint2)
394 {
395   GEOM::GEOM_Object_var aGEOMObject;
396
397   //Set a not done flag
398   GetOperations()->SetNotDone();
399
400   if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
401     return aGEOMObject._retn();
402
403   //Get the reference objects
404   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
405     (theBase->GetStudyID(), theBase->GetEntry());
406   Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
407     (thePoint1->GetStudyID(), thePoint1->GetEntry());
408   Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
409     (thePoint2->GetStudyID(), thePoint2->GetEntry());
410
411   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
412     return aGEOMObject._retn();
413
414   //Create the Prism
415   Handle(GEOM_Object) anObject =
416     GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
417   if (!GetOperations()->IsDone() || anObject.IsNull())
418     return aGEOMObject._retn();
419
420   return GetObject(anObject);
421 }
422
423 //=============================================================================
424 /*!
425  *  MakePrismTwoPnt2Ways
426  */
427 //=============================================================================
428 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
429                                              (GEOM::GEOM_Object_ptr theBase,
430                                               GEOM::GEOM_Object_ptr thePoint1,
431                                               GEOM::GEOM_Object_ptr thePoint2)
432 {
433   GEOM::GEOM_Object_var aGEOMObject;
434
435   //Set a not done flag
436   GetOperations()->SetNotDone();
437
438   if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
439     return aGEOMObject._retn();
440
441   //Get the reference objects
442   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
443     (theBase->GetStudyID(), theBase->GetEntry());
444   Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
445     (thePoint1->GetStudyID(), thePoint1->GetEntry());
446   Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
447     (thePoint2->GetStudyID(), thePoint2->GetEntry());
448
449   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
450     return aGEOMObject._retn();
451
452   //Create the Prism
453   Handle(GEOM_Object) anObject =
454     GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
455   if (!GetOperations()->IsDone() || anObject.IsNull())
456     return aGEOMObject._retn();
457
458   return GetObject(anObject);
459 }
460
461 //=============================================================================
462 /*!
463  *  MakePipe
464  */
465 //=============================================================================
466 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
467                  (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
468 {
469   GEOM::GEOM_Object_var aGEOMObject;
470
471   //Set a not done flag
472   GetOperations()->SetNotDone();
473
474   if (theBase == NULL || thePath == NULL) return aGEOMObject._retn();
475
476   //Get the reference objects
477   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
478     (theBase->GetStudyID(), theBase->GetEntry());
479   Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
480     (thePath->GetStudyID(), thePath->GetEntry());
481
482   if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
483
484   //Create the Pipe
485   Handle(GEOM_Object) anObject =
486     GetOperations()->MakePipe(aBase, aPath);
487   if (!GetOperations()->IsDone() || anObject.IsNull())
488     return aGEOMObject._retn();
489
490   return GetObject(anObject);
491 }
492
493 //=============================================================================
494 /*!
495  *  MakeRevolutionAxisAngle
496  */
497 //=============================================================================
498 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
499                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
500                        CORBA::Double theAngle)
501 {
502   GEOM::GEOM_Object_var aGEOMObject;
503
504   //Set a not done flag
505   GetOperations()->SetNotDone();
506
507   if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
508
509   //Get the reference objects
510   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
511     (theBase->GetStudyID(), theBase->GetEntry());
512   Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
513     (theAxis->GetStudyID(), theAxis->GetEntry());
514
515   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
516
517   //Create the Revolution
518   Handle(GEOM_Object) anObject =
519       GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
520   if (!GetOperations()->IsDone() || anObject.IsNull())
521     return aGEOMObject._retn();
522
523   return GetObject(anObject);
524 }
525
526 //=============================================================================
527 /*!
528  *  MakeRevolutionAxisAngle2Ways
529  */
530 //=============================================================================
531 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
532                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
533                        CORBA::Double theAngle)
534 {
535   GEOM::GEOM_Object_var aGEOMObject;
536
537   //Set a not done flag
538   GetOperations()->SetNotDone();
539
540   if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
541
542   //Get the reference objects
543   Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
544     (theBase->GetStudyID(), theBase->GetEntry());
545   Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
546     (theAxis->GetStudyID(), theAxis->GetEntry());
547
548   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
549
550   //Create the Revolution
551   Handle(GEOM_Object) anObject =
552       GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
553   if (!GetOperations()->IsDone() || anObject.IsNull())
554     return aGEOMObject._retn();
555
556   return GetObject(anObject);
557 }
558
559 //=============================================================================
560 /*!
561  *  MakeFilling
562  */
563 //=============================================================================
564 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
565                                                             CORBA::Long theMinDeg,
566                                                             CORBA::Long theMaxDeg,
567                                                             CORBA::Double theTol2D,
568                                                             CORBA::Double theTol3D,
569                                                             CORBA::Long theNbIter)
570 {
571   GEOM::GEOM_Object_var aGEOMObject;
572
573   //Set a not done flag
574   GetOperations()->SetNotDone();
575
576   if (theShape == NULL) return aGEOMObject._retn();
577
578   //Get the reference objects
579   Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
580     (theShape->GetStudyID(), theShape->GetEntry());
581
582   if (aShape.IsNull()) return aGEOMObject._retn();
583
584   //Create the Solid
585   Handle(GEOM_Object) anObject = GetOperations()->MakeFilling(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter);
586   if (!GetOperations()->IsDone() || anObject.IsNull())
587     return aGEOMObject._retn();
588
589   return GetObject(anObject);
590 }
591
592 //=============================================================================
593 /*!
594  *  MakeThruSections
595  */
596 //=============================================================================
597 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
598                                                                  CORBA::Boolean theModeSolid,
599                                                                  CORBA::Double thePreci,
600                                                                  CORBA::Boolean theRuled)
601 {
602    GEOM::GEOM_Object_var aGEOMObject;
603
604   //Set a not done flag
605   GetOperations()->SetNotDone();
606   Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
607   int ind, aLen;
608
609   //Get the shapes
610   aLen = theSeqSections.length();
611   for (ind = 0; ind < aLen; ind++) {
612     if (theSeqSections[ind] == NULL) continue;
613     Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
614       (theSeqSections[ind]->GetStudyID(), theSeqSections[ind]->GetEntry());
615     if (!aSh.IsNull())
616       aSeqSections->Append(aSh);
617   }
618   if(!aSeqSections->Length())
619     return aGEOMObject._retn();
620
621   // Make shell or solid
622   Handle(GEOM_Object) anObject =
623     GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
624   if (!GetOperations()->IsDone() || anObject.IsNull())
625     return aGEOMObject._retn();
626
627   return GetObject(anObject);
628 }
629
630 //=============================================================================
631 /*!
632  *  MakePipeWithDifferentSections
633  */
634 //=============================================================================
635 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
636                                                                               const GEOM::ListOfGO& theLocations,
637                                                                               GEOM::GEOM_Object_ptr thePath,
638                                                                               CORBA::Boolean theWithContact,
639                                                                               CORBA::Boolean theWithCorrections)
640 {
641    GEOM::GEOM_Object_var aGEOMObject;
642
643   //Set a not done flag
644   GetOperations()->SetNotDone();
645   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
646   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
647   int ind=0, aNbBases =0,aNbLocs=0;
648   
649   //Get the shapes
650   aNbBases = theBases.length();
651   aNbLocs = theLocations.length();
652
653   if( aNbLocs &&  aNbBases != aNbLocs)
654     return aGEOMObject._retn();
655   
656    Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
657       (thePath->GetStudyID(), thePath->GetEntry());
658    if(aPath.IsNull())
659      return aGEOMObject._retn();
660
661   for (ind = 0; ind < aNbBases; ind++) {
662     if (theBases[ind] == NULL) continue;
663     Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject(theBases[ind]->GetStudyID(), 
664                         theBases[ind]->GetEntry());
665     if(aBase.IsNull())
666       continue;
667     if(aNbLocs)
668     {
669       Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
670         (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
671       if(aLoc.IsNull())
672         continue;
673       aSeqLocations->Append(aLoc);
674     }
675     aSeqBases->Append(aBase);
676   }
677   if(!aSeqBases->Length())
678     return aGEOMObject._retn();
679
680   // Make pipe
681   Handle(GEOM_Object) anObject =
682     GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
683                                                    theWithContact,theWithCorrections);
684   if (!GetOperations()->IsDone() || anObject.IsNull())
685     return aGEOMObject._retn();
686
687   return GetObject(anObject);
688 }
689
690
691 //=============================================================================
692 /*!
693  *  MakePipeWithShellSections
694  */
695 //=============================================================================
696 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
697                  (const GEOM::ListOfGO& theBases,
698                   const GEOM::ListOfGO& theSubBases,
699                   const GEOM::ListOfGO& theLocations,
700                   GEOM::GEOM_Object_ptr thePath,
701                   CORBA::Boolean theWithContact,
702                   CORBA::Boolean theWithCorrections)
703 {
704   GEOM::GEOM_Object_var aGEOMObject;
705
706   //Set a not done flag
707   GetOperations()->SetNotDone();
708   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
709   Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
710   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
711   int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
712   
713   //Get the shapes
714   aNbBases = theBases.length();
715   aNbSubBases = theSubBases.length();
716   aNbLocs = theLocations.length();
717
718   if( aNbLocs &&  aNbBases != aNbLocs)
719     return aGEOMObject._retn();
720   
721    Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
722       (thePath->GetStudyID(), thePath->GetEntry());
723    if(aPath.IsNull())
724      return aGEOMObject._retn();
725
726   for (ind = 0; ind < aNbBases; ind++) {
727     if (theBases[ind] == NULL) continue;
728     Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
729       GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
730     if(aBase.IsNull())
731       continue;
732     if(aNbLocs) {
733       Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
734         (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
735       if(aLoc.IsNull())
736         continue;
737       aSeqLocations->Append(aLoc);
738     }
739     aSeqBases->Append(aBase);
740
741     if(aNbSubBases>=aNbBases) {
742       Handle(GEOM_Object) aSubBase = GetOperations()->GetEngine()->
743         GetObject(theSubBases[ind]->GetStudyID(), theSubBases[ind]->GetEntry());
744       if(aSubBase.IsNull()) {
745         aSeqSubBases->Clear();
746         aNbSubBases = 0;
747         continue;
748       }
749       aSeqSubBases->Append(aSubBase);
750     }
751
752   }
753   if(!aSeqBases->Length())
754     return aGEOMObject._retn();
755
756   // Make pipe
757   Handle(GEOM_Object) anObject =
758     GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
759                                                aSeqLocations, aPath,
760                                                theWithContact, theWithCorrections);
761   if (!GetOperations()->IsDone() || anObject.IsNull())
762     return aGEOMObject._retn();
763
764   return GetObject(anObject);
765 }
766
767
768 //=============================================================================
769 /*!
770  *  MakePipeShellsWithoutPath
771  */
772 //=============================================================================
773 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
774                  (const GEOM::ListOfGO& theBases,
775                   const GEOM::ListOfGO& theLocations)
776 {
777   GEOM::GEOM_Object_var aGEOMObject;
778
779   //Set a not done flag
780   GetOperations()->SetNotDone();
781   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
782   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
783   int ind=0, aNbBases=0, aNbLocs=0;
784   
785   //Get the shapes
786   aNbBases = theBases.length();
787   aNbLocs = theLocations.length();
788
789   if( aNbLocs &&  aNbBases != aNbLocs)
790     return aGEOMObject._retn();
791   
792   for (ind = 0; ind < aNbBases; ind++) {
793     if (theBases[ind] == NULL) continue;
794     Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
795       GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
796     if(aBase.IsNull())
797       continue;
798     if(aNbLocs) {
799       Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
800         (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
801       if(aLoc.IsNull())
802         continue;
803       aSeqLocations->Append(aLoc);
804     }
805     aSeqBases->Append(aBase);
806   }
807
808   if(!aSeqBases->Length())
809     return aGEOMObject._retn();
810
811   // Make pipe
812   Handle(GEOM_Object) anObject =
813     GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
814
815   if (!GetOperations()->IsDone() || anObject.IsNull())
816     return aGEOMObject._retn();
817
818   return GetObject(anObject);
819 }