Salome HOME
INT PAL 0052642: Notebook variables are not dumped to script with Fillet1D, Fillet2D...
[modules/geom.git] / src / GEOM_I / GEOM_I3DPrimOperations_i.cc
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #include <Standard_Stream.hxx>
24
25 #include "GEOM_I3DPrimOperations_i.hh"
26
27 #include "utilities.h"
28 #include "OpUtil.hxx"
29 #include "Utils_ExceptHandlers.hxx"
30
31 #include "GEOM_Engine.hxx"
32 #include "GEOM_Object.hxx"
33
34 #define SUBSHAPE_ERROR "Sub shape cannot be transformed"
35
36 //=============================================================================
37 /*!
38  *   constructor:
39  */
40 //=============================================================================
41 GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_I3DPrimOperations* theImpl)
42 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
43 {
44   MESSAGE("GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i");
45 }
46
47 //=============================================================================
48 /*!
49  *  destructor
50  */
51 //=============================================================================
52 GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i()
53 {
54   MESSAGE("GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i");
55 }
56
57
58 //=============================================================================
59 /*!
60  *  MakeBoxDXDYDZ
61  */
62 //=============================================================================
63 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double theDX,
64                                                                CORBA::Double theDY,
65                                                                CORBA::Double theDZ)
66 {
67   GEOM::GEOM_Object_var aGEOMObject;
68
69   //Set a not done flag
70   GetOperations()->SetNotDone();
71
72   //Create the Box
73   Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ);
74   if (!GetOperations()->IsDone() || anObject.IsNull())
75     return aGEOMObject._retn();
76
77   return GetObject(anObject);
78 }
79
80 //=============================================================================
81 /*!
82  *  MakeBoxTwoPnt
83  */
84 //=============================================================================
85 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
86                       (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
87 {
88   GEOM::GEOM_Object_var aGEOMObject;
89
90   //Set a not done flag
91   GetOperations()->SetNotDone();
92
93   Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
94   Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
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  *  MakeFaceHW
109  */
110 //=============================================================================
111 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH,
112                                                             CORBA::Double theW,
113                                                             CORBA::Short  theOrientation)
114 {
115   GEOM::GEOM_Object_var aGEOMObject;
116
117   //Set a not done flag
118   GetOperations()->SetNotDone();
119
120   if (theH == 0 || theW == 0)
121     return aGEOMObject._retn();
122
123   //Create the Face
124   Handle(GEOM_Object) anObject = GetOperations()->MakeFaceHW(theH, theW, theOrientation);
125   if (!GetOperations()->IsDone() || anObject.IsNull())
126     return aGEOMObject._retn();
127
128   return GetObject(anObject);
129 }
130
131 //=============================================================================
132 /*!
133  *  MakeFaceObjHW
134  */
135 //=============================================================================
136 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW
137                                                (GEOM::GEOM_Object_ptr theObj,
138                                                 CORBA::Double theH,
139                                                 CORBA::Double theW)
140 {
141   GEOM::GEOM_Object_var aGEOMObject;
142
143   //Set a not done flag
144   GetOperations()->SetNotDone();
145
146   //Get the reference object
147   Handle(GEOM_Object) anObj = GetObjectImpl(theObj);
148
149   if (anObj.IsNull())
150     return aGEOMObject._retn();
151
152   //Create the Face
153   Handle(GEOM_Object) anObject = GetOperations()->MakeFaceObjHW(anObj, theH, theW);
154   if (!GetOperations()->IsDone() || anObject.IsNull())
155     return aGEOMObject._retn();
156
157   return GetObject(anObject);
158 }
159
160 //=============================================================================
161 /*!
162  *  MakeDiskPntVecR
163  */
164 //=============================================================================
165 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR
166                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
167                        CORBA::Double theR)
168 {
169   GEOM::GEOM_Object_var aGEOMObject;
170
171   //Set a not done flag
172   GetOperations()->SetNotDone();
173
174   //Get the reference points
175   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
176   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
177
178   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
179
180   // Make Disk
181   Handle(GEOM_Object) anObject =
182     GetOperations()->MakeDiskPntVecR(aPnt, aVec, theR);
183   if (!GetOperations()->IsDone() || anObject.IsNull())
184     return aGEOMObject._retn();
185
186   return GetObject(anObject);
187 }
188
189 //=============================================================================
190 /*!
191  *  MakeDiskThreePnt
192  */
193 //=============================================================================
194 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt
195                       (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
196                        GEOM::GEOM_Object_ptr thePnt3)
197 {
198   GEOM::GEOM_Object_var aGEOMObject;
199
200   //Set a not done flag
201   GetOperations()->SetNotDone();
202
203   //Get the reference points
204   Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
205   Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
206   Handle(GEOM_Object) aPnt3 = GetObjectImpl(thePnt3);
207
208   if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn();
209
210   // Make Disk
211   Handle(GEOM_Object) anObject =
212       GetOperations()->MakeDiskThreePnt(aPnt1, aPnt2, aPnt3);
213   if (!GetOperations()->IsDone() || anObject.IsNull())
214     return aGEOMObject._retn();
215
216   return GetObject(anObject);
217 }
218
219 //=============================================================================
220 /*!
221  *  MakeDiskR
222  */
223 //=============================================================================
224 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
225                                                            CORBA::Short  theOrientation)
226 {
227   GEOM::GEOM_Object_var aGEOMObject;
228
229   //Set a not done flag
230   GetOperations()->SetNotDone();
231
232   if (theR == 0)
233     return aGEOMObject._retn();
234
235   //Create the Face
236   Handle(GEOM_Object) anObject = GetOperations()->MakeDiskR(theR, theOrientation);
237   if (!GetOperations()->IsDone() || anObject.IsNull())
238     return aGEOMObject._retn();
239
240   return GetObject(anObject);
241 }
242
243 //=============================================================================
244 /*!
245  *  MakeCylinderRH
246  */
247 //=============================================================================
248 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
249                                                                 CORBA::Double theH)
250 {
251   GEOM::GEOM_Object_var aGEOMObject;
252
253   //Set a not done flag
254   GetOperations()->SetNotDone();
255
256   //Create the Cylinder
257   Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
258   if (!GetOperations()->IsDone() || anObject.IsNull())
259     return aGEOMObject._retn();
260
261   return GetObject(anObject);
262 }
263
264 //=============================================================================
265 /*!
266  *  MakeCylinderRHA
267  */
268 //=============================================================================
269 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRHA (CORBA::Double theR,
270                                                                  CORBA::Double theH,
271                                                                  CORBA::Double theA)
272 {
273   GEOM::GEOM_Object_var aGEOMObject;
274
275   //Set a not done flag
276   GetOperations()->SetNotDone();
277
278   //Create the Cylinder
279   Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRHA(theR, theH, theA);
280   if (!GetOperations()->IsDone() || anObject.IsNull())
281     return aGEOMObject._retn();
282
283   return GetObject(anObject);
284 }
285
286 //=============================================================================
287 /*!
288  *  MakeCylinderPntVecRH
289  */
290 //=============================================================================
291 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
292                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
293                        CORBA::Double theR, CORBA::Double theH)
294 {
295   GEOM::GEOM_Object_var aGEOMObject;
296
297   //Set a not done flag
298   GetOperations()->SetNotDone();
299
300   //Get the reference points
301   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
302   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
303
304   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
305
306   //Create the Cylinder
307   Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
308   if (!GetOperations()->IsDone() || anObject.IsNull())
309     return aGEOMObject._retn();
310
311   return GetObject(anObject);
312 }
313
314 //=============================================================================
315 /*!
316  *  MakeCylinderPntVecRHA
317  */
318 //=============================================================================
319 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRHA
320                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
321                        CORBA::Double theR, CORBA::Double theH, CORBA::Double theA)
322 {
323   GEOM::GEOM_Object_var aGEOMObject;
324
325   //Set a not done flag
326   GetOperations()->SetNotDone();
327
328   //Get the reference points
329   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
330   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
331
332   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
333
334   //Create the Cylinder
335   Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRHA(aPnt, aVec, theR, theH, theA);
336   if (!GetOperations()->IsDone() || anObject.IsNull())
337     return aGEOMObject._retn();
338
339   return GetObject(anObject);
340 }
341
342 //=============================================================================
343 /*!
344  *  MakeConeR1R2H
345  */
346 //=============================================================================
347 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
348                                                                CORBA::Double theR2,
349                                                                CORBA::Double theH)
350 {
351   GEOM::GEOM_Object_var aGEOMObject;
352
353   //Set a not done flag
354   GetOperations()->SetNotDone();
355
356   //Create the Cone
357   Handle(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH);
358   if (!GetOperations()->IsDone() || anObject.IsNull())
359     return aGEOMObject._retn();
360
361   return GetObject(anObject);
362 }
363
364 //=============================================================================
365 /*!
366  *  MakeConePntVecR1R2H
367  */
368 //=============================================================================
369 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
370                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
371                        CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
372 {
373   GEOM::GEOM_Object_var aGEOMObject;
374
375   //Set a not done flag
376   GetOperations()->SetNotDone();
377
378   //Get the reference points
379   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
380   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
381
382   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
383
384   //Create the Cone
385   Handle(GEOM_Object) anObject =
386       GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH);
387   if (!GetOperations()->IsDone() || anObject.IsNull())
388     return aGEOMObject._retn();
389
390   return GetObject(anObject);
391 }
392
393 //=============================================================================
394 /*!
395  *  MakeSphereR
396  */
397 //=============================================================================
398 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
399 {
400   GEOM::GEOM_Object_var aGEOMObject;
401
402   //Set a not done flag
403   GetOperations()->SetNotDone();
404
405   //Create the Cone
406   Handle(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR);
407   if (!GetOperations()->IsDone() || anObject.IsNull())
408     return aGEOMObject._retn();
409
410   return GetObject(anObject);
411 }
412
413 //=============================================================================
414 /*!
415  *  MakeSpherePntR
416  */
417 //=============================================================================
418 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
419                       (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR)
420 {
421   GEOM::GEOM_Object_var aGEOMObject;
422
423   //Set a not done flag
424   GetOperations()->SetNotDone();
425
426   //Get the reference point
427   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
428
429   if (aPnt.IsNull()) return aGEOMObject._retn();
430
431   //Create the Sphere
432   Handle(GEOM_Object) anObject =
433     GetOperations()->MakeSpherePntR(aPnt, theR);
434   if (!GetOperations()->IsDone() || anObject.IsNull())
435     return aGEOMObject._retn();
436
437   return GetObject(anObject);
438 }
439
440 //=============================================================================
441 /*!
442  *  MakeTorusRR
443  */
444 //=============================================================================
445 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
446                       (CORBA::Double theRMajor, CORBA::Double theRMinor)
447 {
448   GEOM::GEOM_Object_var aGEOMObject;
449
450   //Set a not done flag
451   GetOperations()->SetNotDone();
452
453   // Make Torus
454   Handle(GEOM_Object) anObject =
455     GetOperations()->MakeTorusRR(theRMajor, theRMinor);
456   if (!GetOperations()->IsDone() || anObject.IsNull())
457     return aGEOMObject._retn();
458
459   return GetObject(anObject);
460 }
461
462 //=============================================================================
463 /*!
464  *  MakeTorusPntVecRR
465  */
466 //=============================================================================
467 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
468                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
469                        CORBA::Double theRMajor, CORBA::Double theRMinor)
470 {
471   GEOM::GEOM_Object_var aGEOMObject;
472
473   //Set a not done flag
474   GetOperations()->SetNotDone();
475
476   //Get the reference points
477   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
478   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
479
480   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
481
482   // Make Torus
483   Handle(GEOM_Object) anObject =
484     GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
485   if (!GetOperations()->IsDone() || anObject.IsNull())
486     return aGEOMObject._retn();
487
488   return GetObject(anObject);
489 }
490
491 //=============================================================================
492 /*!
493  *  MakePrismVecH
494  */
495 //=============================================================================
496 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
497                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
498                        CORBA::Double theH)
499 {
500   GEOM::GEOM_Object_var aGEOMObject;
501
502   //Set a not done flag
503   GetOperations()->SetNotDone();
504
505   //Get the reference objects
506   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
507   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
508
509   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
510
511   //Create the Prism
512   Handle(GEOM_Object) anObject =
513     GetOperations()->MakePrismVecH(aBase, aVec, theH);
514   if (!GetOperations()->IsDone() || anObject.IsNull())
515     return aGEOMObject._retn();
516
517   return GetObject(anObject);
518 }
519
520 //=============================================================================
521 /*!
522  *  MakePrismVecH2Ways
523  */
524 //=============================================================================
525 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
526                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
527                        CORBA::Double theH)
528 {
529   GEOM::GEOM_Object_var aGEOMObject;
530
531   //Set a not done flag
532   GetOperations()->SetNotDone();
533
534   //Get the reference objects
535   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
536   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
537
538   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
539
540   //Create the Prism
541   Handle(GEOM_Object) anObject =
542       GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
543   if (!GetOperations()->IsDone() || anObject.IsNull())
544     return aGEOMObject._retn();
545
546   return GetObject(anObject);
547 }
548
549 //=============================================================================
550 /*!
551  *  MakePrismVecH
552  */
553 //=============================================================================
554 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecHWithScaling
555                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
556                        CORBA::Double theH, CORBA::Double theScaleFactor)
557 {
558   GEOM::GEOM_Object_var aGEOMObject;
559
560   //Set a not done flag
561   GetOperations()->SetNotDone();
562
563   //Get the reference objects
564   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
565   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
566
567   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
568
569   //Create the Prism
570   Handle(GEOM_Object) anObject =
571     GetOperations()->MakePrismVecH(aBase, aVec, theH, theScaleFactor);
572   if (!GetOperations()->IsDone() || anObject.IsNull())
573     return aGEOMObject._retn();
574
575   return GetObject(anObject);
576 }
577
578 //=============================================================================
579 /*!
580  *  MakePrismTwoPnt
581  */
582 //=============================================================================
583 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
584                                              (GEOM::GEOM_Object_ptr theBase,
585                                               GEOM::GEOM_Object_ptr thePoint1,
586                                               GEOM::GEOM_Object_ptr thePoint2)
587 {
588   GEOM::GEOM_Object_var aGEOMObject;
589
590   //Set a not done flag
591   GetOperations()->SetNotDone();
592
593   //Get the reference objects
594   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
595   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
596   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
597
598   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
599     return aGEOMObject._retn();
600
601   //Create the Prism
602   Handle(GEOM_Object) anObject =
603     GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
604   if (!GetOperations()->IsDone() || anObject.IsNull())
605     return aGEOMObject._retn();
606
607   return GetObject(anObject);
608 }
609
610 //=============================================================================
611 /*!
612  *  MakePrismTwoPnt2Ways
613  */
614 //=============================================================================
615 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
616                                              (GEOM::GEOM_Object_ptr theBase,
617                                               GEOM::GEOM_Object_ptr thePoint1,
618                                               GEOM::GEOM_Object_ptr thePoint2)
619 {
620   GEOM::GEOM_Object_var aGEOMObject;
621
622   //Set a not done flag
623   GetOperations()->SetNotDone();
624
625   //Get the reference objects
626   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
627   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
628   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
629
630   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
631     return aGEOMObject._retn();
632
633   //Create the Prism
634   Handle(GEOM_Object) anObject =
635     GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
636   if (!GetOperations()->IsDone() || anObject.IsNull())
637     return aGEOMObject._retn();
638
639   return GetObject(anObject);
640 }
641
642 //=============================================================================
643 /*!
644  *  MakePrismTwoPnt
645  */
646 //=============================================================================
647 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPntWithScaling
648                                              (GEOM::GEOM_Object_ptr theBase,
649                                               GEOM::GEOM_Object_ptr thePoint1,
650                                               GEOM::GEOM_Object_ptr thePoint2,
651                                               CORBA::Double         theScaleFactor)
652 {
653   GEOM::GEOM_Object_var aGEOMObject;
654
655   //Set a not done flag
656   GetOperations()->SetNotDone();
657
658   //Get the reference objects
659   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
660   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
661   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
662
663   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
664     return aGEOMObject._retn();
665
666   //Create the Prism
667   Handle(GEOM_Object) anObject =
668     GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2, theScaleFactor);
669   if (!GetOperations()->IsDone() || anObject.IsNull())
670     return aGEOMObject._retn();
671
672   return GetObject(anObject);
673 }
674
675 //=============================================================================
676 /*!
677  *  MakePrismDXDYDZ
678  */
679 //=============================================================================
680 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
681                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
682                        CORBA::Double theDY, CORBA::Double theDZ)
683 {
684   GEOM::GEOM_Object_var aGEOMObject;
685
686   //Set a not done flag
687   GetOperations()->SetNotDone();
688
689   //Get the reference objects
690   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
691
692   if (aBase.IsNull()) return aGEOMObject._retn();
693
694   //Create the Prism
695   Handle(GEOM_Object) anObject =
696       GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ);
697   if (!GetOperations()->IsDone() || anObject.IsNull())
698     return aGEOMObject._retn();
699
700   return GetObject(anObject);
701 }
702
703 //=============================================================================
704 /*!
705  *  MakePrismDXDYDZ2Ways
706  */
707 //=============================================================================
708 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways
709                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
710                        CORBA::Double theDY, CORBA::Double theDZ)
711 {
712   GEOM::GEOM_Object_var aGEOMObject;
713
714   //Set a not done flag
715   GetOperations()->SetNotDone();
716
717   //Get the reference objects
718   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
719
720   if (aBase.IsNull()) return aGEOMObject._retn();
721
722   //Create the Prism
723   Handle(GEOM_Object) anObject =
724       GetOperations()->MakePrismDXDYDZ2Ways(aBase, theDX, theDY, theDZ);
725   if (!GetOperations()->IsDone() || anObject.IsNull())
726     return aGEOMObject._retn();
727
728   return GetObject(anObject);
729 }
730
731 //=============================================================================
732 /*!
733  *  MakePrismDXDYDZ
734  */
735 //=============================================================================
736 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZWithScaling
737                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
738                        CORBA::Double theDY, CORBA::Double theDZ,
739                        CORBA::Double theScaleFactor)
740 {
741   GEOM::GEOM_Object_var aGEOMObject;
742
743   //Set a not done flag
744   GetOperations()->SetNotDone();
745
746   //Get the reference objects
747   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
748
749   if (aBase.IsNull()) return aGEOMObject._retn();
750
751   //Create the Prism
752   Handle(GEOM_Object) anObject =
753     GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ, theScaleFactor);
754   if (!GetOperations()->IsDone() || anObject.IsNull())
755     return aGEOMObject._retn();
756
757   return GetObject(anObject);
758 }
759
760 //=============================================================================
761 /*!
762  *  MakeDraftPrism
763  */
764 //=============================================================================
765 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDraftPrism
766                       (GEOM::GEOM_Object_ptr theInitShape, GEOM::GEOM_Object_ptr theBase, 
767                        CORBA::Double  theHeight,
768                        CORBA::Double  theAngle,
769                        CORBA::Boolean theFuse,
770                        CORBA::Boolean theInvert)
771 {
772   GEOM::GEOM_Object_var aGEOMObject;
773   
774   //Set a not done flag
775   GetOperations()->SetNotDone();
776
777   //Get the reference objects
778   Handle(GEOM_Object) aInit   = GetObjectImpl(theInitShape);
779   Handle(GEOM_Object) aBase   = GetObjectImpl(theBase);
780
781   if (aBase.IsNull() || aInit.IsNull()) return aGEOMObject._retn();
782
783   //Create the Prism
784   Handle(GEOM_Object) anObject = GetOperations()->MakeDraftPrism(aInit, aBase, theHeight, theAngle, theFuse, theInvert);
785  
786   if (!GetOperations()->IsDone() || anObject.IsNull())
787     return aGEOMObject._retn();
788
789   return GetObject(anObject);
790 }
791
792 //=============================================================================
793 /*!
794  *  MakePipe
795  */
796 //=============================================================================
797 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
798                  (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
799 {
800   GEOM::GEOM_Object_var aGEOMObject;
801
802   //Set a not done flag
803   GetOperations()->SetNotDone();
804
805   //Get the reference objects
806   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
807   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
808
809   if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
810
811   //Create the Pipe
812   Handle(GEOM_Object) anObject =
813     GetOperations()->MakePipe(aBase, aPath);
814   if (!GetOperations()->IsDone() || anObject.IsNull())
815     return aGEOMObject._retn();
816
817   return GetObject(anObject);
818 }
819
820 //=============================================================================
821 /*!
822  *  MakeRevolutionAxisAngle
823  */
824 //=============================================================================
825 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
826                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
827                        CORBA::Double theAngle)
828 {
829   GEOM::GEOM_Object_var aGEOMObject;
830
831   //Set a not done flag
832   GetOperations()->SetNotDone();
833
834   //Get the reference objects
835   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
836   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
837
838   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
839
840   //Create the Revolution
841   Handle(GEOM_Object) anObject =
842       GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
843   if (!GetOperations()->IsDone() || anObject.IsNull())
844     return aGEOMObject._retn();
845
846   return GetObject(anObject);
847 }
848
849 //=============================================================================
850 /*!
851  *  MakeRevolutionAxisAngle2Ways
852  */
853 //=============================================================================
854 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
855                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
856                        CORBA::Double theAngle)
857 {
858   GEOM::GEOM_Object_var aGEOMObject;
859
860   //Set a not done flag
861   GetOperations()->SetNotDone();
862
863   //Get the reference objects
864   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
865   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
866
867   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
868
869   //Create the Revolution
870   Handle(GEOM_Object) anObject =
871       GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
872   if (!GetOperations()->IsDone() || anObject.IsNull())
873     return aGEOMObject._retn();
874
875   return GetObject(anObject);
876 }
877
878 //=============================================================================
879 /*!
880  *  MakeFilling
881  */
882 //=============================================================================
883 GEOM::GEOM_Object_ptr
884 GEOM_I3DPrimOperations_i::MakeFilling(const GEOM::ListOfGO&     theContours,
885                                       CORBA::Long               theMinDeg,
886                                       CORBA::Long               theMaxDeg,
887                                       CORBA::Double             theTol2D,
888                                       CORBA::Double             theTol3D,
889                                       CORBA::Long               theNbIter,
890                                       GEOM::filling_oper_method theMethod,
891                                       CORBA::Boolean            theApprox)
892 {
893   GEOM::GEOM_Object_var aGEOMObject;
894
895   //Set a not done flag
896   GetOperations()->SetNotDone();
897
898   //Get the reference objects
899   std::list< Handle(GEOM_Object) > aShapes;
900   if (! GetListOfObjectsImpl( theContours, aShapes ))
901     return aGEOMObject._retn();
902
903   int aMethod = 0;
904   switch (theMethod) {
905   case GEOM::FOM_Default:
906     {
907       // Default (standard behaviour)
908       aMethod = 0;
909     }
910     break;
911   case GEOM::FOM_UseOri:
912     {
913       // Use edges orientation
914       aMethod = 1;
915     }
916     break;
917   case GEOM::FOM_AutoCorrect:
918     {
919       // Auto-correct edges orientation
920       aMethod = 2;
921     }
922     break;
923   default:
924     {}
925   }
926
927   //Create the Solid
928   Handle(GEOM_Object) anObject = GetOperations()->MakeFilling
929     (aShapes, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, aMethod, theApprox);
930   if (!GetOperations()->IsDone() || anObject.IsNull())
931     return aGEOMObject._retn();
932
933   return GetObject(anObject);
934 }
935
936 //=============================================================================
937 /*!
938  *  MakeThruSections
939  */
940 //=============================================================================
941 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
942                                                                  CORBA::Boolean theModeSolid,
943                                                                  CORBA::Double thePreci,
944                                                                  CORBA::Boolean theRuled)
945 {
946    GEOM::GEOM_Object_var aGEOMObject;
947
948   //Set a not done flag
949   GetOperations()->SetNotDone();
950   Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
951   int ind, aLen;
952
953   //Get the shapes
954   aLen = theSeqSections.length();
955   for (ind = 0; ind < aLen; ind++) {
956     Handle(GEOM_Object) aSh = GetObjectImpl(theSeqSections[ind]);
957     if (!aSh.IsNull())
958       aSeqSections->Append(aSh);
959   }
960   if (!aSeqSections->Length())
961     return aGEOMObject._retn();
962
963   // Make shell or solid
964   Handle(GEOM_Object) anObject =
965     GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
966   if (!GetOperations()->IsDone() || anObject.IsNull())
967     return aGEOMObject._retn();
968
969   return GetObject(anObject);
970 }
971
972 //=============================================================================
973 /*!
974  *  MakePipeWithDifferentSections
975  */
976 //=============================================================================
977 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections
978                       (const GEOM::ListOfGO& theBases,
979                        const GEOM::ListOfGO& theLocations,
980                        GEOM::GEOM_Object_ptr thePath,
981                        CORBA::Boolean theWithContact,
982                        CORBA::Boolean theWithCorrections)
983 {
984   GEOM::GEOM_Object_var aGEOMObject;
985
986   //Set a not done flag
987   GetOperations()->SetNotDone();
988   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
989   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
990   int ind=0, aNbBases =0,aNbLocs=0;
991
992   //Get the shapes
993   aNbBases = theBases.length();
994   aNbLocs = theLocations.length();
995
996   if (aNbLocs && aNbBases != aNbLocs)
997     return aGEOMObject._retn();
998
999   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
1000   if (aPath.IsNull())
1001     return aGEOMObject._retn();
1002
1003   for (ind = 0; ind < aNbBases; ind++) {
1004     Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
1005     if (aBase.IsNull())
1006       continue;
1007     if (aNbLocs)
1008     {
1009       Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
1010       if (aLoc.IsNull())
1011         continue;
1012       aSeqLocations->Append(aLoc);
1013     }
1014     aSeqBases->Append(aBase);
1015   }
1016   if (!aSeqBases->Length())
1017     return aGEOMObject._retn();
1018
1019   // Make pipe
1020   Handle(GEOM_Object) anObject =
1021     GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
1022                                                    theWithContact,theWithCorrections);
1023   if (!GetOperations()->IsDone() || anObject.IsNull())
1024     return aGEOMObject._retn();
1025
1026   return GetObject(anObject);
1027 }
1028
1029
1030 //=============================================================================
1031 /*!
1032  *  MakePipeWithShellSections
1033  */
1034 //=============================================================================
1035 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
1036                  (const GEOM::ListOfGO& theBases,
1037                   const GEOM::ListOfGO& theSubBases,
1038                   const GEOM::ListOfGO& theLocations,
1039                   GEOM::GEOM_Object_ptr thePath,
1040                   CORBA::Boolean theWithContact,
1041                   CORBA::Boolean theWithCorrections)
1042 {
1043   GEOM::GEOM_Object_var aGEOMObject;
1044
1045   //Set a not done flag
1046   GetOperations()->SetNotDone();
1047   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
1048   Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
1049   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
1050   int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
1051
1052   //Get the shapes
1053   aNbBases = theBases.length();
1054   aNbSubBases = theSubBases.length();
1055   aNbLocs = theLocations.length();
1056
1057   if (aNbLocs && aNbBases != aNbLocs)
1058     return aGEOMObject._retn();
1059
1060   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
1061   if (aPath.IsNull())
1062     return aGEOMObject._retn();
1063
1064   for (ind = 0; ind < aNbBases; ind++) {
1065     Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
1066     if (aBase.IsNull())
1067       continue;
1068     if (aNbLocs) {
1069       Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
1070       if (aLoc.IsNull())
1071         continue;
1072       aSeqLocations->Append(aLoc);
1073     }
1074     aSeqBases->Append(aBase);
1075
1076     if (aNbSubBases >= aNbBases) {
1077       Handle(GEOM_Object) aSubBase = GetObjectImpl(theSubBases[ind]);
1078       if (aSubBase.IsNull()) {
1079         aSeqSubBases->Clear();
1080         aNbSubBases = 0;
1081         continue;
1082       }
1083       aSeqSubBases->Append(aSubBase);
1084     }
1085   }
1086   if (!aSeqBases->Length())
1087     return aGEOMObject._retn();
1088
1089   // Make pipe
1090   Handle(GEOM_Object) anObject =
1091     GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
1092                                                aSeqLocations, aPath,
1093                                                theWithContact, theWithCorrections);
1094   if (!GetOperations()->IsDone() || anObject.IsNull())
1095     return aGEOMObject._retn();
1096
1097   return GetObject(anObject);
1098 }
1099
1100
1101 //=============================================================================
1102 /*!
1103  *  MakePipeShellsWithoutPath
1104  */
1105 //=============================================================================
1106 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
1107                  (const GEOM::ListOfGO& theBases,
1108                   const GEOM::ListOfGO& theLocations)
1109 {
1110   GEOM::GEOM_Object_var aGEOMObject;
1111
1112   //Set a not done flag
1113   GetOperations()->SetNotDone();
1114   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
1115   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
1116   int ind=0, aNbBases=0, aNbLocs=0;
1117
1118   //Get the shapes
1119   aNbBases = theBases.length();
1120   aNbLocs = theLocations.length();
1121
1122   if (aNbLocs && aNbBases != aNbLocs)
1123     return aGEOMObject._retn();
1124
1125   for (ind = 0; ind < aNbBases; ind++) {
1126     Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
1127     if (aBase.IsNull())
1128       continue;
1129     if (aNbLocs) {
1130       Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
1131       if (aLoc.IsNull())
1132         continue;
1133       aSeqLocations->Append(aLoc);
1134     }
1135     aSeqBases->Append(aBase);
1136   }
1137
1138   if (!aSeqBases->Length())
1139     return aGEOMObject._retn();
1140
1141   // Make pipe
1142   Handle(GEOM_Object) anObject =
1143     GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
1144
1145   if (!GetOperations()->IsDone() || anObject.IsNull())
1146     return aGEOMObject._retn();
1147
1148   return GetObject(anObject);
1149 }
1150
1151 //=============================================================================
1152 /*!
1153  *  MakePipeBiNormalAlongVector
1154  */
1155 //=============================================================================
1156 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
1157                  (GEOM::GEOM_Object_ptr theBase,
1158                   GEOM::GEOM_Object_ptr thePath,
1159                   GEOM::GEOM_Object_ptr theVec)
1160 {
1161   GEOM::GEOM_Object_var aGEOMObject;
1162
1163   //Set a not done flag
1164   GetOperations()->SetNotDone();
1165
1166   //Get the reference objects
1167   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
1168   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
1169   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
1170
1171   if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
1172
1173   //Create the Pipe
1174   Handle(GEOM_Object) anObject =
1175     GetOperations()->MakePipeBiNormalAlongVector(aBase, aPath, aVec);
1176   if (!GetOperations()->IsDone() || anObject.IsNull())
1177     return aGEOMObject._retn();
1178
1179   return GetObject(anObject);
1180 }
1181
1182 //=============================================================================
1183 /*!
1184  *  MakeThickening
1185  */
1186 //=============================================================================
1187 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThickening
1188                  (GEOM::GEOM_Object_ptr   theObject,
1189                   const GEOM::ListOfLong &theFacesIDs,
1190                   CORBA::Double           theOffset,
1191                   CORBA::Boolean          doCopy,
1192                   CORBA::Boolean          theInside)
1193 {
1194   GEOM::GEOM_Object_var aGEOMObject;
1195   //Set a not done flag
1196   GetOperations()->SetNotDone();
1197
1198   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
1199
1200   //check if the object is a sub-shape
1201   if (!theObject->IsMainShape() && !doCopy) {
1202     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
1203     return aGEOMObject._retn();
1204   }
1205   
1206   if (!doCopy)
1207     aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
1208
1209   //Get the basic object
1210   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1211   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1212
1213   // Get faces IDs.
1214   Handle(TColStd_HArray1OfInteger) aFaceIDs;
1215   Standard_Integer                 aNbIDs = theFacesIDs.length();
1216   Standard_Integer                 i;
1217
1218   if (aNbIDs > 0) {
1219     aFaceIDs = new TColStd_HArray1OfInteger (1, aNbIDs);
1220
1221     for (i = 0; i < aNbIDs; i++) {
1222       aFaceIDs->SetValue(i + 1, theFacesIDs[i]);
1223     }
1224   }
1225
1226   //Create the thickened shape
1227   if (doCopy)
1228   {
1229     Handle(GEOM_Object) anObject = GetOperations()->MakeThickening(
1230       aBasicObject, aFaceIDs, theOffset, doCopy, theInside);
1231     if (!GetOperations()->IsDone() || anObject.IsNull())
1232       return aGEOMObject._retn();
1233     
1234     return GetObject(anObject);
1235   }
1236   else
1237   {
1238     GetOperations()->MakeThickening(aBasicObject, aFaceIDs, theOffset, doCopy, theInside);
1239     
1240     // Update GUI.
1241     UpdateGUIForObject(theObject);
1242     
1243     return aGEOMObject._retn();
1244   }
1245 }
1246
1247 //=============================================================================
1248 /*!
1249  *  RestorePath
1250  */
1251 //=============================================================================
1252 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::RestorePath
1253                  (GEOM::GEOM_Object_ptr theShape,
1254                   GEOM::GEOM_Object_ptr theBase1,
1255                   GEOM::GEOM_Object_ptr theBase2)
1256 {
1257   GEOM::GEOM_Object_var aGEOMObject;
1258
1259   // Set a not done flag
1260   GetOperations()->SetNotDone();
1261
1262   // Get the reference objects
1263   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1264   Handle(GEOM_Object) aBase1 = GetObjectImpl(theBase1);
1265   Handle(GEOM_Object) aBase2 = GetObjectImpl(theBase2);
1266
1267   if (aShape.IsNull() || aBase1.IsNull() || aBase2.IsNull()) return aGEOMObject._retn();
1268
1269   // Create the Path
1270   Handle(GEOM_Object) anObject = GetOperations()->RestorePath(aShape, aBase1, aBase2);
1271   if (!GetOperations()->IsDone() || anObject.IsNull())
1272     return aGEOMObject._retn();
1273
1274   return GetObject(anObject);
1275 }
1276
1277 //=============================================================================
1278 /*!
1279  *  RestorePathEdges
1280  */
1281 //=============================================================================
1282 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::RestorePathEdges
1283                  (GEOM::GEOM_Object_ptr theShape,
1284                   const GEOM::ListOfGO& theBase1,
1285                   const GEOM::ListOfGO& theBase2)
1286 {
1287   GEOM::GEOM_Object_var aGEOMObject;
1288
1289   // Set a not done flag
1290   GetOperations()->SetNotDone();
1291
1292   // Get the reference objects
1293   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1294   if (aShape.IsNull()) return aGEOMObject._retn();
1295
1296   Handle(TColStd_HSequenceOfTransient) aSeqBases1 = new TColStd_HSequenceOfTransient;
1297   Handle(TColStd_HSequenceOfTransient) aSeqBases2 = new TColStd_HSequenceOfTransient;
1298
1299   int ind;
1300   int aNbBases1 = theBase1.length();
1301   int aNbBases2 = theBase2.length();
1302
1303   for (ind = 0; ind < aNbBases1; ind++) {
1304     Handle(GEOM_Object) aBase = GetObjectImpl(theBase1[ind]);
1305     if (!aBase.IsNull())
1306       aSeqBases1->Append(aBase);
1307   }
1308   for (ind = 0; ind < aNbBases2; ind++) {
1309     Handle(GEOM_Object) aBase = GetObjectImpl(theBase2[ind]);
1310     if (!aBase.IsNull())
1311       aSeqBases2->Append(aBase);
1312   }
1313
1314   if (!aSeqBases1->Length() || !aSeqBases2->Length())
1315     return aGEOMObject._retn();
1316
1317   // Create the Path
1318   Handle(GEOM_Object) anObject = GetOperations()->RestorePath(aShape, aSeqBases1, aSeqBases2);
1319   if (!GetOperations()->IsDone() || anObject.IsNull())
1320     return aGEOMObject._retn();
1321
1322   return GetObject(anObject);
1323 }