]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
Salome HOME
2698619b1eb410d30de462255c7c66438c08c1f2
[modules/geom.git] / src / GEOMImpl / GEOMImpl_I3DPrimOperations.cxx
1 // Copyright (C) 2007-2012  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.
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 #include <Standard_Stream.hxx>
23
24 #include <Basics_OCCTVersion.hxx>
25
26 #include <GEOMImpl_I3DPrimOperations.hxx>
27
28 #include "utilities.h"
29 #include <OpUtil.hxx>
30 #include <Utils_ExceptHandlers.hxx>
31
32 #include <TFunction_DriverTable.hxx>
33 #include <TFunction_Driver.hxx>
34 #include <TFunction_Logbook.hxx>
35 #include <TDF_Tool.hxx>
36
37 #include <GEOM_Function.hxx>
38 #include <GEOM_PythonDump.hxx>
39
40 #include <GEOMImpl_Types.hxx>
41
42 #include <GEOMImpl_BoxDriver.hxx>
43 #include <GEOMImpl_FaceDriver.hxx>
44 #include <GEOMImpl_DiskDriver.hxx>
45 #include <GEOMImpl_CylinderDriver.hxx>
46 #include <GEOMImpl_ConeDriver.hxx>
47 #include <GEOMImpl_SphereDriver.hxx>
48 #include <GEOMImpl_TorusDriver.hxx>
49 #include <GEOMImpl_PrismDriver.hxx>
50 #include <GEOMImpl_PipeDriver.hxx>
51 #include <GEOMImpl_PipePathDriver.hxx>
52 #include <GEOMImpl_RevolutionDriver.hxx>
53 #include <GEOMImpl_ShapeDriver.hxx>
54 #include <GEOMImpl_FillingDriver.hxx>
55 #include <GEOMImpl_ThruSectionsDriver.hxx>
56 #include <GEOMImpl_OffsetDriver.hxx>
57
58 #include <GEOMImpl_IBox.hxx>
59 #include <GEOMImpl_IFace.hxx>
60 #include <GEOMImpl_IDisk.hxx>
61 #include <GEOMImpl_ICylinder.hxx>
62 #include <GEOMImpl_ICone.hxx>
63 #include <GEOMImpl_ISphere.hxx>
64 #include <GEOMImpl_ITorus.hxx>
65 #include <GEOMImpl_IPrism.hxx>
66 #include <GEOMImpl_IPipe.hxx>
67 #include <GEOMImpl_IRevolution.hxx>
68 #include <GEOMImpl_IFilling.hxx>
69 #include <GEOMImpl_IThruSections.hxx>
70 #include <GEOMImpl_IPipeDiffSect.hxx>
71 #include <GEOMImpl_IPipeShellSect.hxx>
72 #include <GEOMImpl_IPipeBiNormal.hxx>
73 #include <GEOMImpl_IOffset.hxx>
74 #include <GEOMImpl_IPipePath.hxx>
75
76 #include <Precision.hxx>
77
78 #include <Standard_Failure.hxx>
79 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
80
81 //=============================================================================
82 /*!
83  *   constructor:
84  */
85 //=============================================================================
86 GEOMImpl_I3DPrimOperations::GEOMImpl_I3DPrimOperations (GEOM_Engine* theEngine, int theDocID)
87 : GEOM_IOperations(theEngine, theDocID)
88 {
89   MESSAGE("GEOMImpl_I3DPrimOperations::GEOMImpl_I3DPrimOperations");
90 }
91
92 //=============================================================================
93 /*!
94  *  destructor
95  */
96 //=============================================================================
97 GEOMImpl_I3DPrimOperations::~GEOMImpl_I3DPrimOperations()
98 {
99   MESSAGE("GEOMImpl_I3DPrimOperations::~GEOMImpl_I3DPrimOperations");
100 }
101
102
103 //=============================================================================
104 /*!
105  *  MakeBoxDXDYDZ
106  */
107 //=============================================================================
108 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxDXDYDZ (double theDX, double theDY, double theDZ)
109 {
110   SetErrorCode(KO);
111
112   //Add a new Box object
113   Handle(GEOM_Object) aBox = GetEngine()->AddObject(GetDocID(), GEOM_BOX);
114
115   //Add a new Box function with DX_DY_DZ parameters
116   Handle(GEOM_Function) aFunction = aBox->AddFunction(GEOMImpl_BoxDriver::GetID(), BOX_DX_DY_DZ);
117   if (aFunction.IsNull()) return NULL;
118
119   //Check if the function is set correctly
120   if (aFunction->GetDriverGUID() != GEOMImpl_BoxDriver::GetID()) return NULL;
121
122   GEOMImpl_IBox aBI (aFunction);
123
124   aBI.SetDX(theDX);
125   aBI.SetDY(theDY);
126   aBI.SetDZ(theDZ);
127
128   //Compute the box value
129   try {
130 #if OCC_VERSION_LARGE > 0x06010000
131     OCC_CATCH_SIGNALS;
132 #endif
133     if (!GetSolver()->ComputeFunction(aFunction)) {
134       SetErrorCode("Box driver failed");
135       return NULL;
136     }
137   }
138   catch (Standard_Failure) {
139     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
140     SetErrorCode(aFail->GetMessageString());
141     return NULL;
142   }
143
144   //Make a Python command
145   GEOM::TPythonDump(aFunction) << aBox << " = geompy.MakeBoxDXDYDZ("
146     << theDX << ", " << theDY << ", " << theDZ << ")";
147
148   SetErrorCode(OK);
149   return aBox;
150 }
151
152
153 //=============================================================================
154 /*!
155  *  MakeBoxTwoPnt
156  */
157 //=============================================================================
158 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxTwoPnt (Handle(GEOM_Object) thePnt1,
159                                                                Handle(GEOM_Object) thePnt2)
160 {
161   SetErrorCode(KO);
162
163   if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL;
164
165   //Add a new Box object
166   Handle(GEOM_Object) aBox = GetEngine()->AddObject(GetDocID(), GEOM_BOX);
167
168   //Add a new Box function for creation a box relatively to two points
169   Handle(GEOM_Function) aFunction = aBox->AddFunction(GEOMImpl_BoxDriver::GetID(), BOX_TWO_PNT);
170   if (aFunction.IsNull()) return NULL;
171
172   //Check if the function is set correctly
173   if (aFunction->GetDriverGUID() != GEOMImpl_BoxDriver::GetID()) return aBox;
174
175   GEOMImpl_IBox aBI (aFunction);
176
177   Handle(GEOM_Function) aRefFunction1 = thePnt1->GetLastFunction();
178   Handle(GEOM_Function) aRefFunction2 = thePnt2->GetLastFunction();
179
180   if (aRefFunction1.IsNull() || aRefFunction2.IsNull()) return aBox;
181
182   aBI.SetRef1(aRefFunction1);
183   aBI.SetRef2(aRefFunction2);
184
185   //Compute the Box value
186   try {
187 #if OCC_VERSION_LARGE > 0x06010000
188     OCC_CATCH_SIGNALS;
189 #endif
190     if (!GetSolver()->ComputeFunction(aFunction)) {
191       SetErrorCode("Box driver failed");
192       return NULL;
193     }
194   }
195   catch (Standard_Failure) {
196     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
197     SetErrorCode(aFail->GetMessageString());
198     return NULL;
199   }
200
201   //Make a Python command
202   GEOM::TPythonDump(aFunction) << aBox << " = geompy.MakeBoxTwoPnt("
203     << thePnt1 << ", " << thePnt2 << ")";
204
205   SetErrorCode(OK);
206   return aBox;
207 }
208
209 //=============================================================================
210 /*!
211  *  MakeFaceHW
212  */
213 //=============================================================================
214 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceHW (double theH, double theW, int theOrientation)
215 {
216   SetErrorCode(KO);
217
218   if (theH == 0 || theW == 0) return NULL;
219
220   //Add a new Face object
221   Handle(GEOM_Object) aFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
222
223   //Add a new Box function for creation a box relatively to two points
224   Handle(GEOM_Function) aFunction = aFace->AddFunction(GEOMImpl_FaceDriver::GetID(), FACE_H_W);
225   if (aFunction.IsNull()) return NULL;
226
227   //Check if the function is set correctly
228   if (aFunction->GetDriverGUID() != GEOMImpl_FaceDriver::GetID()) return aFace;
229
230   GEOMImpl_IFace aFI (aFunction);
231
232   aFI.SetH(theH);
233   aFI.SetW(theW);
234   aFI.SetOrientation(theOrientation);
235
236   //Compute the Face
237   try {
238 #if OCC_VERSION_LARGE > 0x06010000
239     OCC_CATCH_SIGNALS;
240 #endif
241     if (!GetSolver()->ComputeFunction(aFunction)) {
242       SetErrorCode("Face driver failed");
243       return NULL;
244     }
245   }
246   catch (Standard_Failure) {
247     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
248     SetErrorCode(aFail->GetMessageString());
249     return NULL;
250   }
251
252   //Make a Python command
253   GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFaceHW("
254     << theH << ", " << theW << ", " << theOrientation << ")";
255
256   SetErrorCode(OK);
257   return aFace;
258 }
259
260 //=============================================================================
261 /*!
262  *  MakeFaceObjHW
263  */
264 //=============================================================================
265 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceObjHW (Handle(GEOM_Object) theObj,
266                                                                double theH, double theW)
267 {
268   SetErrorCode(KO);
269
270   if (theObj.IsNull()) return NULL;
271
272   //Add a new Face object
273   Handle(GEOM_Object) aFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
274
275   //Add a new Box function for creation a box relatively to two points
276   Handle(GEOM_Function) aFunction = aFace->AddFunction(GEOMImpl_FaceDriver::GetID(), FACE_OBJ_H_W);
277   if (aFunction.IsNull()) return NULL;
278
279   //Check if the function is set correctly
280   if (aFunction->GetDriverGUID() != GEOMImpl_FaceDriver::GetID()) return aFace;
281
282   GEOMImpl_IFace aFI (aFunction);
283
284   Handle(GEOM_Function) aRefFunction1 = theObj->GetLastFunction();
285
286   if (aRefFunction1.IsNull())
287     return aFace;
288
289   aFI.SetRef1(aRefFunction1);
290   aFI.SetH(theH);
291   aFI.SetW(theW);
292
293   //Compute the Face
294   try {
295 #if OCC_VERSION_LARGE > 0x06010000
296     OCC_CATCH_SIGNALS;
297 #endif
298     if (!GetSolver()->ComputeFunction(aFunction)) {
299       SetErrorCode("Face driver failed");
300       return NULL;
301     }
302   }
303   catch (Standard_Failure) {
304     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
305     SetErrorCode(aFail->GetMessageString());
306     return NULL;
307   }
308
309   //Make a Python command
310   GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFaceObjHW("
311     << theObj << ", " << theH << ", " << theW << ")";
312
313   SetErrorCode(OK);
314   return aFace;
315 }
316
317 //=============================================================================
318 /*!
319  *  MakeDiskPntVecR
320  */
321 //=============================================================================
322 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskPntVecR
323       (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, double theR)
324 {
325   SetErrorCode(KO);
326
327   if (thePnt.IsNull() || theVec.IsNull()) return NULL;
328
329   //Add a new Disk object
330   Handle(GEOM_Object) aDisk = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
331
332   //Add a new Disk function for creation a disk relatively to point and vector
333   Handle(GEOM_Function) aFunction =
334     aDisk->AddFunction(GEOMImpl_DiskDriver::GetID(), DISK_PNT_VEC_R);
335   if (aFunction.IsNull()) return NULL;
336
337   //Check if the function is set correctly
338   if (aFunction->GetDriverGUID() != GEOMImpl_DiskDriver::GetID()) return NULL;
339
340   GEOMImpl_IDisk aCI (aFunction);
341
342   Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
343   Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
344
345   if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
346
347   aCI.SetCenter(aRefPnt);
348   aCI.SetVector(aRefVec);
349   aCI.SetRadius(theR);
350
351   //Compute the Disk value
352   try {
353 #if OCC_VERSION_LARGE > 0x06010000
354     OCC_CATCH_SIGNALS;
355 #endif
356     if (!GetSolver()->ComputeFunction(aFunction)) {
357       SetErrorCode("Disk driver failed");
358       return NULL;
359     }
360   }
361   catch (Standard_Failure) {
362     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
363     SetErrorCode(aFail->GetMessageString());
364     return NULL;
365   }
366
367   //Make a Python command
368   GEOM::TPythonDump(aFunction) << aDisk << " = geompy.MakeDiskPntVecR("
369     << thePnt << ", " << theVec << ", " << theR << ")";
370
371   SetErrorCode(OK);
372   return aDisk;
373 }
374
375 //=============================================================================
376 /*!
377  *  MakeDiskThreePnt
378  */
379 //=============================================================================
380 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskThreePnt (Handle(GEOM_Object) thePnt1,
381                                                                   Handle(GEOM_Object) thePnt2,
382                                                                   Handle(GEOM_Object) thePnt3)
383 {
384   SetErrorCode(KO);
385
386   if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
387
388   //Add a new Disk object
389   Handle(GEOM_Object) aDisk = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
390
391   //Add a new Disk function for creation a disk relatively to three points
392   Handle(GEOM_Function) aFunction =
393     aDisk->AddFunction(GEOMImpl_DiskDriver::GetID(), DISK_THREE_PNT);
394   if (aFunction.IsNull()) return NULL;
395
396   //Check if the function is set correctly
397   if (aFunction->GetDriverGUID() != GEOMImpl_DiskDriver::GetID()) return NULL;
398
399   GEOMImpl_IDisk aCI (aFunction);
400
401   Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
402   Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
403   Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
404
405   if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
406
407   aCI.SetPoint1(aRefPnt1);
408   aCI.SetPoint2(aRefPnt2);
409   aCI.SetPoint3(aRefPnt3);
410
411   //Compute the Disk value
412   try {
413 #if OCC_VERSION_LARGE > 0x06010000
414     OCC_CATCH_SIGNALS;
415 #endif
416     if (!GetSolver()->ComputeFunction(aFunction)) {
417       SetErrorCode("Disk driver failed");
418       return NULL;
419     }
420   }
421   catch (Standard_Failure) {
422     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
423     SetErrorCode(aFail->GetMessageString());
424     return NULL;
425   }
426
427   //Make a Python command
428   GEOM::TPythonDump(aFunction) << aDisk << " = geompy.MakeDiskThreePnt("
429     << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
430
431   SetErrorCode(OK);
432   return aDisk;
433 }
434
435 //=============================================================================
436 /*!
437  *  MakeDiskR
438  */
439 //=============================================================================
440 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskR (double theR, int theOrientation)
441 {
442   SetErrorCode(KO);
443
444   if (theR == 0 ) return NULL;
445
446   //Add a new Disk object
447   Handle(GEOM_Object) aDisk = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
448
449   //Add a new Box function for creation a box relatively to two points
450   Handle(GEOM_Function) aFunction = aDisk->AddFunction(GEOMImpl_DiskDriver::GetID(), DISK_R);
451   if (aFunction.IsNull()) return NULL;
452
453   //Check if the function is set correctly
454   if (aFunction->GetDriverGUID() != GEOMImpl_DiskDriver::GetID()) return aDisk;
455
456   GEOMImpl_IDisk aDI (aFunction);
457
458   aDI.SetRadius(theR);
459   aDI.SetOrientation(theOrientation);
460
461   //Compute the Disk
462   try {
463 #if OCC_VERSION_LARGE > 0x06010000
464     OCC_CATCH_SIGNALS;
465 #endif
466     if (!GetSolver()->ComputeFunction(aFunction)) {
467       SetErrorCode("Disk driver failed");
468       return NULL;
469     }
470   }
471   catch (Standard_Failure) {
472     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
473     SetErrorCode(aFail->GetMessageString());
474     return NULL;
475   }
476
477   //Make a Python command
478   GEOM::TPythonDump(aFunction) << aDisk << " = geompy.MakeDiskR("
479     << theR << ", " << theOrientation << ")";
480
481   SetErrorCode(OK);
482   return aDisk;
483 }
484
485 //=============================================================================
486 /*!
487  *  MakeCylinderRH
488  */
489 //=============================================================================
490 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, double theH)
491 {
492   SetErrorCode(KO);
493
494   //Add a new Cylinder object
495   Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
496
497   //Add a new Cylinder function with R and H parameters
498   Handle(GEOM_Function) aFunction = aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_R_H);
499   if (aFunction.IsNull()) return NULL;
500
501   //Check if the function is set correctly
502   if (aFunction->GetDriverGUID() != GEOMImpl_CylinderDriver::GetID()) return NULL;
503
504   GEOMImpl_ICylinder aCI (aFunction);
505
506   aCI.SetR(theR);
507   aCI.SetH(theH);
508
509   //Compute the Cylinder value
510   try {
511 #if OCC_VERSION_LARGE > 0x06010000
512     OCC_CATCH_SIGNALS;
513 #endif
514     if (!GetSolver()->ComputeFunction(aFunction)) {
515       SetErrorCode("Cylinder driver failed");
516       return NULL;
517     }
518   }
519   catch (Standard_Failure) {
520     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
521     SetErrorCode(aFail->GetMessageString());
522     return NULL;
523   }
524
525   //Make a Python command
526   GEOM::TPythonDump(aFunction) << aCylinder
527     << " = geompy.MakeCylinderRH(" << theR << ", " << theH << ")";
528
529   SetErrorCode(OK);
530   return aCylinder;
531 }
532
533
534 //=============================================================================
535 /*!
536  *  MakeCylinderPntVecRH
537  */
538 //=============================================================================
539 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt,
540                                                                       Handle(GEOM_Object) theVec,
541                                                                       double theR, double theH)
542 {
543   SetErrorCode(KO);
544
545   if (thePnt.IsNull() || theVec.IsNull()) return NULL;
546
547   //Add a new Cylinder object
548   Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
549
550   //Add a new Cylinder function for creation a cylinder relatively to point and vector
551   Handle(GEOM_Function) aFunction =
552     aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_PNT_VEC_R_H);
553   if (aFunction.IsNull()) return NULL;
554
555   //Check if the function is set correctly
556   if (aFunction->GetDriverGUID() != GEOMImpl_CylinderDriver::GetID()) return NULL;
557
558   GEOMImpl_ICylinder aCI (aFunction);
559
560   Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
561   Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
562
563   if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
564
565   aCI.SetPoint(aRefPnt);
566   aCI.SetVector(aRefVec);
567   aCI.SetR(theR);
568   aCI.SetH(theH);
569
570   //Compute the Cylinder value
571   try {
572 #if OCC_VERSION_LARGE > 0x06010000
573     OCC_CATCH_SIGNALS;
574 #endif
575     if (!GetSolver()->ComputeFunction(aFunction)) {
576       SetErrorCode("Cylinder driver failed");
577       return NULL;
578     }
579   }
580   catch (Standard_Failure) {
581     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
582     SetErrorCode(aFail->GetMessageString());
583     return NULL;
584   }
585
586   //Make a Python command
587   GEOM::TPythonDump(aFunction) << aCylinder << " = geompy.MakeCylinder("
588     << thePnt << ", " << theVec << ", " << theR << ", " << theH << ")";
589
590   SetErrorCode(OK);
591   return aCylinder;
592 }
593
594
595 //=============================================================================
596 /*!
597  *  MakeConeR1R2H
598  */
599 //=============================================================================
600 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConeR1R2H (double theR1, double theR2,
601                                                                double theH)
602 {
603   SetErrorCode(KO);
604
605   //Add a new Cone object
606   Handle(GEOM_Object) aCone = GetEngine()->AddObject(GetDocID(), GEOM_CONE);
607
608   //Add a new Cone function with R and H parameters
609   Handle(GEOM_Function) aFunction =
610     aCone->AddFunction(GEOMImpl_ConeDriver::GetID(), CONE_R1_R2_H);
611   if (aFunction.IsNull()) return NULL;
612
613   //Check if the function is set correctly
614   if (aFunction->GetDriverGUID() != GEOMImpl_ConeDriver::GetID()) return NULL;
615
616   GEOMImpl_ICone aCI (aFunction);
617
618   aCI.SetR1(theR1);
619   aCI.SetR2(theR2);
620   aCI.SetH(theH);
621
622   //Compute the Cone value
623   try {
624 #if OCC_VERSION_LARGE > 0x06010000
625     OCC_CATCH_SIGNALS;
626 #endif
627     if (!GetSolver()->ComputeFunction(aFunction)) {
628       SetErrorCode("Cone driver failed");
629       return NULL;
630     }
631   }
632   catch (Standard_Failure) {
633     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
634     SetErrorCode(aFail->GetMessageString());
635     return NULL;
636   }
637
638   //Make a Python command
639   GEOM::TPythonDump(aFunction) << aCone << " = geompy.MakeConeR1R2H("
640     << theR1 << ", " << theR2 << ", " << theH << ")";
641
642   SetErrorCode(OK);
643   return aCone;
644 }
645
646
647 //=============================================================================
648 /*!
649  *  MakeConePntVecR1R2H
650  */
651 //=============================================================================
652 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConePntVecR1R2H (Handle(GEOM_Object) thePnt,
653                                                                      Handle(GEOM_Object) theVec,
654                                                                      double theR1, double theR2,
655                                                                      double theH)
656 {
657   SetErrorCode(KO);
658
659   if (thePnt.IsNull() || theVec.IsNull()) return NULL;
660
661   //Add a new Cone object
662   Handle(GEOM_Object) aCone = GetEngine()->AddObject(GetDocID(), GEOM_CONE);
663
664   //Add a new Cone function for creation a cone relatively to point and vector
665   Handle(GEOM_Function) aFunction =
666     aCone->AddFunction(GEOMImpl_ConeDriver::GetID(), CONE_PNT_VEC_R1_R2_H);
667   if (aFunction.IsNull()) return NULL;
668
669   //Check if the function is set correctly
670   if (aFunction->GetDriverGUID() != GEOMImpl_ConeDriver::GetID()) return NULL;
671
672   GEOMImpl_ICone aCI (aFunction);
673
674   Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
675   Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
676
677   if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
678
679   aCI.SetPoint(aRefPnt);
680   aCI.SetVector(aRefVec);
681   aCI.SetR1(theR1);
682   aCI.SetR2(theR2);
683   aCI.SetH(theH);
684
685   //Compute the Cone value
686   try {
687 #if OCC_VERSION_LARGE > 0x06010000
688     OCC_CATCH_SIGNALS;
689 #endif
690     if (!GetSolver()->ComputeFunction(aFunction)) {
691       SetErrorCode("Cone driver failed");
692       return NULL;
693     }
694   }
695   catch (Standard_Failure) {
696     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
697     SetErrorCode(aFail->GetMessageString());
698     return NULL;
699   }
700
701   //Make a Python command
702   GEOM::TPythonDump(aFunction) << aCone << " = geompy.MakeCone(" << thePnt
703     << ", " << theVec << ", " << theR1 << ", " << theR2 << ", " << theH << ")";
704
705   SetErrorCode(OK);
706   return aCone;
707 }
708
709
710 //=============================================================================
711 /*!
712  *  MakeSphereR
713  */
714 //=============================================================================
715 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSphereR (double theR)
716 {
717   SetErrorCode(KO);
718
719   //Add a new Sphere object
720   Handle(GEOM_Object) aSphere = GetEngine()->AddObject(GetDocID(), GEOM_SPHERE);
721
722   //Add a new Sphere function with R parameter
723   Handle(GEOM_Function) aFunction = aSphere->AddFunction(GEOMImpl_SphereDriver::GetID(), SPHERE_R);
724   if (aFunction.IsNull()) return NULL;
725
726   //Check if the function is set correctly
727   if (aFunction->GetDriverGUID() != GEOMImpl_SphereDriver::GetID()) return NULL;
728
729   GEOMImpl_ISphere aCI (aFunction);
730
731   aCI.SetR(theR);
732
733   //Compute the Sphere value
734   try {
735 #if OCC_VERSION_LARGE > 0x06010000
736     OCC_CATCH_SIGNALS;
737 #endif
738     if (!GetSolver()->ComputeFunction(aFunction)) {
739       SetErrorCode("Sphere driver failed");
740       return NULL;
741     }
742   }
743   catch (Standard_Failure) {
744     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
745     SetErrorCode(aFail->GetMessageString());
746     return NULL;
747   }
748
749   //Make a Python command
750   GEOM::TPythonDump(aFunction) << aSphere << " = geompy.MakeSphereR(" << theR << ")";
751
752   SetErrorCode(OK);
753   return aSphere;
754 }
755
756
757 //=============================================================================
758 /*!
759  *  MakeSpherePntR
760  */
761 //=============================================================================
762 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSpherePntR (Handle(GEOM_Object) thePnt,
763                                                                 double theR)
764 {
765   SetErrorCode(KO);
766
767   if (thePnt.IsNull()) return NULL;
768
769   //Add a new Point object
770   Handle(GEOM_Object) aSphere = GetEngine()->AddObject(GetDocID(), GEOM_SPHERE);
771
772   //Add a new Sphere function for creation a sphere relatively to point
773   Handle(GEOM_Function) aFunction = aSphere->AddFunction(GEOMImpl_SphereDriver::GetID(), SPHERE_PNT_R);
774   if (aFunction.IsNull()) return NULL;
775
776   //Check if the function is set correctly
777   if (aFunction->GetDriverGUID() != GEOMImpl_SphereDriver::GetID()) return NULL;
778
779   GEOMImpl_ISphere aCI (aFunction);
780
781   Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
782
783   if (aRefPnt.IsNull()) return NULL;
784
785   aCI.SetPoint(aRefPnt);
786   aCI.SetR(theR);
787
788   //Compute the Sphere value
789   try {
790 #if OCC_VERSION_LARGE > 0x06010000
791     OCC_CATCH_SIGNALS;
792 #endif
793     if (!GetSolver()->ComputeFunction(aFunction)) {
794       SetErrorCode("Sphere driver failed");
795       return NULL;
796     }
797   }
798   catch (Standard_Failure) {
799     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
800     SetErrorCode(aFail->GetMessageString());
801     return NULL;
802   }
803
804   //Make a Python command
805   GEOM::TPythonDump(aFunction) << aSphere
806     << " = geompy.MakeSpherePntR(" << thePnt << ", " << theR << ")";
807
808   SetErrorCode(OK);
809   return aSphere;
810 }
811
812
813 //=============================================================================
814 /*!
815  *  MakeTorusRR
816  */
817 //=============================================================================
818 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusRR
819                                            (double theRMajor, double theRMinor)
820 {
821   SetErrorCode(KO);
822
823   //Add a new Torus object
824   Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_TORUS);
825
826   //Add a new Torus function
827   Handle(GEOM_Function) aFunction =
828     anEll->AddFunction(GEOMImpl_TorusDriver::GetID(), TORUS_RR);
829   if (aFunction.IsNull()) return NULL;
830
831   //Check if the function is set correctly
832   if (aFunction->GetDriverGUID() != GEOMImpl_TorusDriver::GetID()) return NULL;
833
834   GEOMImpl_ITorus aCI (aFunction);
835
836   aCI.SetRMajor(theRMajor);
837   aCI.SetRMinor(theRMinor);
838
839   //Compute the Torus value
840   try {
841 #if OCC_VERSION_LARGE > 0x06010000
842     OCC_CATCH_SIGNALS;
843 #endif
844     if (!GetSolver()->ComputeFunction(aFunction)) {
845       SetErrorCode("Torus driver failed");
846       return NULL;
847     }
848   }
849   catch (Standard_Failure) {
850     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
851     SetErrorCode(aFail->GetMessageString());
852     return NULL;
853   }
854
855   //Make a Python command
856   GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeTorusRR("
857     << theRMajor << ", " << theRMinor << ")";
858
859   SetErrorCode(OK);
860   return anEll;
861 }
862
863 //=============================================================================
864 /*!
865  *  MakeTorusPntVecRR
866  */
867 //=============================================================================
868 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusPntVecRR
869                        (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec,
870                         double theRMajor, double theRMinor)
871 {
872   SetErrorCode(KO);
873
874   if (thePnt.IsNull() || theVec.IsNull()) return NULL;
875
876   //Add a new Torus object
877   Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_TORUS);
878
879   //Add a new Torus function
880   Handle(GEOM_Function) aFunction =
881     anEll->AddFunction(GEOMImpl_TorusDriver::GetID(), TORUS_PNT_VEC_RR);
882   if (aFunction.IsNull()) return NULL;
883
884   //Check if the function is set correctly
885   if (aFunction->GetDriverGUID() != GEOMImpl_TorusDriver::GetID()) return NULL;
886
887   GEOMImpl_ITorus aCI (aFunction);
888
889   Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
890   Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
891
892   if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
893
894   aCI.SetCenter(aRefPnt);
895   aCI.SetVector(aRefVec);
896   aCI.SetRMajor(theRMajor);
897   aCI.SetRMinor(theRMinor);
898
899   //Compute the Torus value
900   try {
901 #if OCC_VERSION_LARGE > 0x06010000
902     OCC_CATCH_SIGNALS;
903 #endif
904     if (!GetSolver()->ComputeFunction(aFunction)) {
905       SetErrorCode("Torus driver failed");
906       return NULL;
907     }
908   }
909   catch (Standard_Failure) {
910     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
911     SetErrorCode(aFail->GetMessageString());
912     return NULL;
913   }
914
915   //Make a Python command
916   GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeTorus(" << thePnt
917     << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")";
918
919   SetErrorCode(OK);
920   return anEll;
921 }
922
923
924 //=============================================================================
925 /*!
926  *  MakePrismVecH
927  */
928 //=============================================================================
929 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Object) theBase,
930                                                                Handle(GEOM_Object) theVec,
931                                                                double theH, double theScaleFactor)
932 {
933   SetErrorCode(KO);
934
935   if (theBase.IsNull() || theVec.IsNull()) return NULL;
936
937   //Add a new Prism object
938   Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
939
940   //Add a new Prism function for creation a Prism relatively to vector
941   Handle(GEOM_Function) aFunction =
942     aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_VEC_H);
943   if (aFunction.IsNull()) return NULL;
944
945   //Check if the function is set correctly
946   if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
947
948   GEOMImpl_IPrism aCI (aFunction);
949
950   Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
951   Handle(GEOM_Function) aRefVec  = theVec->GetLastFunction();
952
953   if (aRefBase.IsNull() || aRefVec.IsNull()) return NULL;
954
955   aCI.SetBase(aRefBase);
956   aCI.SetVector(aRefVec);
957   aCI.SetH(theH);
958   aCI.SetScale(theScaleFactor);
959
960   //Compute the Prism value
961   try {
962 #if OCC_VERSION_LARGE > 0x06010000
963     OCC_CATCH_SIGNALS;
964 #endif
965     if (!GetSolver()->ComputeFunction(aFunction)) {
966       //SetErrorCode("Prism driver failed");
967       SetErrorCode("Extrusion can not be created, check input data");
968       return NULL;
969     }
970   }
971   catch (Standard_Failure) {
972     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
973     SetErrorCode(aFail->GetMessageString());
974     return NULL;
975   }
976
977   //Make a Python command
978   GEOM::TPythonDump pd (aFunction);
979   pd << aPrism << " = geompy.MakePrismVecH(" << theBase << ", " << theVec << ", " << theH;
980   if (theScaleFactor > Precision::Confusion())
981     pd << ", " << theScaleFactor << ")";
982   else
983     pd << ")";
984
985   SetErrorCode(OK);
986   return aPrism;
987 }
988
989 //=============================================================================
990 /*!
991  *  MakePrismVecH2Ways
992  */
993 //=============================================================================
994 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH2Ways (Handle(GEOM_Object) theBase,
995                                                                     Handle(GEOM_Object) theVec,
996                                                                     double theH)
997 {
998   SetErrorCode(KO);
999
1000   if (theBase.IsNull() || theVec.IsNull()) return NULL;
1001
1002   //Add a new Prism object
1003   Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
1004
1005   //Add a new Prism function for creation a Prism relatively to vector
1006   Handle(GEOM_Function) aFunction =
1007     aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_VEC_H_2WAYS);
1008   if (aFunction.IsNull()) return NULL;
1009
1010   //Check if the function is set correctly
1011   if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
1012
1013   GEOMImpl_IPrism aCI (aFunction);
1014
1015   Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
1016   Handle(GEOM_Function) aRefVec  = theVec->GetLastFunction();
1017
1018   if (aRefBase.IsNull() || aRefVec.IsNull()) return NULL;
1019
1020   aCI.SetBase(aRefBase);
1021   aCI.SetVector(aRefVec);
1022   aCI.SetH(theH);
1023
1024   //Compute the Prism value
1025   try {
1026 #if OCC_VERSION_LARGE > 0x06010000
1027     OCC_CATCH_SIGNALS;
1028 #endif
1029     if (!GetSolver()->ComputeFunction(aFunction)) {
1030       //SetErrorCode("Prism driver failed");
1031       SetErrorCode("Extrusion can not be created, check input data");
1032       return NULL;
1033     }
1034   }
1035   catch (Standard_Failure) {
1036     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1037     SetErrorCode(aFail->GetMessageString());
1038     return NULL;
1039   }
1040
1041   //Make a Python command
1042   GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismVecH2Ways("
1043     << theBase << ", " << theVec << ", " << theH << ")";
1044
1045   SetErrorCode(OK);
1046   return aPrism;
1047 }
1048
1049 //=============================================================================
1050 /*!
1051  *  MakePrismTwoPnt
1052  */
1053 //=============================================================================
1054 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt
1055        (Handle(GEOM_Object) theBase,
1056         Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2,
1057         double theScaleFactor)
1058 {
1059   SetErrorCode(KO);
1060
1061   if (theBase.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
1062
1063   //Add a new Prism object
1064   Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
1065
1066   //Add a new Prism function for creation a Prism relatively to two points
1067   Handle(GEOM_Function) aFunction =
1068     aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_TWO_PNT);
1069   if (aFunction.IsNull()) return NULL;
1070
1071   //Check if the function is set correctly
1072   if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
1073
1074   GEOMImpl_IPrism aCI (aFunction);
1075
1076   Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
1077   Handle(GEOM_Function) aRefPnt1 = thePoint1->GetLastFunction();
1078   Handle(GEOM_Function) aRefPnt2 = thePoint2->GetLastFunction();
1079
1080   if (aRefBase.IsNull() || aRefPnt1.IsNull() || aRefPnt2.IsNull()) return NULL;
1081
1082   aCI.SetBase(aRefBase);
1083   aCI.SetFirstPoint(aRefPnt1);
1084   aCI.SetLastPoint(aRefPnt2);
1085   aCI.SetScale(theScaleFactor);
1086
1087   //Compute the Prism value
1088   try {
1089 #if OCC_VERSION_LARGE > 0x06010000
1090     OCC_CATCH_SIGNALS;
1091 #endif
1092     if (!GetSolver()->ComputeFunction(aFunction)) {
1093       //SetErrorCode("Prism driver failed");
1094       SetErrorCode("Extrusion can not be created, check input data");
1095       return NULL;
1096     }
1097   }
1098   catch (Standard_Failure) {
1099     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1100     SetErrorCode(aFail->GetMessageString());
1101     return NULL;
1102   }
1103
1104   //Make a Python command
1105   GEOM::TPythonDump pd (aFunction);
1106   pd << aPrism << " = geompy.MakePrism(" << theBase << ", " << thePoint1 << ", " << thePoint2;
1107   if (theScaleFactor > Precision::Confusion())
1108     pd << ", " << theScaleFactor << ")";
1109   else
1110     pd << ")";
1111
1112   SetErrorCode(OK);
1113   return aPrism;
1114 }
1115
1116 //=============================================================================
1117 /*!
1118  *  MakePrismTwoPnt2Ways
1119  */
1120 //=============================================================================
1121 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt2Ways
1122        (Handle(GEOM_Object) theBase,
1123         Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
1124 {
1125   SetErrorCode(KO);
1126
1127   if (theBase.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
1128
1129   //Add a new Prism object
1130   Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
1131
1132   //Add a new Prism function for creation a Prism relatively to two points
1133   Handle(GEOM_Function) aFunction =
1134     aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_TWO_PNT_2WAYS);
1135   if (aFunction.IsNull()) return NULL;
1136
1137   //Check if the function is set correctly
1138   if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
1139
1140   GEOMImpl_IPrism aCI (aFunction);
1141
1142   Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
1143   Handle(GEOM_Function) aRefPnt1 = thePoint1->GetLastFunction();
1144   Handle(GEOM_Function) aRefPnt2 = thePoint2->GetLastFunction();
1145
1146   if (aRefBase.IsNull() || aRefPnt1.IsNull() || aRefPnt2.IsNull()) return NULL;
1147
1148   aCI.SetBase(aRefBase);
1149   aCI.SetFirstPoint(aRefPnt1);
1150   aCI.SetLastPoint(aRefPnt2);
1151
1152   //Compute the Prism value
1153   try {
1154 #if OCC_VERSION_LARGE > 0x06010000
1155     OCC_CATCH_SIGNALS;
1156 #endif
1157     if (!GetSolver()->ComputeFunction(aFunction)) {
1158       //SetErrorCode("Prism driver failed");
1159       SetErrorCode("Extrusion can not be created, check input data");
1160       return NULL;
1161     }
1162   }
1163   catch (Standard_Failure) {
1164     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1165     SetErrorCode(aFail->GetMessageString());
1166     return NULL;
1167   }
1168
1169   //Make a Python command
1170   GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrism2Ways("
1171     << theBase << ", " << thePoint1 << ", " << thePoint2 << ")";
1172
1173   SetErrorCode(OK);
1174   return aPrism;
1175 }
1176
1177 //=============================================================================
1178 /*!
1179  *  MakePrismDXDYDZ
1180  */
1181 //=============================================================================
1182 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ
1183        (Handle(GEOM_Object) theBase, double theDX, double theDY, double theDZ,
1184         double theScaleFactor)
1185 {
1186   SetErrorCode(KO);
1187
1188   if (theBase.IsNull()) return NULL;
1189
1190   //Add a new Prism object
1191   Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
1192
1193   //Add a new Prism function for creation a Prism by DXDYDZ
1194   Handle(GEOM_Function) aFunction =
1195     aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_DXDYDZ);
1196   if (aFunction.IsNull()) return NULL;
1197
1198   //Check if the function is set correctly
1199   if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
1200
1201   GEOMImpl_IPrism aCI (aFunction);
1202
1203   Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
1204
1205   if (aRefBase.IsNull()) return NULL;
1206
1207   aCI.SetBase(aRefBase);
1208   aCI.SetDX(theDX);
1209   aCI.SetDY(theDY);
1210   aCI.SetDZ(theDZ);
1211   aCI.SetScale(theScaleFactor);
1212
1213   //Compute the Prism value
1214   try {
1215 #if OCC_VERSION_LARGE > 0x06010000
1216     OCC_CATCH_SIGNALS;
1217 #endif
1218     if (!GetSolver()->ComputeFunction(aFunction)) {
1219       SetErrorCode("Extrusion can not be created, check input data");
1220       return NULL;
1221     }
1222   }
1223   catch (Standard_Failure) {
1224     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1225     SetErrorCode(aFail->GetMessageString());
1226     return NULL;
1227   }
1228
1229   //Make a Python command
1230   GEOM::TPythonDump pd (aFunction);
1231   pd << aPrism << " = geompy.MakePrismDXDYDZ("
1232      << theBase << ", " << theDX << ", " << theDY << ", " << theDZ;
1233   if (theScaleFactor > Precision::Confusion())
1234     pd << ", " << theScaleFactor << ")";
1235   else
1236     pd << ")";
1237
1238   SetErrorCode(OK);
1239   return aPrism;
1240 }
1241
1242 //=============================================================================
1243 /*!
1244  *  MakePrismDXDYDZ_2WAYS
1245  */
1246 //=============================================================================
1247 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ2Ways
1248        (Handle(GEOM_Object) theBase, double theDX, double theDY, double theDZ)
1249 {
1250   SetErrorCode(KO);
1251
1252   if (theBase.IsNull()) return NULL;
1253
1254   //Add a new Prism object
1255   Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
1256
1257   //Add a new Prism function for creation a Prism by DXDYDZ
1258   Handle(GEOM_Function) aFunction =
1259     aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_DXDYDZ_2WAYS);
1260   if (aFunction.IsNull()) return NULL;
1261
1262   //Check if the function is set correctly
1263   if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
1264
1265   GEOMImpl_IPrism aCI (aFunction);
1266
1267   Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
1268
1269   if (aRefBase.IsNull()) return NULL;
1270
1271   aCI.SetBase(aRefBase);
1272   aCI.SetDX(theDX);
1273   aCI.SetDY(theDY);
1274   aCI.SetDZ(theDZ);
1275
1276   //Compute the Prism value
1277   try {
1278 #if OCC_VERSION_LARGE > 0x06010000
1279     OCC_CATCH_SIGNALS;
1280 #endif
1281     if (!GetSolver()->ComputeFunction(aFunction)) {
1282       SetErrorCode("Extrusion can not be created, check input data");
1283       return NULL;
1284     }
1285   }
1286   catch (Standard_Failure) {
1287     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1288     SetErrorCode(aFail->GetMessageString());
1289     return NULL;
1290   }
1291
1292   //Make a Python command
1293   GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismDXDYDZ2Ways("
1294     << theBase << ", " << theDX << ", " << theDY << ", " << theDZ << ")";
1295
1296   SetErrorCode(OK);
1297   return aPrism;
1298 }
1299
1300 //=============================================================================
1301 /*!
1302  *  MakeDraftPrism
1303  */
1304 //=============================================================================
1305 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDraftPrism
1306        (Handle(GEOM_Object) theInitShape ,Handle(GEOM_Object) theBase, double theHeight, double theAngle, bool theFuse)
1307 {
1308   SetErrorCode(KO);
1309
1310   if (theBase.IsNull() || theInitShape.IsNull()) return NULL;
1311
1312   Handle(GEOM_Object) aPrism = NULL;
1313   
1314   if ( theFuse )
1315   {
1316     //Add a new Extruded Boss object  
1317     aPrism = GetEngine()->AddObject(GetDocID(), GEOM_EXTRUDED_BOSS);
1318   }
1319   else
1320   { 
1321     //Add a new Extruded Cut object  
1322     aPrism = GetEngine()->AddObject(GetDocID(), GEOM_EXTRUDED_CUT);
1323   }
1324   
1325   //Add a new Prism function for the creation of a Draft Prism feature
1326   Handle(GEOM_Function) aFunction = 
1327     aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), DRAFT_PRISM_FEATURE);
1328   if (aFunction.IsNull()) return NULL;
1329   
1330   //Check if the function is set correctly
1331   if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
1332   
1333   GEOMImpl_IPrism aCI (aFunction);
1334
1335   Handle(GEOM_Function) aRefInit = theInitShape->GetLastFunction();
1336   Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
1337  
1338   if (aRefBase.IsNull() || aRefInit.IsNull()) return NULL;
1339   
1340   // Set parameters 
1341   aCI.SetBase(aRefBase);
1342   aCI.SetInitShape(aRefInit);
1343   aCI.SetH(theHeight);
1344   aCI.SetDraftAngle(theAngle);
1345   if ( theFuse )
1346     aCI.SetFuseFlag(1);
1347   else
1348     aCI.SetFuseFlag(0);
1349   
1350   //Compute the Draft Prism Feature value
1351   try {
1352 #if OCC_VERSION_LARGE > 0x06010000
1353     OCC_CATCH_SIGNALS;
1354 #endif
1355     if (!GetSolver()->ComputeFunction(aFunction)) {
1356       SetErrorCode("Extrusion can not be created, check input data");
1357       return NULL;
1358     }
1359   }
1360   catch (Standard_Failure) {
1361     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1362     SetErrorCode(aFail->GetMessageString());
1363     return NULL;
1364   }
1365   
1366   //Make a Python command
1367   if(theFuse)
1368   {
1369     GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakeExtrudedBoss("
1370       << theInitShape << ", " << theBase << ", " << theHeight << ", " << theAngle << ")";
1371   }
1372   else
1373   {   
1374     GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakeExtrudedCut("
1375       << theInitShape << ", " << theBase << ", " << theHeight << ", " << theAngle << ")";
1376   }
1377
1378   SetErrorCode(OK);
1379   return aPrism;
1380 }
1381
1382 //=============================================================================
1383 /*!
1384  *  MakePipe
1385  */
1386 //=============================================================================
1387 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipe (Handle(GEOM_Object) theBase,
1388                                                           Handle(GEOM_Object) thePath)
1389 {
1390   SetErrorCode(KO);
1391
1392   if (theBase.IsNull() || thePath.IsNull()) return NULL;
1393
1394   //Add a new Pipe object
1395   Handle(GEOM_Object) aPipe = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
1396
1397   //Add a new Pipe function
1398   Handle(GEOM_Function) aFunction =
1399     aPipe->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_BASE_PATH);
1400   if (aFunction.IsNull()) return NULL;
1401
1402   //Check if the function is set correctly
1403   if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return NULL;
1404
1405   GEOMImpl_IPipe aCI (aFunction);
1406
1407   Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
1408   Handle(GEOM_Function) aRefPath = thePath->GetLastFunction();
1409
1410   if (aRefBase.IsNull() || aRefPath.IsNull()) return NULL;
1411
1412   aCI.SetBase(aRefBase);
1413   aCI.SetPath(aRefPath);
1414
1415   //Compute the Pipe value
1416   try {
1417 #if OCC_VERSION_LARGE > 0x06010000
1418     OCC_CATCH_SIGNALS;
1419 #endif
1420     if (!GetSolver()->ComputeFunction(aFunction)) {
1421       SetErrorCode("Pipe driver failed");
1422       return NULL;
1423     }
1424   }
1425   catch (Standard_Failure) {
1426     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1427     SetErrorCode(aFail->GetMessageString());
1428     return NULL;
1429   }
1430
1431   //Make a Python command
1432   GEOM::TPythonDump(aFunction) << aPipe << " = geompy.MakePipe("
1433     << theBase << ", " << thePath << ")";
1434
1435   SetErrorCode(OK);
1436   return aPipe;
1437 }
1438
1439
1440 //=============================================================================
1441 /*!
1442  *  MakeRevolutionAxisAngle
1443  */
1444 //=============================================================================
1445 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle (Handle(GEOM_Object) theBase,
1446                                                                          Handle(GEOM_Object) theAxis,
1447                                                                          double theAngle)
1448 {
1449   SetErrorCode(KO);
1450
1451   if (theBase.IsNull() || theAxis.IsNull()) return NULL;
1452
1453   //Add a new Revolution object
1454   Handle(GEOM_Object) aRevolution = GetEngine()->AddObject(GetDocID(), GEOM_REVOLUTION);
1455
1456   //Add a new Revolution function for creation a revolution relatively to axis
1457   Handle(GEOM_Function) aFunction =
1458     aRevolution->AddFunction(GEOMImpl_RevolutionDriver::GetID(), REVOLUTION_BASE_AXIS_ANGLE);
1459   if (aFunction.IsNull()) return NULL;
1460
1461   //Check if the function is set correctly
1462   if (aFunction->GetDriverGUID() != GEOMImpl_RevolutionDriver::GetID()) return NULL;
1463
1464   GEOMImpl_IRevolution aCI (aFunction);
1465
1466   Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
1467   Handle(GEOM_Function) aRefAxis = theAxis->GetLastFunction();
1468
1469   if (aRefBase.IsNull() || aRefAxis.IsNull()) return NULL;
1470
1471   aCI.SetBase(aRefBase);
1472   aCI.SetAxis(aRefAxis);
1473   aCI.SetAngle(theAngle);
1474
1475   //Compute the Revolution value
1476   try {
1477 #if OCC_VERSION_LARGE > 0x06010000
1478     OCC_CATCH_SIGNALS;
1479 #endif
1480     if (!GetSolver()->ComputeFunction(aFunction)) {
1481       SetErrorCode("Revolution driver failed");
1482       return NULL;
1483     }
1484   }
1485   catch (Standard_Failure) {
1486     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1487     SetErrorCode(aFail->GetMessageString());
1488     return NULL;
1489   }
1490
1491   //Make a Python command
1492   GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution("
1493     << theBase << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1494   
1495   SetErrorCode(OK);
1496   return aRevolution;
1497 }
1498
1499 //=============================================================================
1500 /*!
1501  *  MakeRevolutionAxisAngle2Ways
1502  */
1503 //=============================================================================
1504 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways
1505                    (Handle(GEOM_Object) theBase, Handle(GEOM_Object) theAxis, double theAngle)
1506 {
1507   SetErrorCode(KO);
1508
1509   if (theBase.IsNull() || theAxis.IsNull()) return NULL;
1510
1511   //Add a new Revolution object
1512   Handle(GEOM_Object) aRevolution = GetEngine()->AddObject(GetDocID(), GEOM_REVOLUTION);
1513
1514   //Add a new Revolution function for creation a revolution relatively to axis
1515   Handle(GEOM_Function) aFunction =
1516     aRevolution->AddFunction(GEOMImpl_RevolutionDriver::GetID(), REVOLUTION_BASE_AXIS_ANGLE_2WAYS);
1517   if (aFunction.IsNull()) return NULL;
1518
1519   //Check if the function is set correctly
1520   if (aFunction->GetDriverGUID() != GEOMImpl_RevolutionDriver::GetID()) return NULL;
1521
1522   GEOMImpl_IRevolution aCI (aFunction);
1523
1524   Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
1525   Handle(GEOM_Function) aRefAxis = theAxis->GetLastFunction();
1526
1527   if (aRefBase.IsNull() || aRefAxis.IsNull()) return NULL;
1528
1529   aCI.SetBase(aRefBase);
1530   aCI.SetAxis(aRefAxis);
1531   aCI.SetAngle(theAngle);
1532
1533   //Compute the Revolution value
1534   try {
1535 #if OCC_VERSION_LARGE > 0x06010000
1536     OCC_CATCH_SIGNALS;
1537 #endif
1538     if (!GetSolver()->ComputeFunction(aFunction)) {
1539       SetErrorCode("Revolution driver failed");
1540       return NULL;
1541     }
1542   }
1543   catch (Standard_Failure) {
1544     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1545     SetErrorCode(aFail->GetMessageString());
1546     return NULL;
1547   }
1548
1549   //Make a Python command
1550   GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution2Ways("
1551     << theBase << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
1552
1553   SetErrorCode(OK);
1554   return aRevolution;
1555 }
1556
1557 //=============================================================================
1558 /*!
1559  *  MakeFilling
1560  */
1561 //=============================================================================
1562 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
1563        (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg,
1564         double theTol2D, double theTol3D, int theNbIter,
1565         int theMethod, bool isApprox)
1566 {
1567   SetErrorCode(KO);
1568
1569   if (theShape.IsNull()) return NULL;
1570
1571   //Add a new Filling object
1572   Handle(GEOM_Object) aFilling = GetEngine()->AddObject(GetDocID(), GEOM_FILLING);
1573
1574   //Add a new Filling function for creation a filling  from a compound
1575   Handle(GEOM_Function) aFunction = aFilling->AddFunction(GEOMImpl_FillingDriver::GetID(), BASIC_FILLING);
1576   if (aFunction.IsNull()) return NULL;
1577
1578   //Check if the function is set correctly
1579   if (aFunction->GetDriverGUID() != GEOMImpl_FillingDriver::GetID()) return NULL;
1580
1581   GEOMImpl_IFilling aFI (aFunction);
1582
1583   Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
1584
1585   if (aRefShape.IsNull()) return NULL;
1586
1587   aFI.SetShape(aRefShape);
1588   aFI.SetMinDeg(theMinDeg);
1589   aFI.SetMaxDeg(theMaxDeg);
1590   aFI.SetTol2D(theTol2D);
1591   aFI.SetTol3D(theTol3D);
1592   aFI.SetNbIter(theNbIter);
1593   aFI.SetApprox(isApprox);
1594   aFI.SetMethod(theMethod);
1595
1596   //Compute the Solid value
1597   try {
1598 #if OCC_VERSION_LARGE > 0x06010000
1599     OCC_CATCH_SIGNALS;
1600 #endif
1601     if (!GetSolver()->ComputeFunction(aFunction)) {
1602       SetErrorCode("Filling driver failed");
1603       return NULL;
1604     }
1605   }
1606   catch (Standard_Failure) {
1607     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1608     if (strcmp(aFail->GetMessageString(), "Geom_BSplineSurface") == 0)
1609       SetErrorCode("B-Spline surface construction failed");
1610     else
1611       SetErrorCode(aFail->GetMessageString());
1612     return NULL;
1613   }
1614
1615   //Make a Python command
1616   GEOM::TPythonDump pd (aFunction);
1617   pd << aFilling << " = geompy.MakeFilling(" << theShape ;
1618   if ( theMinDeg != 2 )   pd << ", theMinDeg=" << theMinDeg ;
1619   if ( theMaxDeg != 5 )   pd << ", theMaxDeg=" << theMaxDeg ;
1620   if ( fabs(theTol2D-0.0001) > Precision::Confusion() )
1621                           pd << ", theTol2D=" << theTol2D ;
1622   if ( fabs(theTol3D-0.0001) > Precision::Confusion() )
1623                           pd << ", theTol3D=" << theTol3D ;
1624   if ( theNbIter != 0 )   pd << ", theNbIter=" << theNbIter ;
1625   if ( theMethod==1 )     pd << ", theMethod=GEOM.FOM_UseOri";
1626   else if( theMethod==2 ) pd << ", theMethod=GEOM.FOM_AutoCorrect";
1627   if(isApprox)            pd << ", isApprox=" << isApprox ;
1628   pd << ")";
1629
1630   SetErrorCode(OK);
1631   return aFilling;
1632 }
1633
1634 //=============================================================================
1635 /*!
1636  *  MakeThruSections
1637  */
1638 //=============================================================================
1639 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections(
1640                                                 const Handle(TColStd_HSequenceOfTransient)& theSeqSections,
1641                                                 bool theModeSolid,
1642                                                 double thePreci,
1643                                                 bool theRuled)
1644 {
1645   Handle(GEOM_Object) anObj;
1646   SetErrorCode(KO);
1647   if(theSeqSections.IsNull())
1648     return anObj;
1649
1650   Standard_Integer nbObj = theSeqSections->Length();
1651   if (!nbObj)
1652     return anObj;
1653
1654   //Add a new ThruSections object
1655   Handle(GEOM_Object) aThruSect = GetEngine()->AddObject(GetDocID(), GEOM_THRUSECTIONS);
1656
1657
1658   //Add a new ThruSections function
1659
1660   int aTypeFunc = (theRuled ? THRUSECTIONS_RULED : THRUSECTIONS_SMOOTHED);
1661   Handle(GEOM_Function) aFunction =
1662     aThruSect->AddFunction(GEOMImpl_ThruSectionsDriver::GetID(), aTypeFunc);
1663   if (aFunction.IsNull()) return anObj;
1664
1665   //Check if the function is set correctly
1666   if (aFunction->GetDriverGUID() != GEOMImpl_ThruSectionsDriver::GetID()) return NULL;
1667
1668   GEOMImpl_IThruSections aCI (aFunction);
1669
1670   Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
1671
1672   Standard_Integer i =1;
1673   for( ; i <= nbObj; i++) {
1674
1675     Handle(Standard_Transient) anItem = theSeqSections->Value(i);
1676     if(anItem.IsNull())
1677       continue;
1678
1679     Handle(GEOM_Object) aSectObj = Handle(GEOM_Object)::DownCast(anItem);
1680     if(!aSectObj.IsNull())
1681     {
1682       Handle(GEOM_Function) aRefSect = aSectObj->GetLastFunction();
1683       if(!aRefSect.IsNull())
1684         aSeqSections->Append(aRefSect);
1685     }
1686   }
1687
1688   if(!aSeqSections->Length())
1689     return anObj;
1690
1691   aCI.SetSections(aSeqSections);
1692   aCI.SetSolidMode(theModeSolid);
1693   aCI.SetPrecision(thePreci);
1694
1695   //Compute the ThruSections value
1696   try {
1697 #if OCC_VERSION_LARGE > 0x06010000
1698     OCC_CATCH_SIGNALS;
1699 #endif
1700     if (!GetSolver()->ComputeFunction(aFunction)) {
1701       SetErrorCode("ThruSections driver failed");
1702       return anObj;
1703     }
1704   }
1705   catch (Standard_Failure) {
1706     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1707     SetErrorCode(aFail->GetMessageString());
1708     return anObj;
1709   }
1710
1711   //Make a Python command
1712   GEOM::TPythonDump pyDump(aFunction);
1713   pyDump << aThruSect << " = geompy.MakeThruSections([";
1714
1715   for(i =1 ; i <= nbObj; i++) {
1716
1717     Handle(Standard_Transient) anItem = theSeqSections->Value(i);
1718     if(anItem.IsNull())
1719       continue;
1720
1721     Handle(GEOM_Object) aSectObj = Handle(GEOM_Object)::DownCast(anItem);
1722     if(!aSectObj.IsNull()) {
1723       pyDump<< aSectObj;
1724       if(i < nbObj)
1725         pyDump<<", ";
1726     }
1727   }
1728
1729   pyDump<< "],"<<theModeSolid << "," << thePreci <<","<< theRuled <<")";
1730
1731   SetErrorCode(OK);
1732   return aThruSect;
1733 }
1734
1735
1736 //=============================================================================
1737 /*!
1738  *  MakePipeWithDifferentSections
1739  */
1740 //=============================================================================
1741 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections(
1742                 const Handle(TColStd_HSequenceOfTransient)& theBases,
1743                 const Handle(TColStd_HSequenceOfTransient)& theLocations,
1744                 const Handle(GEOM_Object)& thePath,
1745                 bool theWithContact,
1746                 bool theWithCorrections)
1747 {
1748   Handle(GEOM_Object) anObj;
1749   SetErrorCode(KO);
1750   if(theBases.IsNull())
1751     return anObj;
1752
1753   Standard_Integer nbBases = theBases->Length();
1754
1755   if (!nbBases)
1756     return anObj;
1757
1758   Standard_Integer nbLocs =  (theLocations.IsNull() ? 0 :theLocations->Length());
1759   //Add a new Pipe object
1760   Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
1761
1762   //Add a new Pipe function
1763
1764   Handle(GEOM_Function) aFunction =
1765     aPipeDS->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_DIFFERENT_SECTIONS);
1766   if (aFunction.IsNull()) return anObj;
1767
1768   //Check if the function is set correctly
1769   if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return anObj;
1770
1771   GEOMImpl_IPipeDiffSect aCI (aFunction);
1772
1773   Handle(GEOM_Function) aRefPath = thePath->GetLastFunction();
1774   if(aRefPath.IsNull())
1775     return anObj;
1776
1777   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
1778   Handle(TColStd_HSequenceOfTransient) aSeqLocs = new TColStd_HSequenceOfTransient;
1779
1780   Standard_Integer i =1;
1781   for( ; i <= nbBases; i++) {
1782
1783     Handle(Standard_Transient) anItem = theBases->Value(i);
1784     if(anItem.IsNull())
1785       continue;
1786
1787     Handle(GEOM_Object) aBase = Handle(GEOM_Object)::DownCast(anItem);
1788     if(aBase.IsNull())
1789       continue;
1790     Handle(GEOM_Function) aRefBase = aBase->GetLastFunction();
1791     if(aRefBase.IsNull())
1792       continue;
1793     if(nbLocs)
1794     {
1795       Handle(Standard_Transient) anItemLoc = theLocations->Value(i);
1796       if(anItemLoc.IsNull())
1797         continue;
1798
1799       Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc);
1800       if(aLoc.IsNull())
1801         continue;
1802       Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction();
1803       if(aRefLoc.IsNull())
1804         continue;
1805       aSeqLocs->Append(aRefLoc);
1806     }
1807     aSeqBases->Append(aRefBase);
1808   }
1809
1810   if(!aSeqBases->Length())
1811     return anObj;
1812
1813   aCI.SetBases(aSeqBases);
1814   aCI.SetLocations(aSeqLocs);
1815   aCI.SetPath(aRefPath);
1816   aCI.SetWithContactMode(theWithContact);
1817   aCI.SetWithCorrectionMode(theWithCorrections);
1818
1819   //Compute the Pipe value
1820   try {
1821 #if OCC_VERSION_LARGE > 0x06010000
1822     OCC_CATCH_SIGNALS;
1823 #endif
1824     if (!GetSolver()->ComputeFunction(aFunction)) {
1825       SetErrorCode("Pipe with defferent section driver failed");
1826       return anObj;
1827     }
1828   }
1829   catch (Standard_Failure) {
1830     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1831     SetErrorCode(aFail->GetMessageString());
1832     return anObj;
1833   }
1834
1835   //Make a Python command
1836   GEOM::TPythonDump pyDump(aFunction);
1837   pyDump << aPipeDS << " = geompy.MakePipeWithDifferentSections([";
1838
1839   for(i =1 ; i <= nbBases; i++) {
1840
1841     Handle(Standard_Transient) anItem = theBases->Value(i);
1842     if(anItem.IsNull())
1843       continue;
1844
1845     Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem);
1846     if(!anObj.IsNull()) {
1847       pyDump<< anObj;
1848       if(i < nbBases)
1849         pyDump<<", ";
1850     }
1851   }
1852
1853   pyDump<< "], [";
1854
1855   for(i =1 ; i <= nbLocs; i++) {
1856
1857     Handle(Standard_Transient) anItem = theLocations->Value(i);
1858     if(anItem.IsNull())
1859       continue;
1860
1861     Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem);
1862     if(!anObj.IsNull()) {
1863       pyDump<< anObj;
1864       if(i < nbLocs)
1865         pyDump<<", ";
1866     }
1867   }
1868
1869   pyDump<< "], "<<thePath<<","<<theWithContact << "," << theWithCorrections<<")";
1870
1871   SetErrorCode(OK);
1872   return aPipeDS;
1873 }
1874
1875
1876 //=============================================================================
1877 /*!
1878  *  MakePipeWithShellSections
1879  */
1880 //=============================================================================
1881 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections(
1882                 const Handle(TColStd_HSequenceOfTransient)& theBases,
1883                 const Handle(TColStd_HSequenceOfTransient)& theSubBases,
1884                 const Handle(TColStd_HSequenceOfTransient)& theLocations,
1885                 const Handle(GEOM_Object)& thePath,
1886                 bool theWithContact,
1887                 bool theWithCorrections)
1888 {
1889   Handle(GEOM_Object) anObj;
1890   SetErrorCode(KO);
1891   if(theBases.IsNull())
1892     return anObj;
1893
1894   Standard_Integer nbBases = theBases->Length();
1895
1896   if (!nbBases)
1897     return anObj;
1898
1899   Standard_Integer nbSubBases =  (theSubBases.IsNull() ? 0 :theSubBases->Length());
1900
1901   Standard_Integer nbLocs =  (theLocations.IsNull() ? 0 :theLocations->Length());
1902
1903   //Add a new Pipe object
1904   Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
1905
1906   //Add a new Pipe function
1907
1908   Handle(GEOM_Function) aFunction =
1909     aPipeDS->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_SHELL_SECTIONS);
1910   if (aFunction.IsNull()) return anObj;
1911
1912   //Check if the function is set correctly
1913   if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return anObj;
1914
1915   //GEOMImpl_IPipeDiffSect aCI (aFunction);
1916   GEOMImpl_IPipeShellSect aCI (aFunction);
1917
1918   Handle(GEOM_Function) aRefPath = thePath->GetLastFunction();
1919   if(aRefPath.IsNull())
1920     return anObj;
1921
1922   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
1923   Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
1924   Handle(TColStd_HSequenceOfTransient) aSeqLocs = new TColStd_HSequenceOfTransient;
1925
1926   Standard_Integer i =1;
1927   for( ; i <= nbBases; i++) {
1928
1929     Handle(Standard_Transient) anItem = theBases->Value(i);
1930     if(anItem.IsNull())
1931       continue;
1932     Handle(GEOM_Object) aBase = Handle(GEOM_Object)::DownCast(anItem);
1933     if(aBase.IsNull())
1934       continue;
1935     Handle(GEOM_Function) aRefBase = aBase->GetLastFunction();
1936     if(aRefBase.IsNull())
1937       continue;
1938
1939     if( nbSubBases >= nbBases ) {
1940       Handle(Standard_Transient) aSubItem = theSubBases->Value(i);
1941       if(aSubItem.IsNull())
1942         continue;
1943       Handle(GEOM_Object) aSubBase = Handle(GEOM_Object)::DownCast(aSubItem);
1944       if(aSubBase.IsNull())
1945         continue;
1946       Handle(GEOM_Function) aRefSubBase = aSubBase->GetLastFunction();
1947       if(aRefSubBase.IsNull())
1948         continue;
1949       aSeqSubBases->Append(aRefSubBase);
1950     }
1951
1952     if(nbLocs) {
1953       Handle(Standard_Transient) anItemLoc = theLocations->Value(i);
1954       if(anItemLoc.IsNull())
1955         continue;
1956       Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc);
1957       if(aLoc.IsNull())
1958         continue;
1959       Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction();
1960       if(aRefLoc.IsNull())
1961         continue;
1962       aSeqLocs->Append(aRefLoc);
1963     }
1964
1965     aSeqBases->Append(aRefBase);
1966   }
1967
1968   if(!aSeqBases->Length())
1969     return anObj;
1970
1971   aCI.SetBases(aSeqBases);
1972   aCI.SetSubBases(aSeqSubBases);
1973   aCI.SetLocations(aSeqLocs);
1974   aCI.SetPath(aRefPath);
1975   aCI.SetWithContactMode(theWithContact);
1976   aCI.SetWithCorrectionMode(theWithCorrections);
1977
1978   //Compute the Pipe value
1979   try {
1980 #if OCC_VERSION_LARGE > 0x06010000
1981     OCC_CATCH_SIGNALS;
1982 #endif
1983     if (!GetSolver()->ComputeFunction(aFunction)) {
1984       SetErrorCode("Pipe with shell sections driver failed");
1985       return anObj;
1986     }
1987   }
1988   catch (Standard_Failure) {
1989     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1990     SetErrorCode(aFail->GetMessageString());
1991     return anObj;
1992   }
1993
1994   //Make a Python command
1995   GEOM::TPythonDump pyDump(aFunction);
1996   pyDump << aPipeDS << " = geompy.MakePipeWithShellSections([";
1997
1998   for(i =1 ; i <= nbBases; i++) {
1999
2000     Handle(Standard_Transient) anItem = theBases->Value(i);
2001     if(anItem.IsNull())
2002       continue;
2003
2004     Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem);
2005     if(!anObj.IsNull()) {
2006       pyDump<< anObj;
2007       if(i < nbBases)
2008         pyDump<<", ";
2009     }
2010   }
2011
2012   pyDump<< "], [";
2013
2014   for(i =1 ; i <= nbSubBases; i++) {
2015
2016     Handle(Standard_Transient) anItem = theSubBases->Value(i);
2017     if(anItem.IsNull())
2018       continue;
2019
2020     Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem);
2021     if(!anObj.IsNull()) {
2022       pyDump<< anObj;
2023       if(i < nbBases)
2024         pyDump<<", ";
2025     }
2026   }
2027
2028   pyDump<< "], [";
2029
2030   for(i =1 ; i <= nbLocs; i++) {
2031
2032     Handle(Standard_Transient) anItem = theLocations->Value(i);
2033     if(anItem.IsNull())
2034       continue;
2035
2036     Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem);
2037     if(!anObj.IsNull()) {
2038       pyDump<< anObj;
2039       if(i < nbLocs)
2040         pyDump<<", ";
2041     }
2042   }
2043
2044   pyDump<< "], "<<thePath<<","<<theWithContact << "," << theWithCorrections<<")";
2045
2046   SetErrorCode(OK);
2047   return aPipeDS;
2048
2049 }
2050
2051
2052 //=============================================================================
2053 /*!
2054  *  MakePipeShellsWithoutPath
2055  */
2056 //=============================================================================
2057 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath(
2058                 const Handle(TColStd_HSequenceOfTransient)& theBases,
2059                 const Handle(TColStd_HSequenceOfTransient)& theLocations)
2060 {
2061   Handle(GEOM_Object) anObj;
2062   SetErrorCode(KO);
2063   if(theBases.IsNull())
2064     return anObj;
2065
2066   Standard_Integer nbBases = theBases->Length();
2067
2068   if (!nbBases)
2069     return anObj;
2070
2071   Standard_Integer nbLocs =  (theLocations.IsNull() ? 0 :theLocations->Length());
2072
2073   //Add a new Pipe object
2074   Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
2075
2076   //Add a new Pipe function
2077
2078   Handle(GEOM_Function) aFunction =
2079     aPipeDS->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_SHELLS_WITHOUT_PATH);
2080   if (aFunction.IsNull()) return anObj;
2081
2082   //Check if the function is set correctly
2083   if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return anObj;
2084
2085   GEOMImpl_IPipeShellSect aCI (aFunction);
2086
2087   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
2088   Handle(TColStd_HSequenceOfTransient) aSeqLocs = new TColStd_HSequenceOfTransient;
2089
2090   Standard_Integer i =1;
2091   for( ; i <= nbBases; i++) {
2092
2093     Handle(Standard_Transient) anItem = theBases->Value(i);
2094     if(anItem.IsNull())
2095       continue;
2096     Handle(GEOM_Object) aBase = Handle(GEOM_Object)::DownCast(anItem);
2097     if(aBase.IsNull())
2098       continue;
2099     Handle(GEOM_Function) aRefBase = aBase->GetLastFunction();
2100     if(aRefBase.IsNull())
2101       continue;
2102
2103     if(nbLocs) {
2104       Handle(Standard_Transient) anItemLoc = theLocations->Value(i);
2105       if(anItemLoc.IsNull())
2106         continue;
2107       Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc);
2108       if(aLoc.IsNull())
2109         continue;
2110       Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction();
2111       if(aRefLoc.IsNull())
2112         continue;
2113       aSeqLocs->Append(aRefLoc);
2114     }
2115
2116     aSeqBases->Append(aRefBase);
2117   }
2118
2119   if(!aSeqBases->Length())
2120     return anObj;
2121
2122   aCI.SetBases(aSeqBases);
2123   aCI.SetLocations(aSeqLocs);
2124
2125   //Compute the Pipe value
2126   try {
2127 #if OCC_VERSION_LARGE > 0x06010000
2128     OCC_CATCH_SIGNALS;
2129 #endif
2130     if (!GetSolver()->ComputeFunction(aFunction)) {
2131       SetErrorCode("Pipe with shell sections without path driver failed");
2132       return anObj;
2133     }
2134   }
2135   catch (Standard_Failure) {
2136     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
2137     SetErrorCode(aFail->GetMessageString());
2138     return anObj;
2139   }
2140
2141   //Make a Python command
2142   GEOM::TPythonDump pyDump(aFunction);
2143   pyDump << aPipeDS << " = geompy.MakePipeShellsWithoutPath([";
2144
2145   for(i =1 ; i <= nbBases; i++) {
2146
2147     Handle(Standard_Transient) anItem = theBases->Value(i);
2148     if(anItem.IsNull())
2149       continue;
2150
2151     Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem);
2152     if(!anObj.IsNull()) {
2153       pyDump<< anObj;
2154       if(i < nbBases)
2155         pyDump<<", ";
2156     }
2157   }
2158
2159   pyDump<< "], [";
2160
2161   for(i =1 ; i <= nbLocs; i++) {
2162
2163     Handle(Standard_Transient) anItem = theLocations->Value(i);
2164     if(anItem.IsNull())
2165       continue;
2166
2167     Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem);
2168     if(!anObj.IsNull()) {
2169       pyDump<< anObj;
2170       if(i < nbLocs)
2171         pyDump<<", ";
2172     }
2173   }
2174
2175   pyDump<< "])";
2176
2177   SetErrorCode(OK);
2178   return aPipeDS;
2179
2180 }
2181
2182 //=============================================================================
2183 /*!
2184  *  MakePipeBiNormalAlongVector
2185  */
2186 //=============================================================================
2187 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase,
2188                                                                              Handle(GEOM_Object) thePath,
2189                                                                              Handle(GEOM_Object) theVec)
2190 {
2191   SetErrorCode(KO);
2192
2193   if (theBase.IsNull() || thePath.IsNull() || theVec.IsNull()) return NULL;
2194
2195   //Add a new Pipe object
2196   Handle(GEOM_Object) aPipe = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
2197
2198   //Add a new Pipe function
2199   Handle(GEOM_Function) aFunction =
2200     aPipe->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_BI_NORMAL_ALONG_VECTOR);
2201   if (aFunction.IsNull()) return NULL;
2202
2203   //Check if the function is set correctly
2204   if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return NULL;
2205
2206   GEOMImpl_IPipeBiNormal aCI (aFunction);
2207
2208   Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
2209   Handle(GEOM_Function) aRefPath = thePath->GetLastFunction();
2210   Handle(GEOM_Function) aRefVec  = theVec->GetLastFunction();
2211
2212   if (aRefBase.IsNull() || aRefPath.IsNull() || aRefVec.IsNull()) return NULL;
2213
2214   aCI.SetBase(aRefBase);
2215   aCI.SetPath(aRefPath);
2216   aCI.SetVector(aRefVec);
2217
2218   //Compute the Pipe value
2219   try {
2220 #if OCC_VERSION_LARGE > 0x06010000
2221     OCC_CATCH_SIGNALS;
2222 #endif
2223     if (!GetSolver()->ComputeFunction(aFunction)) {
2224       SetErrorCode("Pipe driver failed");
2225       return NULL;
2226     }
2227   }
2228   catch (Standard_Failure) {
2229     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
2230     SetErrorCode(aFail->GetMessageString());
2231     return NULL;
2232   }
2233
2234   //Make a Python command
2235   GEOM::TPythonDump(aFunction) << aPipe << " = geompy.MakePipeBiNormalAlongVector("
2236     << theBase << ", " << thePath << ", " << theVec << ")";
2237
2238   SetErrorCode(OK);
2239   return aPipe;
2240 }
2241
2242 //=============================================================================
2243 /*!
2244  *  MakeThickening
2245  */
2246 //=============================================================================
2247 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThickening(Handle(GEOM_Object) theObject,
2248                                                               double theOffset,
2249                                                               bool copy = true)
2250 {
2251   SetErrorCode(KO);
2252
2253   if (theObject.IsNull()) return NULL;
2254
2255   Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
2256   if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
2257
2258   //Add a new Offset function
2259   Handle(GEOM_Function) aFunction;
2260   Handle(GEOM_Object) aCopy; 
2261   if (copy)
2262   { 
2263     //Add a new Copy object
2264     aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
2265     aFunction = aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_THICKENING_COPY);
2266   }
2267   else
2268     aFunction = theObject->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_THICKENING);
2269   
2270   if (aFunction.IsNull()) return NULL;
2271
2272   //Check if the function is set correctly
2273   if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
2274
2275   GEOMImpl_IOffset aTI (aFunction);
2276   aTI.SetShape(anOriginal);
2277   aTI.SetValue(theOffset);
2278
2279   //Compute the offset
2280   try {
2281 #if OCC_VERSION_LARGE > 0x06010000
2282     OCC_CATCH_SIGNALS;
2283 #endif
2284     if (!GetSolver()->ComputeFunction(aFunction)) {
2285       SetErrorCode("Offset driver failed");
2286       return NULL;
2287     }
2288   }
2289   catch (Standard_Failure) {
2290     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
2291     SetErrorCode(aFail->GetMessageString());
2292     return NULL;
2293   }
2294
2295   //Make a Python command
2296   if(copy)
2297   {
2298     GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeThickSolid("
2299                                << theObject << ", " << theOffset << ")";
2300     SetErrorCode(OK);
2301     return aCopy;
2302   }
2303   else
2304   {
2305     GEOM::TPythonDump(aFunction) << "geompy.Thicken("
2306                                << theObject << ", " << theOffset << ")";
2307     SetErrorCode(OK);
2308     return theObject;
2309   }
2310 }
2311
2312 //=============================================================================
2313 /*!
2314  *  RestorePath
2315  */
2316 //=============================================================================
2317 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::RestorePath (Handle(GEOM_Object) theShape,
2318                                                              Handle(GEOM_Object) theBase1,
2319                                                              Handle(GEOM_Object) theBase2)
2320 {
2321   SetErrorCode(KO);
2322
2323   if (theShape.IsNull() || theBase1.IsNull() || theBase2.IsNull()) return NULL;
2324
2325   // Add a new Path object
2326   Handle(GEOM_Object) aPath = GetEngine()->AddObject(GetDocID(), GEOM_PIPE_PATH);
2327
2328   // Add a new Path function
2329   Handle(GEOM_Function) aFunction =
2330     aPath->AddFunction(GEOMImpl_PipePathDriver::GetID(), PIPE_PATH_TWO_BASES);
2331   if (aFunction.IsNull()) return NULL;
2332
2333   // Check if the function is set correctly
2334   if (aFunction->GetDriverGUID() != GEOMImpl_PipePathDriver::GetID()) return NULL;
2335
2336   GEOMImpl_IPipePath aCI (aFunction);
2337
2338   Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
2339   Handle(GEOM_Function) aRefBase1 = theBase1->GetLastFunction();
2340   Handle(GEOM_Function) aRefBase2 = theBase2->GetLastFunction();
2341
2342   if (aRefShape.IsNull() || aRefBase1.IsNull() || aRefBase2.IsNull()) return NULL;
2343
2344   aCI.SetShape(aRefShape);
2345   aCI.SetBase1(aRefBase1);
2346   aCI.SetBase2(aRefBase2);
2347
2348   // Compute the Path value
2349   try {
2350 #if OCC_VERSION_LARGE > 0x06010000
2351     OCC_CATCH_SIGNALS;
2352 #endif
2353     if (!GetSolver()->ComputeFunction(aFunction)) {
2354       SetErrorCode("PipePath driver failed");
2355       return NULL;
2356     }
2357   }
2358   catch (Standard_Failure) {
2359     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
2360     SetErrorCode("RestorePath: inappropriate arguments given");
2361     return NULL;
2362   }
2363
2364   // Make a Python command
2365   GEOM::TPythonDump(aFunction) << aPath << " = geompy.RestorePath("
2366     << theShape << ", " << theBase1 << ", " << theBase2 << ")";
2367
2368   SetErrorCode(OK);
2369   return aPath;
2370 }
2371
2372 //=============================================================================
2373 /*!
2374  *  RestorePath
2375  */
2376 //=============================================================================
2377 Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::RestorePath
2378                          (Handle(GEOM_Object) theShape,
2379                           const Handle(TColStd_HSequenceOfTransient)& theBase1,
2380                           const Handle(TColStd_HSequenceOfTransient)& theBase2)
2381 {
2382   SetErrorCode(KO);
2383
2384   if (theShape.IsNull() || theBase1.IsNull() || theBase2.IsNull()) return NULL;
2385
2386   Standard_Integer nbBases1 = theBase1->Length();
2387   Standard_Integer nbBases2 = theBase2->Length();
2388
2389   if (!nbBases1 || !nbBases2)
2390     return NULL;
2391
2392   // Add a new Path object
2393   Handle(GEOM_Object) aPath = GetEngine()->AddObject(GetDocID(), GEOM_PIPE_PATH);
2394
2395   // Add a new Path function
2396   Handle(GEOM_Function) aFunction =
2397     aPath->AddFunction(GEOMImpl_PipePathDriver::GetID(), PIPE_PATH_TWO_SEQS);
2398   if (aFunction.IsNull()) return NULL;
2399
2400   // Check if the function is set correctly
2401   if (aFunction->GetDriverGUID() != GEOMImpl_PipePathDriver::GetID()) return NULL;
2402
2403   GEOMImpl_IPipePath aCI (aFunction);
2404
2405   Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
2406   if (aRefShape.IsNull()) return NULL;
2407
2408   Handle(TColStd_HSequenceOfTransient) aSeqBases1 = new TColStd_HSequenceOfTransient;
2409   Handle(TColStd_HSequenceOfTransient) aSeqBases2 = new TColStd_HSequenceOfTransient;
2410
2411   Standard_Integer i;
2412   for (i = 1; i <= nbBases1; i++) {
2413     Handle(Standard_Transient) anItem = theBase1->Value(i);
2414     if (!anItem.IsNull()) {
2415       Handle(GEOM_Object) aBase = Handle(GEOM_Object)::DownCast(anItem);
2416       if (!aBase.IsNull()) {
2417         Handle(GEOM_Function) aRefBase = aBase->GetLastFunction();
2418         if (!aRefBase.IsNull())
2419           aSeqBases1->Append(aRefBase);
2420       }
2421     }
2422   }
2423   for (i = 1; i <= nbBases2; i++) {
2424     Handle(Standard_Transient) anItem = theBase2->Value(i);
2425     if (!anItem.IsNull()) {
2426       Handle(GEOM_Object) aBase = Handle(GEOM_Object)::DownCast(anItem);
2427       if (!aBase.IsNull()) {
2428         Handle(GEOM_Function) aRefBase = aBase->GetLastFunction();
2429         if (!aRefBase.IsNull())
2430           aSeqBases2->Append(aRefBase);
2431       }
2432     }
2433   }
2434   if (!aSeqBases1->Length() || !aSeqBases2->Length()) return NULL;
2435
2436   aCI.SetShape(aRefShape);
2437   aCI.SetBaseSeq1(aSeqBases1);
2438   aCI.SetBaseSeq2(aSeqBases2);
2439
2440   // Compute the Path value
2441   try {
2442 #if OCC_VERSION_LARGE > 0x06010000
2443     OCC_CATCH_SIGNALS;
2444 #endif
2445     if (!GetSolver()->ComputeFunction(aFunction)) {
2446       SetErrorCode("PipePath driver failed");
2447       return NULL;
2448     }
2449   }
2450   catch (Standard_Failure) {
2451     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
2452     SetErrorCode("RestorePath: inappropriate arguments given");
2453     return NULL;
2454   }
2455
2456   // Make a Python command
2457   GEOM::TPythonDump pyDump (aFunction);
2458   pyDump << aPath << " = geompy.RestorePathEdges(" << theShape << ", [";
2459   for (i = 1; i <= nbBases1; i++) {
2460     Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(theBase1->Value(i));
2461     if (!anObj.IsNull()) {
2462       pyDump << anObj;
2463       if (i < nbBases1)
2464         pyDump << ", ";
2465     }
2466   }
2467   pyDump<< "], [";
2468   for (i = 1; i <= nbBases2; i++) {
2469     Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(theBase2->Value(i));
2470     if (!anObj.IsNull()) {
2471       pyDump << anObj;
2472       if (i < nbBases2)
2473         pyDump << ", ";
2474     }
2475   }
2476   pyDump << "])";
2477
2478   SetErrorCode(OK);
2479   return aPath;
2480 }