Salome HOME
CCAR:remove trailing whitespace
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IBasicOperations.cxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #include <Standard_Stream.hxx>
24
25 #include <GEOMImpl_IBasicOperations.hxx>
26
27 #include "utilities.h"
28 #include <OpUtil.hxx>
29 #include <Utils_ExceptHandlers.hxx>
30
31 #include <TFunction_DriverTable.hxx>
32 #include <TFunction_Driver.hxx>
33 #include <TFunction_Logbook.hxx>
34 #include <TDF_Tool.hxx>
35
36 #include <GEOM_Function.hxx>
37 #include <GEOM_PythonDump.hxx>
38
39 #include <GEOMImpl_PointDriver.hxx>
40 #include <GEOMImpl_VectorDriver.hxx>
41 #include <GEOMImpl_LineDriver.hxx>
42 #include <GEOMImpl_PlaneDriver.hxx>
43 #include <GEOMImpl_MarkerDriver.hxx>
44
45 #include <GEOMImpl_IPoint.hxx>
46 #include <GEOMImpl_IVector.hxx>
47 #include <GEOMImpl_ILine.hxx>
48 #include <GEOMImpl_IPlane.hxx>
49 #include <GEOMImpl_IMarker.hxx>
50
51 #include <GEOMImpl_Types.hxx>
52
53 #include <Standard_Failure.hxx>
54 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
55
56 //=============================================================================
57 /*!
58  *   constructor:
59  */
60 //=============================================================================
61 GEOMImpl_IBasicOperations::GEOMImpl_IBasicOperations(GEOM_Engine* theEngine, int theDocID)
62 : GEOM_IOperations(theEngine, theDocID)
63 {
64   MESSAGE("GEOMImpl_IBasicOperations::GEOMImpl_IBasicOperations");
65 }
66
67 //=============================================================================
68 /*!
69  *  destructor
70  */
71 //=============================================================================
72 GEOMImpl_IBasicOperations::~GEOMImpl_IBasicOperations()
73 {
74   MESSAGE("GEOMImpl_IBasicOperations::~GEOMImpl_IBasicOperations");
75 }
76
77
78 //=============================================================================
79 /*!
80  *  MakePointXYZ
81  */
82 //=============================================================================
83 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointXYZ
84                                         (double theX, double theY, double theZ)
85 {
86   SetErrorCode(KO);
87
88   //Add a new Point object
89   Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
90
91   //Add a new Point function with XYZ parameters
92   Handle(GEOM_Function) aFunction =
93     aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_XYZ);
94   if (aFunction.IsNull()) return NULL;
95
96   //Check if the function is set correctly
97   if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
98
99   GEOMImpl_IPoint aPI(aFunction);
100
101   aPI.SetX(theX);
102   aPI.SetY(theY);
103   aPI.SetZ(theZ);
104
105   //Compute the point value
106   try {
107 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
108     OCC_CATCH_SIGNALS;
109 #endif
110     if (!GetSolver()->ComputeFunction(aFunction)) {
111       SetErrorCode("Point driver failed");
112       return NULL;
113     }
114   }
115   catch (Standard_Failure) {
116     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
117     SetErrorCode(aFail->GetMessageString());
118     return NULL;
119   }
120
121   //Make a Python command
122   GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertex("
123     << theX << ", " << theY << ", " << theZ << ")";
124
125   SetErrorCode(OK);
126   return aPoint;
127 }
128
129 //=============================================================================
130 /*!
131  *  MakePointWithReference
132  */
133 //=============================================================================
134 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference
135       (Handle(GEOM_Object) theReference, double theX, double theY, double theZ)
136 {
137   SetErrorCode(KO);
138
139   if (theReference.IsNull()) return NULL;
140
141   //Add a new Point object
142   Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
143
144   //Add a new Point function for creation a point relativley another point
145   Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_XYZ_REF);
146
147   //Check if the function is set correctly
148   if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
149
150   GEOMImpl_IPoint aPI(aFunction);
151
152   Handle(GEOM_Function) aRefFunction = theReference->GetLastFunction();
153   if (aRefFunction.IsNull()) return NULL;
154
155   aPI.SetRef(aRefFunction);
156   aPI.SetX(theX);
157   aPI.SetY(theY);
158   aPI.SetZ(theZ);
159
160   //Compute the point value
161   try {
162 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
163     OCC_CATCH_SIGNALS;
164 #endif
165     if (!GetSolver()->ComputeFunction(aFunction)) {
166       SetErrorCode("Point driver failed");
167       return NULL;
168     }
169   }
170   catch (Standard_Failure) {
171     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
172     SetErrorCode(aFail->GetMessageString());
173     return NULL;
174   }
175
176   //Make a Python command
177   GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexWithRef("
178     << theReference << ", " << theX << ", " << theY << ", " << theZ << ")";
179
180   SetErrorCode(OK);
181   return aPoint;
182 }
183
184 //=============================================================================
185 /*!
186  *  makePointOnGeom
187  */
188 //=============================================================================
189 Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
190                     (Handle(GEOM_Object) theGeomObj,
191                      double theParam1,
192                      double theParam2,
193                      double theParam3,
194                      const PointLocation theLocation,
195                      bool theReverse)
196 {
197   SetErrorCode(KO);
198
199   if (theGeomObj.IsNull()) return NULL;
200
201   //Add a new Point object
202   Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
203
204   //Add a new Point function for creation a point relativley another point
205   int fType = POINT_CURVE_PAR;
206   switch( theLocation )
207     {
208     case PointOn_CurveByParam:   fType = POINT_CURVE_PAR; break;
209     case PointOn_CurveByLength:  fType = POINT_CURVE_LENGTH; break;                              
210     case PointOn_CurveByCoord:   fType = POINT_CURVE_COORD; break;
211     case PointOn_SurfaceByParam: fType = POINT_SURFACE_PAR; break;
212     case PointOn_SurfaceByCoord: fType = POINT_SURFACE_COORD; break;
213     default: break;
214     }
215   Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), fType);
216
217   //Check if the function is set correctly
218   if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
219
220   GEOMImpl_IPoint aPI (aFunction);
221
222   Handle(GEOM_Function) aRefFunction = theGeomObj->GetLastFunction();
223   if (aRefFunction.IsNull()) return NULL;
224
225   switch( theLocation )
226     {
227     case PointOn_CurveByParam:
228       aPI.SetCurve(aRefFunction);
229       aPI.SetParameter(theParam1);
230       break;
231     case PointOn_CurveByLength:
232       aPI.SetCurve(aRefFunction);
233       aPI.SetLength(theParam1);
234       aPI.SetReversed(theReverse);
235       break;
236     case PointOn_CurveByCoord:
237       aPI.SetCurve(aRefFunction);
238       aPI.SetX(theParam1);
239       aPI.SetY(theParam2);
240       aPI.SetZ(theParam3);
241       break;
242     case PointOn_SurfaceByParam:
243       aPI.SetSurface(aRefFunction);
244       aPI.SetParameter(theParam1);
245       aPI.SetParameter2(theParam2);
246       break;
247     case PointOn_SurfaceByCoord:
248       aPI.SetSurface(aRefFunction);
249       aPI.SetX(theParam1);
250       aPI.SetY(theParam2);
251       aPI.SetZ(theParam3);
252     default: break;
253     }
254   
255   //Compute the point value
256   try {
257 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
258     OCC_CATCH_SIGNALS;
259 #endif
260     if (!GetSolver()->ComputeFunction(aFunction)) {
261       SetErrorCode("Point driver failed");
262       return NULL;
263     }
264   }
265   catch (Standard_Failure) {
266     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
267     SetErrorCode(aFail->GetMessageString());
268     return NULL;
269   }
270
271   //Make a Python command
272   switch( theLocation )
273     {
274     case PointOn_CurveByParam:
275       GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve("
276                                    << theGeomObj << ", " << theParam1 << ")";
277       break;
278     case PointOn_CurveByLength:
279       GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByLength("
280                                    << theGeomObj << ", " << theParam1 << ", " << theReverse <<  ")";
281       break;
282     case PointOn_CurveByCoord:
283   GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByCoord("
284                                << theGeomObj << ", " << theParam1 
285                                << ", " << theParam2 << ", " << theParam3 << ")";
286       break;
287     case PointOn_SurfaceByParam:
288   GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface("
289                                << theGeomObj << ", " << theParam1 
290                                << ", " << theParam2 << ")";
291       break;
292     case PointOn_SurfaceByCoord:
293   GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurfaceByCoord("
294                                << theGeomObj << ", " << theParam1 
295                                << ", " << theParam2 << ", " << theParam3 << ")";
296     default: break;
297     }
298
299   SetErrorCode(OK);
300   return aPoint;
301 }
302
303 //=============================================================================
304 /*!
305  *  MakePointOnCurve
306  */
307 //=============================================================================
308 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
309                             (Handle(GEOM_Object) theCurve, double theParameter)
310 {
311   return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam);
312 }
313
314 //=============================================================================
315 /*!
316  *  MakePointOnCurveByCoord
317  */
318 //=============================================================================
319 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByCoord
320                     (Handle(GEOM_Object) theCurve,
321                      double theXParam,
322                      double theYParam,
323                      double theZParam)
324 {
325   return makePointOnGeom(theCurve, theXParam, theYParam, theZParam, PointOn_CurveByCoord);
326 }
327
328 //=============================================================================
329 /*!
330  *  MakePointOnCurveByLength 
331  */
332 //=============================================================================
333 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByLength
334                     (Handle(GEOM_Object) theCurve, 
335                      double theLength, 
336                      bool theReverse)
337 {
338   return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength, theReverse);
339 }
340
341 //=============================================================================
342 /*!
343  *  MakePointOnSurface
344  */
345 //=============================================================================
346 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurface
347                     (Handle(GEOM_Object) theSurface,
348                      double theUParameter,
349                      double theVParameter)
350 {
351   return makePointOnGeom(theSurface, theUParameter, theVParameter, 0., PointOn_SurfaceByParam);
352 }
353
354 //=============================================================================
355 /*!
356  *  MakePointOnSurfaceByCoord
357  */
358 //=============================================================================
359 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurfaceByCoord
360                     (Handle(GEOM_Object) theSurface,
361                      double theXParam,
362                      double theYParam,
363                      double theZParam)
364 {
365   return makePointOnGeom(theSurface, theXParam, theYParam, theZParam, PointOn_SurfaceByCoord);
366 }
367
368
369 //=============================================================================
370 /*!
371  *  MakePointOnLinesIntersection
372  */
373 //=============================================================================
374 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnLinesIntersection
375                             (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2)
376 {
377   SetErrorCode(KO);
378
379   if (theLine1.IsNull() || theLine2.IsNull()) return NULL;
380
381   //Add a new Point object
382   Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
383
384   //Add a new Point function for creation a point relativley another point
385   Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_LINES_INTERSECTION);
386
387   //Check if the function is set correctly
388   if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
389
390   GEOMImpl_IPoint aPI (aFunction);
391
392   Handle(GEOM_Function) aRef1 = theLine1->GetLastFunction();
393   Handle(GEOM_Function) aRef2 = theLine2->GetLastFunction();
394   if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
395
396   aPI.SetLine1(aRef1);
397   aPI.SetLine2(aRef2);
398
399   //Compute the point value
400   try {
401 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
402     OCC_CATCH_SIGNALS;
403 #endif
404     if (!GetSolver()->ComputeFunction(aFunction)) {
405       SetErrorCode("Point driver failed");
406       return NULL;
407     }
408   }
409   catch (Standard_Failure) {
410     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
411     SetErrorCode(aFail->GetMessageString());
412     return NULL;
413   }
414
415   //Make a Python command
416   GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnLinesIntersection("
417                                << theLine1 << ", " << theLine2 << ")";
418
419   SetErrorCode(OK);
420   return aPoint;
421 }
422
423 //=============================================================================
424 /*!
425  *  MakeTangentOnCurve
426  */
427 //=============================================================================
428 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentOnCurve
429                             (const Handle(GEOM_Object)& theCurve, double theParameter)
430 {
431   SetErrorCode(KO);
432
433   if (theCurve.IsNull()) return NULL;
434
435   //Add a new Vector object
436   Handle(GEOM_Object) aVec = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
437
438   //Add a new Point function for creation a point relativley another point
439   Handle(GEOM_Function) aFunction = aVec->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_TANGENT_CURVE_PAR);
440
441   //Check if the function is set correctly
442   if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
443
444   GEOMImpl_IVector aVI (aFunction);
445
446   Handle(GEOM_Function) aRefFunction = theCurve->GetLastFunction();
447   if (aRefFunction.IsNull()) return NULL;
448
449   aVI.SetCurve(aRefFunction);
450   aVI.SetParameter(theParameter);
451
452   //Compute the vector value
453   try {
454 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
455     OCC_CATCH_SIGNALS;
456 #endif
457     if (!GetSolver()->ComputeFunction(aFunction)) {
458       SetErrorCode("Vector driver failed");
459       return NULL;
460     }
461   }
462   catch (Standard_Failure) {
463     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
464     SetErrorCode(aFail->GetMessageString());
465     return NULL;
466   }
467
468   //Make a Python command
469   GEOM::TPythonDump(aFunction) << aVec << " = geompy.MakeTangentOnCurve("
470                                << theCurve << ", " << theParameter << ")";
471
472   SetErrorCode(OK);
473   return aVec;
474 }
475
476 //=============================================================================
477 /*!
478  *  MakeVectorDXDYDZ
479  */
480 //=============================================================================
481 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorDXDYDZ
482                                      (double theDX, double theDY, double theDZ)
483 {
484   SetErrorCode(KO);
485
486   //Add a new Vector object
487   Handle(GEOM_Object) aVector = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
488
489   //Add a new Vector function with DXDYDZ parameters
490   Handle(GEOM_Function) aFunction =
491     aVector->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_DX_DY_DZ);
492   if (aFunction.IsNull()) return NULL;
493
494   //Check if the function is set correctly
495   if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
496
497   GEOMImpl_IVector aPI (aFunction);
498
499   aPI.SetDX(theDX);
500   aPI.SetDY(theDY);
501   aPI.SetDZ(theDZ);
502
503   //Compute the Vector value
504   try {
505 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
506     OCC_CATCH_SIGNALS;
507 #endif
508     if (!GetSolver()->ComputeFunction(aFunction)) {
509       SetErrorCode("Vector driver failed");
510       return NULL;
511     }
512   }
513   catch (Standard_Failure) {
514     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
515     SetErrorCode(aFail->GetMessageString());
516     return NULL;
517   }
518
519   //Make a Python command
520   GEOM::TPythonDump(aFunction) << aVector << " = geompy.MakeVectorDXDYDZ("
521     << theDX << ", " << theDY << ", " << theDZ << ")";
522
523   SetErrorCode(OK);
524   return aVector;
525 }
526
527 //=============================================================================
528 /*!
529  *  MakeVectorTwoPnt
530  */
531 //=============================================================================
532 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorTwoPnt
533                      (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2)
534 {
535   SetErrorCode(KO);
536
537   if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL;
538
539   //Add a new Vector object
540   Handle(GEOM_Object) aVector = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
541
542   //Add a new Vector function
543   Handle(GEOM_Function) aFunction =
544     aVector->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_TWO_PNT);
545
546   //Check if the function is set correctly
547   if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
548
549   GEOMImpl_IVector aPI (aFunction);
550
551   Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction();
552   Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction();
553   if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
554
555   aPI.SetPoint1(aRef1);
556   aPI.SetPoint2(aRef2);
557
558   //Compute the Vector value
559   try {
560 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
561     OCC_CATCH_SIGNALS;
562 #endif
563     if (!GetSolver()->ComputeFunction(aFunction)) {
564       SetErrorCode("Vector driver failed");
565       return NULL;
566     }
567   }
568   catch (Standard_Failure) {
569     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
570     SetErrorCode(aFail->GetMessageString());
571     return NULL;
572   }
573
574   //Make a Python command
575   GEOM::TPythonDump(aFunction) << aVector << " = geompy.MakeVector("
576                                << thePnt1 << ", " << thePnt2 << ")";
577
578   SetErrorCode(OK);
579   return aVector;
580 }
581
582
583 //=============================================================================
584 /*!
585  *  MakeLine
586  */
587 //=============================================================================
588 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLine
589                      (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theDir)
590 {
591   SetErrorCode(KO);
592
593   if (thePnt.IsNull() || theDir.IsNull()) return NULL;
594
595   //Add a new Line object
596   Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
597
598   //Add a new Line function
599   Handle(GEOM_Function) aFunction =
600     aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_PNT_DIR);
601
602   //Check if the function is set correctly
603   if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL;
604
605   GEOMImpl_ILine aPI (aFunction);
606
607   Handle(GEOM_Function) aRef1 = thePnt->GetLastFunction();
608   Handle(GEOM_Function) aRef2 = theDir->GetLastFunction();
609   if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
610
611   aPI.SetPoint1(aRef1);
612   aPI.SetPoint2(aRef2);
613
614   //Compute the Line value
615   try {
616 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
617     OCC_CATCH_SIGNALS;
618 #endif
619     if (!GetSolver()->ComputeFunction(aFunction)) {
620       SetErrorCode("Line driver failed");
621       return NULL;
622     }
623   }
624   catch (Standard_Failure) {
625     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
626     SetErrorCode(aFail->GetMessageString());
627     return NULL;
628   }
629
630   //Make a Python command
631   GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLine("
632                                << thePnt << ", " << theDir << ")";
633
634   SetErrorCode(OK);
635   return aLine;
636 }
637
638 //=============================================================================
639 /*!
640  *  MakeLineTwoPnt
641  */
642 //=============================================================================
643 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt
644                      (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2)
645 {
646   SetErrorCode(KO);
647
648   if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL;
649
650   //Add a new Line object
651   Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
652
653   //Add a new Line function
654   Handle(GEOM_Function) aFunction =
655     aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_TWO_PNT);
656
657   //Check if the function is set correctly
658   if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL;
659
660   GEOMImpl_ILine aPI (aFunction);
661
662   Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction();
663   Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction();
664   if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
665
666   aPI.SetPoint1(aRef1);
667   aPI.SetPoint2(aRef2);
668
669   //Compute the Line value
670   try {
671 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
672     OCC_CATCH_SIGNALS;
673 #endif
674     if (!GetSolver()->ComputeFunction(aFunction)) {
675       SetErrorCode("Line driver failed");
676       return NULL;
677     }
678   }
679   catch (Standard_Failure) {
680     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
681     SetErrorCode(aFail->GetMessageString());
682     return NULL;
683   }
684
685   //Make a Python command
686   GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLineTwoPnt("
687                                << thePnt1 << ", " << thePnt2 << ")";
688
689   SetErrorCode(OK);
690   return aLine;
691 }
692
693 //=============================================================================
694 /*!
695  *  MakeLineTwoFaces
696  */
697 //=============================================================================
698 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoFaces
699                      (Handle(GEOM_Object) theFace1, Handle(GEOM_Object) theFace2)
700 {
701   SetErrorCode(KO);
702
703   if (theFace1.IsNull() || theFace2.IsNull()) return NULL;
704
705   //Add a new Line object
706   Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
707
708   //Add a new Line function
709   Handle(GEOM_Function) aFunction =
710     aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_TWO_FACES);
711
712   //Check if the function is set correctly
713   if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL;
714
715   GEOMImpl_ILine aPI (aFunction);
716
717   Handle(GEOM_Function) aRef1 = theFace1->GetLastFunction();
718   Handle(GEOM_Function) aRef2 = theFace2->GetLastFunction();
719   if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
720
721   aPI.SetFace1(aRef1);
722   aPI.SetFace2(aRef2);
723
724   //Compute the Line value
725   try {
726 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
727     OCC_CATCH_SIGNALS;
728 #endif
729     if (!GetSolver()->ComputeFunction(aFunction)) {
730       SetErrorCode("Line driver failed");
731       return NULL;
732     }
733   }
734   catch (Standard_Failure) {
735     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
736     SetErrorCode(aFail->GetMessageString());
737     return NULL;
738   }
739
740   //Make a Python command
741   GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLineTwoFaces("
742                                << theFace1 << ", " << theFace2 << ")";
743
744   SetErrorCode(OK);
745   return aLine;
746 }
747
748 //=============================================================================
749 /*!
750  *  MakePlaneThreePnt
751  */
752 //=============================================================================
753 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneThreePnt
754                      (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2,
755                       Handle(GEOM_Object) thePnt3, double theSize)
756 {
757   SetErrorCode(KO);
758
759   if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
760
761   //Add a new Plane object
762   Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
763
764   //Add a new Plane function
765   Handle(GEOM_Function) aFunction =
766     aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_THREE_PNT);
767
768   //Check if the function is set correctly
769   if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
770
771   GEOMImpl_IPlane aPI (aFunction);
772
773   Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction();
774   Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction();
775   Handle(GEOM_Function) aRef3 = thePnt3->GetLastFunction();
776   if (aRef1.IsNull() || aRef2.IsNull() || aRef3.IsNull()) return NULL;
777
778   aPI.SetPoint1(aRef1);
779   aPI.SetPoint2(aRef2);
780   aPI.SetPoint3(aRef3);
781   aPI.SetSize(theSize);
782
783   //Compute the Plane value
784   try {
785 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
786     OCC_CATCH_SIGNALS;
787 #endif
788     if (!GetSolver()->ComputeFunction(aFunction)) {
789       SetErrorCode("Plane driver failed");
790       return NULL;
791     }
792   }
793   catch (Standard_Failure) {
794     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
795     SetErrorCode(aFail->GetMessageString());
796     return NULL;
797   }
798
799   //Make a Python command
800   GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneThreePnt("
801     << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ", " << theSize << ")";
802
803   SetErrorCode(OK);
804   return aPlane;
805 }
806
807 //=============================================================================
808 /*!
809  *  MakePlanePntVec
810  */
811 //=============================================================================
812 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlanePntVec
813                        (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec,
814                         double theSize)
815 {
816   SetErrorCode(KO);
817
818   if (thePnt.IsNull() || theVec.IsNull()) return NULL;
819
820   //Add a new Plane object
821   Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
822
823   //Add a new Plane function
824   Handle(GEOM_Function) aFunction =
825     aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_PNT_VEC);
826
827   //Check if the function is set correctly
828   if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
829
830   GEOMImpl_IPlane aPI (aFunction);
831
832   Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
833   Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
834   if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
835
836   aPI.SetPoint(aRefPnt);
837   aPI.SetVector(aRefVec);
838   aPI.SetSize(theSize);
839
840   //Compute the Plane value
841   try {
842 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
843     OCC_CATCH_SIGNALS;
844 #endif
845     if (!GetSolver()->ComputeFunction(aFunction)) {
846       SetErrorCode("Plane 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) << aPlane << " = geompy.MakePlane("
858     << thePnt << ", " << theVec << ", " << theSize << ")";
859
860   SetErrorCode(OK);
861   return aPlane;
862 }
863
864 //=============================================================================
865 /*!
866  *  MakePlaneFace
867  */
868 //=============================================================================
869 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace
870                        (Handle(GEOM_Object) theFace, double theSize)
871 {
872   SetErrorCode(KO);
873
874   if (theFace.IsNull()) return NULL;
875
876   //Add a new Plane object
877   Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
878
879   //Add a new Plane function
880   Handle(GEOM_Function) aFunction =
881     aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_FACE);
882
883   //Check if the function is set correctly
884   if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
885
886   GEOMImpl_IPlane aPI (aFunction);
887
888   Handle(GEOM_Function) aRef = theFace->GetLastFunction();
889   if (aRef.IsNull()) return NULL;
890
891   aPI.SetFace(aRef);
892   aPI.SetSize(theSize);
893
894   //Compute the Plane value
895   try {
896 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
897     OCC_CATCH_SIGNALS;
898 #endif
899     if (!GetSolver()->ComputeFunction(aFunction)) {
900       SetErrorCode("Plane driver failed");
901       return NULL;
902     }
903   }
904   catch (Standard_Failure) {
905     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
906     SetErrorCode(aFail->GetMessageString());
907     return NULL;
908   }
909
910   //Make a Python command
911   GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneFace("
912                                << theFace << ", " << theSize << ")";
913
914   SetErrorCode(OK);
915   return aPlane;
916 }
917
918 //=============================================================================
919 /*!
920  *  MakePlane2Vec
921  */
922 //=============================================================================
923 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlane2Vec
924                        (Handle(GEOM_Object) theVec1, Handle(GEOM_Object) theVec2,
925                         double theSize)
926 {
927   SetErrorCode(KO);
928
929   if (theVec1.IsNull() || theVec2.IsNull()) return NULL;
930
931   //Add a new Plane object
932   Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
933
934   //Add a new Plane function
935   Handle(GEOM_Function) aFunction =
936     aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_2_VEC);
937
938   //Check if the function is set correctly
939   if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
940
941   GEOMImpl_IPlane aPI (aFunction);
942
943   Handle(GEOM_Function) aRefVec1 = theVec1->GetLastFunction();
944   Handle(GEOM_Function) aRefVec2 = theVec2->GetLastFunction();
945   if (aRefVec1.IsNull() || aRefVec2.IsNull()) return NULL;
946
947   aPI.SetVector1(aRefVec1);
948   aPI.SetVector2(aRefVec2);
949   aPI.SetSize(theSize);
950
951   //Compute the Plane value
952   try {
953 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
954     OCC_CATCH_SIGNALS;
955 #endif
956     if (!GetSolver()->ComputeFunction(aFunction)) {
957       SetErrorCode("Plane driver failed");
958       return NULL;
959     }
960   }
961   catch (Standard_Failure) {
962     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
963     SetErrorCode(aFail->GetMessageString());
964     return NULL;
965   }
966
967   //Make a Python command
968   GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlane2Vec("
969     << theVec1 << ", " << theVec2 << ", " << theSize << ")";
970
971   SetErrorCode(OK);
972   return aPlane;
973 }
974
975 //=============================================================================
976 /*!
977  *  MakePlaneLCS
978  */
979 //=============================================================================
980 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneLCS
981                        (Handle(GEOM_Object) theLCS, double theSize, int theOrientation)
982 {
983   SetErrorCode(KO);
984
985   //Add a new Plane object
986   Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
987
988   //Add a new Plane function
989   Handle(GEOM_Function) aFunction =
990     aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_LCS);
991
992   //Check if the function is set correctly
993   if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
994
995   GEOMImpl_IPlane aPI (aFunction);
996
997   if ( !theLCS.IsNull() ) {
998     Handle(GEOM_Function) aRef = theLCS->GetLastFunction();
999     aPI.SetLCS(aRef);
1000   }
1001
1002   aPI.SetSize(theSize);
1003   aPI.SetOrientation(theOrientation);
1004
1005   //Compute the Plane value
1006   try {
1007 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
1008     OCC_CATCH_SIGNALS;
1009 #endif
1010     if (!GetSolver()->ComputeFunction(aFunction)) {
1011       SetErrorCode("Plane driver failed");
1012       return NULL;
1013     }
1014   }
1015   catch (Standard_Failure) {
1016     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1017     SetErrorCode(aFail->GetMessageString());
1018     return NULL;
1019   }
1020
1021   //Make a Python command
1022   GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneLCS("
1023                                << theLCS << ", " << theSize << ", " << theOrientation << ")";
1024
1025   SetErrorCode(OK);
1026   return aPlane;
1027 }
1028
1029
1030 //=============================================================================
1031 /*!
1032  *  MakeMarker
1033  */
1034 //=============================================================================
1035 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker
1036                                   (double theOX,  double theOY,  double theOZ,
1037                                    double theXDX, double theXDY, double theXDZ,
1038                                    double theYDX, double theYDY, double theYDZ)
1039 {
1040   SetErrorCode(KO);
1041
1042   //Add a new Marker object
1043   Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER);
1044
1045   //Add a new Marker function
1046   Handle(GEOM_Function) aFunction =
1047     aMarker->AddFunction(GEOMImpl_MarkerDriver::GetID(), MARKER_CS);
1048   if (aFunction.IsNull()) return NULL;
1049
1050   //Check if the function is set correctly
1051   if (aFunction->GetDriverGUID() != GEOMImpl_MarkerDriver::GetID()) return NULL;
1052
1053   GEOMImpl_IMarker aPI(aFunction);
1054
1055   aPI.SetOrigin(theOX, theOY, theOZ);
1056   aPI.SetXDir(theXDX, theXDY, theXDZ);
1057   aPI.SetYDir(theYDX, theYDY, theYDZ);
1058
1059   //Compute the marker value
1060   try {
1061 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
1062     OCC_CATCH_SIGNALS;
1063 #endif
1064     if (!GetSolver()->ComputeFunction(aFunction)) {
1065       SetErrorCode("Marker driver failed");
1066       return NULL;
1067     }
1068   }
1069   catch (Standard_Failure) {
1070     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1071     SetErrorCode(aFail->GetMessageString());
1072     return NULL;
1073   }
1074
1075   //Make a Python command
1076   GEOM::TPythonDump(aFunction) << aMarker << " = geompy.MakeMarker("
1077     << theOX << ", " << theOY << ", " << theOZ << ", "
1078       << theXDX << ", " << theXDY << ", " << theXDZ << ", "
1079         << theYDX << ", " << theYDY << ", " << theYDZ << ")";
1080
1081   SetErrorCode(OK);
1082   return aMarker;
1083 }
1084
1085 //=============================================================================
1086 /*!
1087  *  MakeMarkerFromShape
1088  */
1089 //=============================================================================
1090 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerFromShape
1091                                   (const Handle(GEOM_Object)& theShape)
1092 {
1093   SetErrorCode(KO);
1094
1095   //Add a new Marker object
1096   Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER);
1097
1098   //Add a new Marker function
1099   Handle(GEOM_Function) aFunction =
1100     aMarker->AddFunction(GEOMImpl_MarkerDriver::GetID(), MARKER_SHAPE);
1101   if (aFunction.IsNull()) return NULL;
1102
1103   //Check if the function is set correctly
1104   if (aFunction->GetDriverGUID() != GEOMImpl_MarkerDriver::GetID()) return NULL;
1105
1106   GEOMImpl_IMarker aPI(aFunction);
1107
1108   Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
1109   if (aRefShape.IsNull()) return NULL;
1110
1111   aPI.SetShape(aRefShape);
1112
1113   //Compute the marker value
1114   try {
1115 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
1116     OCC_CATCH_SIGNALS;
1117 #endif
1118     if (!GetSolver()->ComputeFunction(aFunction)) {
1119       SetErrorCode("Marker driver failed");
1120       return NULL;
1121     }
1122   }
1123   catch (Standard_Failure) {
1124     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1125     SetErrorCode(aFail->GetMessageString());
1126     return NULL;
1127   }
1128
1129   //Make a Python command
1130   GEOM::TPythonDump(aFunction) << aMarker << " = geompy.MakeMarkerFromShape(" << theShape << ")";
1131
1132   SetErrorCode(OK);
1133   return aMarker;
1134 }
1135
1136 //=============================================================================
1137 /*!
1138  *  MakeMarkerPntTwoVec
1139  */
1140 //=============================================================================
1141 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerPntTwoVec
1142                                               (const Handle(GEOM_Object)& theOrigin,
1143                                                const Handle(GEOM_Object)& theXVec,
1144                                                const Handle(GEOM_Object)& theYVec)
1145 {
1146   SetErrorCode(KO);
1147
1148   //Add a new Marker object
1149   Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER);
1150
1151   //Add a new Marker function
1152   Handle(GEOM_Function) aFunction =
1153     aMarker->AddFunction(GEOMImpl_MarkerDriver::GetID(), MARKER_PNT2VEC);
1154   if (aFunction.IsNull()) return NULL;
1155
1156   //Check if the function is set correctly
1157   if (aFunction->GetDriverGUID() != GEOMImpl_MarkerDriver::GetID()) return NULL;
1158
1159   GEOMImpl_IMarker aPI(aFunction);
1160
1161   Handle(GEOM_Function) aRefOrigin = theOrigin->GetLastFunction();
1162   Handle(GEOM_Function) aRefXVec = theXVec->GetLastFunction();
1163   Handle(GEOM_Function) aRefYVec = theYVec->GetLastFunction();
1164   if (aRefOrigin.IsNull() || aRefXVec.IsNull() || aRefYVec.IsNull()) return NULL;
1165
1166   aPI.SetOrigin(aRefOrigin);
1167   aPI.SetXVec(aRefXVec);
1168   aPI.SetYVec(aRefYVec);
1169
1170   //Compute the marker value
1171   try {
1172 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
1173     OCC_CATCH_SIGNALS;
1174 #endif
1175     if (!GetSolver()->ComputeFunction(aFunction)) {
1176       SetErrorCode("Marker driver failed");
1177       return NULL;
1178     }
1179   }
1180   catch (Standard_Failure) {
1181     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1182     SetErrorCode(aFail->GetMessageString());
1183     return NULL;
1184   }
1185
1186   //Make a Python command
1187   GEOM::TPythonDump(aFunction) << aMarker << " = geompy.MakeMarkerPntTwoVec("
1188     << theOrigin << ", " << theXVec << ", " << theYVec << ")";
1189
1190   SetErrorCode(OK);
1191   return aMarker;
1192 }
1193
1194 //=============================================================================
1195 /*!
1196  *  MakeTangentPlaneOnFace
1197  */
1198 //=============================================================================
1199
1200 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Handle(GEOM_Object)& theFace,
1201                                                                       double theParamU,
1202                                                                       double theParamV,
1203                                                                       double theSize)
1204 {
1205    SetErrorCode(KO);
1206
1207   if (theFace.IsNull()) return NULL;
1208
1209   //Add a new Plane object
1210   Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
1211
1212   //Add a new Plane function
1213   Handle(GEOM_Function) aFunction =
1214     aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_TANGENT_FACE);
1215
1216   //Check if the function is set correctly
1217   if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
1218
1219   GEOMImpl_IPlane aPI (aFunction);
1220
1221   Handle(GEOM_Function) aRef = theFace->GetLastFunction();
1222   if (aRef.IsNull()) return NULL;
1223
1224   aPI.SetFace(aRef);
1225   aPI.SetSize(theSize);
1226   aPI.SetParameterU(theParamU);
1227   aPI.SetParameterV(theParamV);
1228
1229   //Compute the Plane value
1230   try {
1231 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
1232     OCC_CATCH_SIGNALS;
1233 #endif
1234     if (!GetSolver()->ComputeFunction(aFunction)) {
1235       SetErrorCode("Plane driver failed");
1236       return NULL;
1237     }
1238   }
1239   catch (Standard_Failure) {
1240     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1241     SetErrorCode(aFail->GetMessageString());
1242     return NULL;
1243   }
1244
1245   //Make a Python command
1246   GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakeTangentPlaneOnFace("
1247                                << theFace << ", " <<theParamU <<", "<<theParamV <<", "<< theSize << ")";
1248
1249   SetErrorCode(OK);
1250   return aPlane;
1251 }
1252
1253