1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <Standard_Stream.hxx>
22 #include <GEOMImpl_ICurvesOperations.hxx>
24 #include <GEOM_Function.hxx>
25 #include <GEOM_PythonDump.hxx>
27 #include <GEOMImpl_Types.hxx>
29 #include <GEOMImpl_PolylineDriver.hxx>
30 #include <GEOMImpl_CircleDriver.hxx>
31 #include <GEOMImpl_SplineDriver.hxx>
32 #include <GEOMImpl_EllipseDriver.hxx>
33 #include <GEOMImpl_ArcDriver.hxx>
34 #include <GEOMImpl_SketcherDriver.hxx>
36 #include <GEOMImpl_IPolyline.hxx>
37 #include <GEOMImpl_ICircle.hxx>
38 #include <GEOMImpl_ISpline.hxx>
39 #include <GEOMImpl_IEllipse.hxx>
40 #include <GEOMImpl_IArc.hxx>
41 #include <GEOMImpl_ISketcher.hxx>
43 #include "utilities.h"
45 #include <TDF_Tool.hxx>
47 #include <Standard_Failure.hxx>
48 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
52 //=============================================================================
56 //=============================================================================
57 GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations (GEOM_Engine* theEngine, int theDocID)
58 : GEOM_IOperations(theEngine, theDocID)
60 MESSAGE("GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations");
63 //=============================================================================
67 //=============================================================================
68 GEOMImpl_ICurvesOperations::~GEOMImpl_ICurvesOperations()
70 MESSAGE("GEOMImpl_ICurvesOperations::~GEOMImpl_ICurvesOperations");
74 //=============================================================================
78 //=============================================================================
79 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline (list<Handle(GEOM_Object)> thePoints)
83 //Add a new Polyline object
84 Handle(GEOM_Object) aPolyline = GetEngine()->AddObject(GetDocID(), GEOM_POLYLINE);
86 //Add a new Polyline function for creation a polyline relatively to points set
87 Handle(GEOM_Function) aFunction =
88 aPolyline->AddFunction(GEOMImpl_PolylineDriver::GetID(), POLYLINE_POINTS);
89 if (aFunction.IsNull()) return NULL;
91 //Check if the function is set correctly
92 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) return NULL;
94 GEOMImpl_IPolyline aCI (aFunction);
96 int aLen = thePoints.size();
100 list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
101 for (; it != thePoints.end(); it++, ind++) {
102 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
103 if (aRefPnt.IsNull()) {
104 SetErrorCode("NULL point for Polyline");
107 aCI.SetPoint(ind, aRefPnt);
110 //Compute the Polyline value
112 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
115 if (!GetSolver()->ComputeFunction(aFunction)) {
116 SetErrorCode("Polyline driver failed");
120 catch (Standard_Failure) {
121 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
122 SetErrorCode(aFail->GetMessageString());
126 //Make a Python command
127 GEOM::TPythonDump pd (aFunction);
128 pd << aPolyline << " = geompy.MakePolyline([";
130 it = thePoints.begin();
132 while (it != thePoints.end()) {
133 pd << ", " << (*it++);
141 //=============================================================================
145 //=============================================================================
146 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleThreePnt (Handle(GEOM_Object) thePnt1,
147 Handle(GEOM_Object) thePnt2,
148 Handle(GEOM_Object) thePnt3)
152 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
154 //Add a new Circle object
155 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE);
157 //Add a new Circle function for creation a circle relatively to three points
158 Handle(GEOM_Function) aFunction =
159 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_THREE_PNT);
160 if (aFunction.IsNull()) return NULL;
162 //Check if the function is set correctly
163 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
165 GEOMImpl_ICircle aCI (aFunction);
167 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
168 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
169 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
171 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
173 aCI.SetPoint1(aRefPnt1);
174 aCI.SetPoint2(aRefPnt2);
175 aCI.SetPoint3(aRefPnt3);
177 //Compute the Circle value
179 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
182 if (!GetSolver()->ComputeFunction(aFunction)) {
183 SetErrorCode("Circle driver failed");
187 catch (Standard_Failure) {
188 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
189 SetErrorCode(aFail->GetMessageString());
193 //Make a Python command
194 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircleThreePnt("
195 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
201 //=============================================================================
203 * MakeCircleCenter2Pnt
205 //=============================================================================
206 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleCenter2Pnt (Handle(GEOM_Object) thePnt1,
207 Handle(GEOM_Object) thePnt2,
208 Handle(GEOM_Object) thePnt3)
212 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
214 //Add a new Circle object
215 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE);
217 //Add a new Circle function for creation a circle relatively to center and 2 points
218 Handle(GEOM_Function) aFunction =
219 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_CENTER_TWO_PNT);
220 if (aFunction.IsNull()) return NULL;
222 //Check if the function is set correctly
223 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
225 GEOMImpl_ICircle aCI (aFunction);
227 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
228 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
229 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
231 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
233 aCI.SetPoint1(aRefPnt1);
234 aCI.SetPoint2(aRefPnt2);
235 aCI.SetPoint3(aRefPnt3);
237 //Compute the Circle value
239 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
242 if (!GetSolver()->ComputeFunction(aFunction)) {
243 SetErrorCode("Circle driver failed");
247 catch (Standard_Failure) {
248 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
249 SetErrorCode(aFail->GetMessageString());
253 //Make a Python command
254 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircleCenter2Pnt("
255 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
261 //=============================================================================
265 //=============================================================================
266 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR
267 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, double theR)
271 if (thePnt.IsNull() || theVec.IsNull()) return NULL;
273 //Add a new Circle object
274 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE);
276 //Add a new Circle function for creation a circle relatively to point and vector
277 Handle(GEOM_Function) aFunction =
278 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_PNT_VEC_R);
279 if (aFunction.IsNull()) return NULL;
281 //Check if the function is set correctly
282 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
284 GEOMImpl_ICircle aCI (aFunction);
286 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
287 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
289 if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
291 aCI.SetCenter(aRefPnt);
292 aCI.SetVector(aRefVec);
295 //Compute the Circle value
297 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
300 if (!GetSolver()->ComputeFunction(aFunction)) {
301 SetErrorCode("Circle driver failed");
305 catch (Standard_Failure) {
306 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
307 SetErrorCode(aFail->GetMessageString());
311 //Make a Python command
312 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircle("
313 << thePnt << ", " << theVec << ", " << theR << ")";
319 //=============================================================================
323 //=============================================================================
324 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse
325 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec,
326 double theRMajor, double theRMinor)
330 if (thePnt.IsNull() || theVec.IsNull()) return NULL;
332 //Add a new Ellipse object
333 Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_ELLIPSE);
335 //Add a new Ellipse function
336 Handle(GEOM_Function) aFunction =
337 anEll->AddFunction(GEOMImpl_EllipseDriver::GetID(), ELLIPSE_PNT_VEC_RR);
338 if (aFunction.IsNull()) return NULL;
340 //Check if the function is set correctly
341 if (aFunction->GetDriverGUID() != GEOMImpl_EllipseDriver::GetID()) return NULL;
343 GEOMImpl_IEllipse aCI (aFunction);
345 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
346 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
348 if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
350 aCI.SetCenter(aRefPnt);
351 aCI.SetVector(aRefVec);
352 aCI.SetRMajor(theRMajor);
353 aCI.SetRMinor(theRMinor);
355 //Compute the Ellipse value
357 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
360 if (!GetSolver()->ComputeFunction(aFunction)) {
361 SetErrorCode("Ellipse driver failed");
365 catch (Standard_Failure) {
366 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
367 SetErrorCode(aFail->GetMessageString());
371 //Make a Python command
372 GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse("
373 << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")";
379 //=============================================================================
383 //=============================================================================
384 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArc (Handle(GEOM_Object) thePnt1,
385 Handle(GEOM_Object) thePnt2,
386 Handle(GEOM_Object) thePnt3)
390 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
392 //Add a new Circle Arc object
393 Handle(GEOM_Object) anArc = GetEngine()->AddObject(GetDocID(), GEOM_CIRC_ARC);
395 //Add a new Circle Arc function
396 Handle(GEOM_Function) aFunction =
397 anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_THREE_PNT);
399 if (aFunction.IsNull()) return NULL;
401 //Check if the function is set correctly
402 if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
403 GEOMImpl_IArc aCI (aFunction);
405 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
406 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
407 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
410 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
412 aCI.SetPoint1(aRefPnt1);
413 aCI.SetPoint2(aRefPnt2);
414 aCI.SetPoint3(aRefPnt3);
416 //Compute the Arc value
418 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
421 if (!GetSolver()->ComputeFunction(aFunction)) {
422 SetErrorCode("Arc driver failed");
426 catch (Standard_Failure) {
427 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
428 SetErrorCode(aFail->GetMessageString());
432 //Make a Python command
433 GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArc("
434 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
440 //=============================================================================
444 //=============================================================================
445 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcCenter (Handle(GEOM_Object) thePnt1,
446 Handle(GEOM_Object) thePnt2,
447 Handle(GEOM_Object) thePnt3,
451 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
453 //Add a new Circle Arc object
454 Handle(GEOM_Object) anArc = GetEngine()->AddObject(GetDocID(), GEOM_CIRC_ARC);
456 //Add a new Circle Arc function
457 Handle(GEOM_Function) aFunction =
458 anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_CENTER);
459 if (aFunction.IsNull()) return NULL;
461 //Check if the function is set correctly
462 if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
464 GEOMImpl_IArc aCI (aFunction);
466 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
467 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
468 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
470 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
472 aCI.SetPoint1(aRefPnt1);
473 aCI.SetPoint2(aRefPnt2);
474 aCI.SetPoint3(aRefPnt3);
475 aCI.SetSense(theSense);
477 //Compute the Arc value
479 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
482 if (!GetSolver()->ComputeFunction(aFunction)) {
483 SetErrorCode("Arc driver failed");
487 catch (Standard_Failure) {
488 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
489 SetErrorCode(aFail->GetMessageString());
492 //Make a Python command
493 GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArcCenter("
494 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << "," << theSense << ")";
500 //=============================================================================
504 //=============================================================================
505 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier
506 (list<Handle(GEOM_Object)> thePoints)
510 //Add a new Spline object
511 Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE);
513 //Add a new Spline function for creation a bezier curve relatively to points set
514 Handle(GEOM_Function) aFunction =
515 aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_BEZIER);
516 if (aFunction.IsNull()) return NULL;
518 //Check if the function is set correctly
519 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
521 GEOMImpl_ISpline aCI (aFunction);
523 int aLen = thePoints.size();
527 list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
528 for (; it != thePoints.end(); it++, ind++) {
529 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
531 if (aRefPnt.IsNull()) return NULL;
533 aCI.SetPoint(ind, aRefPnt);
536 //Compute the Spline value
538 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
541 if (!GetSolver()->ComputeFunction(aFunction)) {
542 SetErrorCode("Spline driver failed");
546 catch (Standard_Failure) {
547 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
548 SetErrorCode(aFail->GetMessageString());
552 //Make a Python command
553 GEOM::TPythonDump pd (aFunction);
554 pd << aSpline << " = geompy.MakeBezier([";
556 it = thePoints.begin();
558 while (it != thePoints.end()) {
559 pd << ", " << (*it++);
567 //=============================================================================
569 * MakeSplineInterpolation
571 //=============================================================================
572 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation
573 (list<Handle(GEOM_Object)> thePoints)
577 //Add a new Spline object
578 Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE);
580 //Add a new Spline function for creation a bezier curve relatively to points set
581 Handle(GEOM_Function) aFunction =
582 aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOLATION);
583 if (aFunction.IsNull()) return NULL;
585 //Check if the function is set correctly
586 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
588 GEOMImpl_ISpline aCI (aFunction);
590 int aLen = thePoints.size();
594 list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
595 for (; it != thePoints.end(); it++, ind++) {
596 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
598 if (aRefPnt.IsNull()) return NULL;
600 aCI.SetPoint(ind, aRefPnt);
603 //Compute the Spline value
605 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
608 if (!GetSolver()->ComputeFunction(aFunction)) {
609 SetErrorCode("Spline driver failed");
613 catch (Standard_Failure) {
614 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
615 SetErrorCode(aFail->GetMessageString());
619 //Make a Python command
620 GEOM::TPythonDump pd (aFunction);
621 pd << aSpline << " = geompy.MakeInterpol([";
623 it = thePoints.begin();
625 while (it != thePoints.end()) {
626 pd << ", " << (*it++);
634 //=============================================================================
638 //=============================================================================
639 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCommand,
640 list<double> theWorkingPlane)
644 if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
646 //Add a new Sketcher object
647 Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER);
649 //Add a new Sketcher function
650 Handle(GEOM_Function) aFunction =
651 aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_NINE_DOUBLS);
652 if (aFunction.IsNull()) return NULL;
654 //Check if the function is set correctly
655 if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL;
657 GEOMImpl_ISketcher aCI (aFunction);
659 TCollection_AsciiString aCommand((char*) theCommand);
660 aCI.SetCommand(aCommand);
663 list<double>::iterator it = theWorkingPlane.begin();
664 for (; it != theWorkingPlane.end(); it++, ind++)
665 aCI.SetWorkingPlane(ind, *it);
667 //Compute the Sketcher value
669 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
672 if (!GetSolver()->ComputeFunction(aFunction)) {
673 SetErrorCode("Sketcher driver failed");
677 catch (Standard_Failure) {
678 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
679 SetErrorCode(aFail->GetMessageString());
683 //Make a Python command
684 GEOM::TPythonDump pd (aFunction);
685 pd << aSketcher << " = geompy.MakeSketcher(\"" << aCommand.ToCString() << "\", [";
687 it = theWorkingPlane.begin();
689 while (it != theWorkingPlane.end()) {
690 pd << ", " << (*it++);
698 //=============================================================================
700 * MakeSketcherOnPlane
702 //=============================================================================
703 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane (const char* theCommand,
704 Handle(GEOM_Object) theWorkingPlane)
708 if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
710 //Add a new Sketcher object
711 Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER);
713 //Add a new Sketcher function
714 Handle(GEOM_Function) aFunction =
715 aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_PLANE);
716 if (aFunction.IsNull()) return NULL;
718 //Check if the function is set correctly
719 if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL;
721 GEOMImpl_ISketcher aCI (aFunction);
723 TCollection_AsciiString aCommand((char*) theCommand);
724 aCI.SetCommand(aCommand);
726 Handle(GEOM_Function) aRefPlane = theWorkingPlane->GetLastFunction();
727 if (aRefPlane.IsNull()) return NULL;
728 aCI.SetWorkingPlane( aRefPlane );
730 //Compute the Sketcher value
732 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
735 if (!GetSolver()->ComputeFunction(aFunction)) {
736 SetErrorCode("Sketcher driver failed");
740 catch (Standard_Failure) {
741 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
742 SetErrorCode(aFail->GetMessageString());
746 //Make a Python command
747 GEOM::TPythonDump (aFunction) << aSketcher << " = geompy.MakeSketcherOnPlane(\""
748 << aCommand.ToCString() << "\", " << theWorkingPlane << " )";