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