1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include <Standard_Stream.hxx>
24 #include <GEOMImpl_ICurvesOperations.hxx>
26 #include <GEOM_Function.hxx>
27 #include <GEOM_PythonDump.hxx>
29 #include <GEOMImpl_Types.hxx>
31 #include <GEOMImpl_PolylineDriver.hxx>
32 #include <GEOMImpl_CircleDriver.hxx>
33 #include <GEOMImpl_SplineDriver.hxx>
34 #include <GEOMImpl_EllipseDriver.hxx>
35 #include <GEOMImpl_ArcDriver.hxx>
36 #include <GEOMImpl_SketcherDriver.hxx>
38 #include <GEOMImpl_IPolyline.hxx>
39 #include <GEOMImpl_ICircle.hxx>
40 #include <GEOMImpl_ISpline.hxx>
41 #include <GEOMImpl_IEllipse.hxx>
42 #include <GEOMImpl_IArc.hxx>
43 #include <GEOMImpl_ISketcher.hxx>
45 #include "utilities.h"
47 #include <TDF_Tool.hxx>
49 #include <Standard_Failure.hxx>
50 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
54 //=============================================================================
58 //=============================================================================
59 GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations (GEOM_Engine* theEngine, int theDocID)
60 : GEOM_IOperations(theEngine, theDocID)
62 MESSAGE("GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations");
65 //=============================================================================
69 //=============================================================================
70 GEOMImpl_ICurvesOperations::~GEOMImpl_ICurvesOperations()
72 MESSAGE("GEOMImpl_ICurvesOperations::~GEOMImpl_ICurvesOperations");
76 //=============================================================================
80 //=============================================================================
81 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline (list<Handle(GEOM_Object)> thePoints)
85 //Add a new Polyline object
86 Handle(GEOM_Object) aPolyline = GetEngine()->AddObject(GetDocID(), GEOM_POLYLINE);
88 //Add a new Polyline function for creation a polyline relatively to points set
89 Handle(GEOM_Function) aFunction =
90 aPolyline->AddFunction(GEOMImpl_PolylineDriver::GetID(), POLYLINE_POINTS);
91 if (aFunction.IsNull()) return NULL;
93 //Check if the function is set correctly
94 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) return NULL;
96 GEOMImpl_IPolyline aCI (aFunction);
98 int aLen = thePoints.size();
102 list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
103 for (; it != thePoints.end(); it++, ind++) {
104 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
105 if (aRefPnt.IsNull()) {
106 SetErrorCode("NULL point for Polyline");
109 aCI.SetPoint(ind, aRefPnt);
112 //Compute the Polyline value
114 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
117 if (!GetSolver()->ComputeFunction(aFunction)) {
118 SetErrorCode("Polyline driver failed");
122 catch (Standard_Failure) {
123 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
124 SetErrorCode(aFail->GetMessageString());
128 //Make a Python command
129 GEOM::TPythonDump pd (aFunction);
130 pd << aPolyline << " = geompy.MakePolyline([";
132 it = thePoints.begin();
134 while (it != thePoints.end()) {
135 pd << ", " << (*it++);
143 //=============================================================================
147 //=============================================================================
148 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleThreePnt (Handle(GEOM_Object) thePnt1,
149 Handle(GEOM_Object) thePnt2,
150 Handle(GEOM_Object) thePnt3)
154 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
156 //Add a new Circle object
157 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE);
159 //Add a new Circle function for creation a circle relatively to three points
160 Handle(GEOM_Function) aFunction =
161 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_THREE_PNT);
162 if (aFunction.IsNull()) return NULL;
164 //Check if the function is set correctly
165 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
167 GEOMImpl_ICircle aCI (aFunction);
169 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
170 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
171 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
173 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
175 aCI.SetPoint1(aRefPnt1);
176 aCI.SetPoint2(aRefPnt2);
177 aCI.SetPoint3(aRefPnt3);
179 //Compute the Circle value
181 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
184 if (!GetSolver()->ComputeFunction(aFunction)) {
185 SetErrorCode("Circle driver failed");
189 catch (Standard_Failure) {
190 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
191 SetErrorCode(aFail->GetMessageString());
195 //Make a Python command
196 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircleThreePnt("
197 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
203 //=============================================================================
205 * MakeCircleCenter2Pnt
207 //=============================================================================
208 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleCenter2Pnt (Handle(GEOM_Object) thePnt1,
209 Handle(GEOM_Object) thePnt2,
210 Handle(GEOM_Object) thePnt3)
214 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
216 //Add a new Circle object
217 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE);
219 //Add a new Circle function for creation a circle relatively to center and 2 points
220 Handle(GEOM_Function) aFunction =
221 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_CENTER_TWO_PNT);
222 if (aFunction.IsNull()) return NULL;
224 //Check if the function is set correctly
225 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
227 GEOMImpl_ICircle aCI (aFunction);
229 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
230 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
231 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
233 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
235 aCI.SetPoint1(aRefPnt1);
236 aCI.SetPoint2(aRefPnt2);
237 aCI.SetPoint3(aRefPnt3);
239 //Compute the Circle value
241 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
244 if (!GetSolver()->ComputeFunction(aFunction)) {
245 SetErrorCode("Circle driver failed");
249 catch (Standard_Failure) {
250 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
251 SetErrorCode(aFail->GetMessageString());
255 //Make a Python command
256 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircleCenter2Pnt("
257 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
263 //=============================================================================
267 //=============================================================================
268 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR
269 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, double theR)
273 if (thePnt.IsNull() || theVec.IsNull()) return NULL;
275 //Add a new Circle object
276 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE);
278 //Add a new Circle function for creation a circle relatively to point and vector
279 Handle(GEOM_Function) aFunction =
280 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_PNT_VEC_R);
281 if (aFunction.IsNull()) return NULL;
283 //Check if the function is set correctly
284 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
286 GEOMImpl_ICircle aCI (aFunction);
288 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
289 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
291 if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
293 aCI.SetCenter(aRefPnt);
294 aCI.SetVector(aRefVec);
297 //Compute the Circle value
299 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
302 if (!GetSolver()->ComputeFunction(aFunction)) {
303 SetErrorCode("Circle driver failed");
307 catch (Standard_Failure) {
308 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
309 SetErrorCode(aFail->GetMessageString());
313 //Make a Python command
314 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircle("
315 << thePnt << ", " << theVec << ", " << theR << ")";
321 //=============================================================================
325 //=============================================================================
326 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse
327 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec,
328 double theRMajor, double theRMinor)
332 if (thePnt.IsNull() || theVec.IsNull()) return NULL;
334 //Add a new Ellipse object
335 Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_ELLIPSE);
337 //Add a new Ellipse function
338 Handle(GEOM_Function) aFunction =
339 anEll->AddFunction(GEOMImpl_EllipseDriver::GetID(), ELLIPSE_PNT_VEC_RR);
340 if (aFunction.IsNull()) return NULL;
342 //Check if the function is set correctly
343 if (aFunction->GetDriverGUID() != GEOMImpl_EllipseDriver::GetID()) return NULL;
345 GEOMImpl_IEllipse aCI (aFunction);
347 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
348 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
350 if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
352 aCI.SetCenter(aRefPnt);
353 aCI.SetVector(aRefVec);
354 aCI.SetRMajor(theRMajor);
355 aCI.SetRMinor(theRMinor);
357 //Compute the Ellipse value
359 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
362 if (!GetSolver()->ComputeFunction(aFunction)) {
363 SetErrorCode("Ellipse driver failed");
367 catch (Standard_Failure) {
368 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
369 SetErrorCode(aFail->GetMessageString());
373 //Make a Python command
374 GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse("
375 << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")";
381 //=============================================================================
385 //=============================================================================
386 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArc (Handle(GEOM_Object) thePnt1,
387 Handle(GEOM_Object) thePnt2,
388 Handle(GEOM_Object) thePnt3)
392 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
394 //Add a new Circle Arc object
395 Handle(GEOM_Object) anArc = GetEngine()->AddObject(GetDocID(), GEOM_CIRC_ARC);
397 //Add a new Circle Arc function
398 Handle(GEOM_Function) aFunction =
399 anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_THREE_PNT);
401 if (aFunction.IsNull()) return NULL;
403 //Check if the function is set correctly
404 if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
405 GEOMImpl_IArc aCI (aFunction);
407 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
408 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
409 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
412 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
414 aCI.SetPoint1(aRefPnt1);
415 aCI.SetPoint2(aRefPnt2);
416 aCI.SetPoint3(aRefPnt3);
418 //Compute the Arc value
420 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
423 if (!GetSolver()->ComputeFunction(aFunction)) {
424 SetErrorCode("Arc driver failed");
428 catch (Standard_Failure) {
429 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
430 SetErrorCode(aFail->GetMessageString());
434 //Make a Python command
435 GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArc("
436 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
442 //=============================================================================
446 //=============================================================================
447 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcCenter (Handle(GEOM_Object) thePnt1,
448 Handle(GEOM_Object) thePnt2,
449 Handle(GEOM_Object) thePnt3,
453 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
455 //Add a new Circle Arc object
456 Handle(GEOM_Object) anArc = GetEngine()->AddObject(GetDocID(), GEOM_CIRC_ARC);
458 //Add a new Circle Arc function
459 Handle(GEOM_Function) aFunction =
460 anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_CENTER);
461 if (aFunction.IsNull()) return NULL;
463 //Check if the function is set correctly
464 if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
466 GEOMImpl_IArc aCI (aFunction);
468 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
469 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
470 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
472 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
474 aCI.SetPoint1(aRefPnt1);
475 aCI.SetPoint2(aRefPnt2);
476 aCI.SetPoint3(aRefPnt3);
477 aCI.SetSense(theSense);
479 //Compute the Arc value
481 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
484 if (!GetSolver()->ComputeFunction(aFunction)) {
485 SetErrorCode("Arc driver failed");
489 catch (Standard_Failure) {
490 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
491 SetErrorCode(aFail->GetMessageString());
494 //Make a Python command
495 GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArcCenter("
496 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << "," << theSense << ")";
502 //=============================================================================
506 //=============================================================================
507 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier
508 (list<Handle(GEOM_Object)> thePoints)
512 //Add a new Spline object
513 Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE);
515 //Add a new Spline function for creation a bezier curve relatively to points set
516 Handle(GEOM_Function) aFunction =
517 aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_BEZIER);
518 if (aFunction.IsNull()) return NULL;
520 //Check if the function is set correctly
521 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
523 GEOMImpl_ISpline aCI (aFunction);
525 int aLen = thePoints.size();
529 list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
530 for (; it != thePoints.end(); it++, ind++) {
531 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
533 if (aRefPnt.IsNull()) return NULL;
535 aCI.SetPoint(ind, aRefPnt);
538 //Compute the Spline value
540 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
543 if (!GetSolver()->ComputeFunction(aFunction)) {
544 SetErrorCode("Spline driver failed");
548 catch (Standard_Failure) {
549 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
550 SetErrorCode(aFail->GetMessageString());
554 //Make a Python command
555 GEOM::TPythonDump pd (aFunction);
556 pd << aSpline << " = geompy.MakeBezier([";
558 it = thePoints.begin();
560 while (it != thePoints.end()) {
561 pd << ", " << (*it++);
569 //=============================================================================
571 * MakeSplineInterpolation
573 //=============================================================================
574 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation
575 (list<Handle(GEOM_Object)> thePoints)
579 //Add a new Spline object
580 Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE);
582 //Add a new Spline function for creation a bezier curve relatively to points set
583 Handle(GEOM_Function) aFunction =
584 aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOLATION);
585 if (aFunction.IsNull()) return NULL;
587 //Check if the function is set correctly
588 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
590 GEOMImpl_ISpline aCI (aFunction);
592 int aLen = thePoints.size();
596 list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
597 for (; it != thePoints.end(); it++, ind++) {
598 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
600 if (aRefPnt.IsNull()) return NULL;
602 aCI.SetPoint(ind, aRefPnt);
605 //Compute the Spline value
607 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
610 if (!GetSolver()->ComputeFunction(aFunction)) {
611 SetErrorCode("Spline driver failed");
615 catch (Standard_Failure) {
616 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
617 SetErrorCode(aFail->GetMessageString());
621 //Make a Python command
622 GEOM::TPythonDump pd (aFunction);
623 pd << aSpline << " = geompy.MakeInterpol([";
625 it = thePoints.begin();
627 while (it != thePoints.end()) {
628 pd << ", " << (*it++);
636 //=============================================================================
640 //=============================================================================
641 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCommand,
642 list<double> theWorkingPlane)
646 if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
648 //Add a new Sketcher object
649 Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER);
651 //Add a new Sketcher function
652 Handle(GEOM_Function) aFunction =
653 aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_NINE_DOUBLS);
654 if (aFunction.IsNull()) return NULL;
656 //Check if the function is set correctly
657 if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL;
659 GEOMImpl_ISketcher aCI (aFunction);
661 TCollection_AsciiString aCommand((char*) theCommand);
662 aCI.SetCommand(aCommand);
665 list<double>::iterator it = theWorkingPlane.begin();
666 for (; it != theWorkingPlane.end(); it++, ind++)
667 aCI.SetWorkingPlane(ind, *it);
669 //Compute the Sketcher value
671 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
674 if (!GetSolver()->ComputeFunction(aFunction)) {
675 SetErrorCode("Sketcher driver failed");
679 catch (Standard_Failure) {
680 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
681 SetErrorCode(aFail->GetMessageString());
685 //Make a Python command
686 GEOM::TPythonDump pd (aFunction);
687 pd << aSketcher << " = geompy.MakeSketcher(\"" << aCommand.ToCString() << "\", [";
689 it = theWorkingPlane.begin();
691 while (it != theWorkingPlane.end()) {
692 pd << ", " << (*it++);
700 //=============================================================================
702 * MakeSketcherOnPlane
704 //=============================================================================
705 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane (const char* theCommand,
706 Handle(GEOM_Object) theWorkingPlane)
710 if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
712 //Add a new Sketcher object
713 Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER);
715 //Add a new Sketcher function
716 Handle(GEOM_Function) aFunction =
717 aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_PLANE);
718 if (aFunction.IsNull()) return NULL;
720 //Check if the function is set correctly
721 if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL;
723 GEOMImpl_ISketcher aCI (aFunction);
725 TCollection_AsciiString aCommand((char*) theCommand);
726 aCI.SetCommand(aCommand);
728 Handle(GEOM_Function) aRefPlane = theWorkingPlane->GetLastFunction();
729 if (aRefPlane.IsNull()) return NULL;
730 aCI.SetWorkingPlane( aRefPlane );
732 //Compute the Sketcher value
734 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
737 if (!GetSolver()->ComputeFunction(aFunction)) {
738 SetErrorCode("Sketcher driver failed");
742 catch (Standard_Failure) {
743 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
744 SetErrorCode(aFail->GetMessageString());
748 //Make a Python command
749 GEOM::TPythonDump (aFunction) << aSketcher << " = geompy.MakeSketcherOnPlane(\""
750 << aCommand.ToCString() << "\", " << theWorkingPlane << " )";