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