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