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