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