1 // Copyright (C) 2007-2024 CEA, EDF, 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, or (at your option) any later version.
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
24 // E.A. : On windows with python 2.6, there is a conflict
25 // E.A. : between pymath.h and Standard_math.h which define
26 // E.A. : some same symbols : acosh, asinh, ...
27 #include <Standard_math.hxx>
34 #include <structmember.h>
40 #include "GEOMImpl_ICurvesOperations.hxx"
41 #include "GEOMImpl_Types.hxx"
43 #include "GEOM_Function.hxx"
44 #include "GEOM_PythonDump.hxx"
46 #include "GEOMImpl_PolylineDriver.hxx"
47 #include "GEOMImpl_CircleDriver.hxx"
48 #include "GEOMImpl_SplineDriver.hxx"
49 #include "GEOMImpl_EllipseDriver.hxx"
50 #include "GEOMImpl_ArcDriver.hxx"
51 #include "GEOMImpl_ShapeDriver.hxx"
52 #include "GEOMImpl_SketcherDriver.hxx"
53 #include "GEOMImpl_3DSketcherDriver.hxx"
55 #include "GEOMImpl_IPolyline.hxx"
56 #include "GEOMImpl_IPolyline2D.hxx"
57 #include "GEOMImpl_ICircle.hxx"
58 #include "GEOMImpl_ISpline.hxx"
59 #include "GEOMImpl_IEllipse.hxx"
60 #include "GEOMImpl_IArc.hxx"
61 #include "GEOMImpl_ISketcher.hxx"
62 #include "GEOMImpl_I3DSketcher.hxx"
63 #include "GEOMImpl_ICurveParametric.hxx"
64 #include "GEOMImpl_IIsoline.hxx"
65 #include "GEOMImpl_PolylineDumper.hxx"
67 #include "utilities.h"
69 #include <TDF_Tool.hxx>
70 #include <TColStd_HArray1OfByte.hxx>
71 #include <TColStd_HArray1OfReal.hxx>
73 #include <Standard_Failure.hxx>
74 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
77 /* ==================================
78 * =========== PYTHON ==============
79 * ==================================*/
90 PyStdOut_dealloc(PyStdOut *self)
96 PyStdOut_write(PyStdOut* self, PyObject* args)
99 if (!PyArg_ParseTuple(args, "s", &c))
102 *(self->out) = *(self->out) + c;
108 static PyMethodDef PyStdOut_methods[] = {
109 {"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
110 PyDoc_STR("write(string) -> None")},
111 {0, 0, 0, 0} /* sentinel */
114 static PyMemberDef PyStdOut_memberlist[] = {
115 {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
116 (char*)"flag indicating that a space needs to be printed; used by print"},
117 {0, 0, 0, 0, 0} /* sentinel */
120 static PyTypeObject PyStdOut_Type = {
121 /* The ob_type field must be initialized in the module init function
122 * to be portable to Windows without using C++. */
123 PyVarObject_HEAD_INIT(NULL, 0)
126 sizeof(PyStdOut), /*tp_basicsize*/
129 (destructor)PyStdOut_dealloc, /*tp_dealloc*/
136 0, /*tp_as_sequence*/
141 PyObject_GenericGetAttr, /*tp_getattro*/
142 /* softspace is writable: we must supply tp_setattro */
143 PyObject_GenericSetAttr, /* tp_setattro */
145 Py_TPFLAGS_DEFAULT, /*tp_flags*/
149 0, /*tp_richcompare*/
150 0, /*tp_weaklistoffset*/
153 PyStdOut_methods, /*tp_methods*/
154 PyStdOut_memberlist, /*tp_members*/
172 0, /*tp_version_tag*/
176 PyObject* newPyStdOut( std::string& out )
178 PyStdOut* self = PyObject_New(PyStdOut, &PyStdOut_Type);
183 return (PyObject*)self;
187 ////////////////////////END PYTHON///////////////////////////
188 //=============================================================================
192 //=============================================================================
193 GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations (GEOM_Engine* theEngine)
194 : GEOM_IOperations(theEngine)
196 MESSAGE("GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations");
199 //=============================================================================
203 //=============================================================================
204 GEOMImpl_ICurvesOperations::~GEOMImpl_ICurvesOperations()
206 MESSAGE("GEOMImpl_ICurvesOperations::~GEOMImpl_ICurvesOperations");
210 //=============================================================================
214 //=============================================================================
215 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleThreePnt (Handle(GEOM_Object) thePnt1,
216 Handle(GEOM_Object) thePnt2,
217 Handle(GEOM_Object) thePnt3)
221 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
223 //Add a new Circle object
224 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GEOM_CIRCLE);
226 //Add a new Circle function for creation a circle relatively to three points
227 Handle(GEOM_Function) aFunction =
228 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_THREE_PNT);
229 if (aFunction.IsNull()) return NULL;
231 //Check if the function is set correctly
232 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
234 GEOMImpl_ICircle aCI (aFunction);
236 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
237 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
238 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
240 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
242 aCI.SetPoint1(aRefPnt1);
243 aCI.SetPoint2(aRefPnt2);
244 aCI.SetPoint3(aRefPnt3);
246 //Compute the Circle value
249 if (!GetSolver()->ComputeFunction(aFunction)) {
250 SetErrorCode("Circle driver failed");
254 catch (Standard_Failure& aFail) {
255 SetErrorCode(aFail.GetMessageString());
259 //Make a Python command
260 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircleThreePnt("
261 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
267 //=============================================================================
269 * MakeCircleCenter2Pnt
271 //=============================================================================
272 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleCenter2Pnt (Handle(GEOM_Object) thePnt1,
273 Handle(GEOM_Object) thePnt2,
274 Handle(GEOM_Object) thePnt3)
278 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
280 //Add a new Circle object
281 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GEOM_CIRCLE);
283 //Add a new Circle function for creation a circle relatively to center and 2 points
284 Handle(GEOM_Function) aFunction =
285 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_CENTER_TWO_PNT);
286 if (aFunction.IsNull()) return NULL;
288 //Check if the function is set correctly
289 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
291 GEOMImpl_ICircle aCI (aFunction);
293 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
294 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
295 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
297 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
299 aCI.SetPoint1(aRefPnt1);
300 aCI.SetPoint2(aRefPnt2);
301 aCI.SetPoint3(aRefPnt3);
303 //Compute the Circle value
306 if (!GetSolver()->ComputeFunction(aFunction)) {
307 SetErrorCode("Circle driver failed");
311 catch (Standard_Failure& aFail) {
312 SetErrorCode(aFail.GetMessageString());
316 //Make a Python command
317 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircleCenter2Pnt("
318 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
324 //=============================================================================
328 //=============================================================================
329 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR
330 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, double theR)
334 // Not set thePnt means origin of global CS,
335 // Not set theVec means Z axis of global CS
336 //if (thePnt.IsNull() || theVec.IsNull()) return NULL;
338 //Add a new Circle object
339 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GEOM_CIRCLE);
341 //Add a new Circle function for creation a circle relatively to point and vector
342 Handle(GEOM_Function) aFunction =
343 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_PNT_VEC_R);
344 if (aFunction.IsNull()) return NULL;
346 //Check if the function is set correctly
347 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
349 GEOMImpl_ICircle aCI (aFunction);
351 if (!thePnt.IsNull()) {
352 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
353 if (aRefPnt.IsNull()) return NULL;
354 aCI.SetCenter(aRefPnt);
357 if (!theVec.IsNull()) {
358 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
359 if (aRefVec.IsNull()) return NULL;
360 aCI.SetVector(aRefVec);
365 //Compute the Circle value
368 if (!GetSolver()->ComputeFunction(aFunction)) {
369 SetErrorCode("Circle driver failed");
373 catch (Standard_Failure& aFail) {
374 SetErrorCode(aFail.GetMessageString());
378 //Make a Python command
379 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircle("
380 << thePnt << ", " << theVec << ", " << theR << ")";
386 //=============================================================================
390 //=============================================================================
391 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse
392 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec,
393 double theRMajor, double theRMinor,
394 Handle(GEOM_Object) theVecMaj)
398 // Not set thePnt means origin of global CS,
399 // Not set theVec means Z axis of global CS
400 // Not set theVecMaj means X axis of global CS
401 //if (thePnt.IsNull() || theVec.IsNull()) return NULL;
403 //Add a new Ellipse object
404 Handle(GEOM_Object) anEll = GetEngine()->AddObject(GEOM_ELLIPSE);
406 //Add a new Ellipse function
407 Handle(GEOM_Function) aFunction =
408 anEll->AddFunction(GEOMImpl_EllipseDriver::GetID(), ELLIPSE_PNT_VEC_RR);
409 if (aFunction.IsNull()) return NULL;
411 //Check if the function is set correctly
412 if (aFunction->GetDriverGUID() != GEOMImpl_EllipseDriver::GetID()) return NULL;
414 GEOMImpl_IEllipse aCI (aFunction);
416 if (!thePnt.IsNull()) {
417 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
418 if (aRefPnt.IsNull()) return NULL;
419 aCI.SetCenter(aRefPnt);
422 if (!theVec.IsNull()) {
423 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
424 if (aRefVec.IsNull()) return NULL;
425 aCI.SetVector(aRefVec);
428 aCI.SetRMajor(theRMajor);
429 aCI.SetRMinor(theRMinor);
431 if (!theVecMaj.IsNull()) {
432 Handle(GEOM_Function) aRefVecMaj = theVecMaj->GetLastFunction();
433 if (aRefVecMaj.IsNull()) return NULL;
434 aCI.SetVectorMajor(aRefVecMaj);
437 //Compute the Ellipse value
440 if (!GetSolver()->ComputeFunction(aFunction)) {
441 SetErrorCode("Ellipse driver failed");
445 catch (Standard_Failure& aFail) {
446 SetErrorCode(aFail.GetMessageString());
450 //Make a Python command
451 if (!theVecMaj.IsNull()) {
452 GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse("
453 << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor
454 << ", " << theVecMaj << ")";
457 GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse("
458 << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")";
465 //=============================================================================
469 //=============================================================================
470 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArc (Handle(GEOM_Object) thePnt1,
471 Handle(GEOM_Object) thePnt2,
472 Handle(GEOM_Object) thePnt3)
476 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
478 //Add a new Circle Arc object
479 Handle(GEOM_Object) anArc = GetEngine()->AddObject(GEOM_CIRC_ARC);
481 //Add a new Circle Arc function
482 Handle(GEOM_Function) aFunction =
483 anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_THREE_PNT);
485 if (aFunction.IsNull()) return NULL;
487 //Check if the function is set correctly
488 if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
489 GEOMImpl_IArc aCI (aFunction);
491 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
492 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
493 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
495 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
497 aCI.SetPoint1(aRefPnt1);
498 aCI.SetPoint2(aRefPnt2);
499 aCI.SetPoint3(aRefPnt3);
501 //Compute the Arc value
504 if (!GetSolver()->ComputeFunction(aFunction)) {
505 SetErrorCode("Arc driver failed");
509 catch (Standard_Failure& aFail) {
510 SetErrorCode(aFail.GetMessageString());
514 //Make a Python command
515 GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArc("
516 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
522 //=============================================================================
526 //=============================================================================
527 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcCenter (Handle(GEOM_Object) thePnt1,
528 Handle(GEOM_Object) thePnt2,
529 Handle(GEOM_Object) thePnt3,
533 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
535 //Add a new Circle Arc object
536 Handle(GEOM_Object) anArc = GetEngine()->AddObject(GEOM_CIRC_ARC);
538 //Add a new Circle Arc function
539 Handle(GEOM_Function) aFunction =
540 anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_CENTER);
541 if (aFunction.IsNull()) return NULL;
543 //Check if the function is set correctly
544 if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
546 GEOMImpl_IArc aCI (aFunction);
548 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
549 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
550 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
552 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
554 aCI.SetPoint1(aRefPnt1);
555 aCI.SetPoint2(aRefPnt2);
556 aCI.SetPoint3(aRefPnt3);
557 aCI.SetSense(theSense);
559 //Compute the Arc value
562 if (!GetSolver()->ComputeFunction(aFunction)) {
563 SetErrorCode("Arc driver failed");
567 catch (Standard_Failure& aFail) {
568 SetErrorCode(aFail.GetMessageString());
571 //Make a Python command
572 GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArcCenter("
573 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << "," << theSense << ")";
579 //=============================================================================
583 //=============================================================================
584 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcOfEllipse (Handle(GEOM_Object) thePnt1,
585 Handle(GEOM_Object) thePnt2,
586 Handle(GEOM_Object) thePnt3)
590 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
592 //Add a new Circle Arc object
593 Handle(GEOM_Object) anArc = GetEngine()->AddObject(GEOM_ELLIPSE_ARC);
595 //Add a new Circle Arc function
596 Handle(GEOM_Function) aFunction =
597 anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), ELLIPSE_ARC_CENTER_TWO_PNT);
599 if (aFunction.IsNull()) return NULL;
601 //Check if the function is set correctly
602 if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
603 GEOMImpl_IArc aCI (aFunction);
605 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
606 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
607 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
609 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
611 aCI.SetPoint1(aRefPnt1);
612 aCI.SetPoint2(aRefPnt2);
613 aCI.SetPoint3(aRefPnt3);
615 //Compute the Arc value
618 if (!GetSolver()->ComputeFunction(aFunction)) {
619 SetErrorCode("Arc driver failed");
623 catch (Standard_Failure& aFail) {
624 SetErrorCode(aFail.GetMessageString());
628 //Make a Python command
629 GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArcOfEllipse("
630 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
636 //=============================================================================
640 //=============================================================================
641 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline (std::list<Handle(GEOM_Object)> thePoints,
646 //Add a new Polyline object
647 Handle(GEOM_Object) aPolyline = GetEngine()->AddObject(GEOM_POLYLINE);
649 //Add a new Polyline function for creation a polyline relatively to points set
650 Handle(GEOM_Function) aFunction =
651 aPolyline->AddFunction(GEOMImpl_PolylineDriver::GetID(), POLYLINE_POINTS);
652 if (aFunction.IsNull()) return NULL;
654 //Check if the function is set correctly
655 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) return NULL;
657 GEOMImpl_IPolyline aCI (aFunction);
659 int aLen = thePoints.size();
661 aCI.SetConstructorType(POINT_CONSTRUCTOR);
664 std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
665 for (; it != thePoints.end(); it++, ind++) {
666 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
667 if (aRefPnt.IsNull()) {
668 SetErrorCode("NULL point for Polyline");
671 aCI.SetPoint(ind, aRefPnt);
674 aCI.SetIsClosed(theIsClosed);
676 //Compute the Polyline value
679 if (!GetSolver()->ComputeFunction(aFunction)) {
680 SetErrorCode("Polyline driver failed");
684 catch (Standard_Failure& aFail) {
685 SetErrorCode(aFail.GetMessageString());
689 //Make a Python command
690 GEOM::TPythonDump pd (aFunction);
691 pd << aPolyline << " = geompy.MakePolyline([";
693 it = thePoints.begin();
695 while (it != thePoints.end()) {
696 pd << ", " << (*it++);
698 pd << "], " << theIsClosed << ")";
704 //=============================================================================
708 //=============================================================================
709 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier
710 (std::list<Handle(GEOM_Object)> thePoints,
715 //Add a new Spline object
716 Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GEOM_SPLINE);
718 //Add a new Spline function for creation a bezier curve relatively to points set
719 Handle(GEOM_Function) aFunction =
720 aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_BEZIER);
721 if (aFunction.IsNull()) return NULL;
723 //Check if the function is set correctly
724 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
726 GEOMImpl_ISpline aCI (aFunction);
728 aCI.SetConstructorType(POINT_CONSTRUCTOR);
730 Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient;
731 std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
732 for (; it != thePoints.end(); it++) {
733 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
734 if (aRefPnt.IsNull()) {
735 SetErrorCode("NULL point for Besier curve");
738 aPoints->Append(aRefPnt);
740 aCI.SetPoints(aPoints);
742 aCI.SetIsClosed(theIsClosed);
744 //Compute the Spline value
747 if (!GetSolver()->ComputeFunction(aFunction)) {
748 SetErrorCode("Spline driver failed");
752 catch (Standard_Failure& aFail) {
753 SetErrorCode(aFail.GetMessageString());
757 //Make a Python command
758 GEOM::TPythonDump pd (aFunction);
759 pd << aSpline << " = geompy.MakeBezier([";
761 it = thePoints.begin();
763 while (it != thePoints.end()) {
764 pd << ", " << (*it++);
766 pd << "], " << theIsClosed << ")";
772 //=============================================================================
774 * MakeSplineInterpolation
776 //=============================================================================
777 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation
778 (std::list<Handle(GEOM_Object)> thePoints,
780 bool theDoReordering)
784 //Add a new Spline object
785 Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GEOM_SPLINE);
787 //Add a new Spline function for interpolation type
788 Handle(GEOM_Function) aFunction =
789 aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOLATION);
790 if (aFunction.IsNull()) return NULL;
792 //Check if the function is set correctly
793 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
795 GEOMImpl_ISpline aCI (aFunction);
797 aCI.SetConstructorType(POINT_CONSTRUCTOR);
799 Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient;
800 std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
801 for (; it != thePoints.end(); it++) {
802 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
803 if (aRefPnt.IsNull()) {
806 aPoints->Append(aRefPnt);
808 aCI.SetPoints(aPoints);
810 aCI.SetIsClosed(theIsClosed);
811 aCI.SetDoReordering(theDoReordering);
813 //Compute the Spline value
816 if (!GetSolver()->ComputeFunction(aFunction)) {
817 SetErrorCode("Spline driver failed");
821 catch (Standard_Failure& aFail) {
822 SetErrorCode(aFail.GetMessageString());
826 //Make a Python command
827 GEOM::TPythonDump pd (aFunction);
828 pd << aSpline << " = geompy.MakeInterpol([";
830 it = thePoints.begin();
832 while (it != thePoints.end()) {
833 pd << ", " << (*it++);
835 pd << "], " << theIsClosed << ", " << theDoReordering << ")";
842 //=============================================================================
844 * MakeSplineInterpolWithTangents
846 //=============================================================================
847 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolWithTangents
848 (std::list<Handle(GEOM_Object)> thePoints,
849 Handle(GEOM_Object) theFirstVec,
850 Handle(GEOM_Object) theLastVec)
854 //Add a new Spline object
855 Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GEOM_SPLINE);
857 //Add a new Spline function for interpolation type
858 Handle(GEOM_Function) aFunction =
859 aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOL_TANGENTS);
860 if (aFunction.IsNull()) return NULL;
862 //Check if the function is set correctly
863 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
865 GEOMImpl_ISpline aCI (aFunction);
867 aCI.SetConstructorType(POINT_CONSTRUCTOR);
869 Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient;
870 std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
871 for (; it != thePoints.end(); it++) {
872 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
873 if (aRefPnt.IsNull()) {
874 SetErrorCode("NULL point for Interpolation");
877 aPoints->Append(aRefPnt);
879 aCI.SetPoints(aPoints);
881 Handle(GEOM_Function) aVec1 = theFirstVec->GetLastFunction();
882 Handle(GEOM_Function) aVec2 = theLastVec->GetLastFunction();
884 if (aVec1.IsNull() || aVec2.IsNull()) return NULL;
886 aCI.SetFirstVector(aVec1);
887 aCI.SetLastVector(aVec2);
889 //Compute the Spline value
892 if (!GetSolver()->ComputeFunction(aFunction)) {
893 SetErrorCode("Spline driver failed");
897 catch (Standard_Failure& aFail) {
898 SetErrorCode(aFail.GetMessageString());
902 //Make a Python command
903 GEOM::TPythonDump pd (aFunction);
904 pd << aSpline << " = geompy.MakeInterpolWithTangents([";
906 it = thePoints.begin();
908 while (it != thePoints.end()) {
909 pd << ", " << (*it++);
911 pd << "], " << theFirstVec << ", " << theLastVec << ")";
917 //=============================================================================
919 * MakeCurveParametric
921 //=============================================================================
922 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCurveParametric
923 (const char* thexExpr, const char* theyExpr, const char* thezExpr,
924 double theParamMin, double theParamMax, double theParamStep,
925 CurveType theCurveType,
926 int theParamNbStep, bool theNewMethod)
928 TCollection_AsciiString aPyScript;
929 aPyScript +="from math import * \n";
930 aPyScript +="def X(t): \n";
931 aPyScript +=" return ";
932 aPyScript += thexExpr;
934 aPyScript +="def Y(t): \n";
935 aPyScript +=" return ";
936 aPyScript += theyExpr;
939 aPyScript +="def Z(t): \n";
940 aPyScript +=" return ";
941 aPyScript += thezExpr;
946 aPyScript +="def coordCalculator(tmin, tmax, nstep): \n";
947 aPyScript +=" coords = [] \n";
948 aPyScript +=" tstep = (tmax - tmin) / nstep \n";
949 aPyScript +=" n = 0 \n";
950 aPyScript +=" while n <= nstep : \n";
951 aPyScript +=" t = tmin + n*tstep \n";
952 aPyScript +=" coords.append([X(t), Y(t), Z(t)]) \n";
953 aPyScript +=" n = n+1 \n";
954 aPyScript +=" return coords \n";
958 aPyScript +="def coordCalculator(tmin, tmax, tstep): \n";
959 aPyScript +=" coords = [] \n";
960 aPyScript +=" while tmin <= tmax : \n";
961 aPyScript +=" coords.append([X(tmin), Y(tmin), Z(tmin)]) \n";
962 aPyScript +=" tmin = tmin + tstep \n";
963 aPyScript +=" return coords \n";
968 if(theParamMin >= theParamMax) {
969 SetErrorCode("The minimum value of the parameter must be less than maximum value !!!");
973 if(!theNewMethod && theParamStep <= 0.0) {
974 SetErrorCode("Value of the step must be positive !!!");
977 else if(theNewMethod && theParamNbStep < 0) {
978 SetErrorCode("The number of steps must be positive !!!");
982 /* Initialize the Python interpreter */
983 if (! Py_IsInitialized()) {
984 SetErrorCode("Python interpreter is not initialized !!! ");
988 PyGILState_STATE gstate;
989 gstate = PyGILState_Ensure();
991 PyObject* main_mod = PyImport_AddModule("__main__");
992 PyObject* main_dict = PyModule_GetDict(main_mod);
994 PyObject* obj = PyRun_String(aPyScript.ToCString(), Py_file_input, main_dict, NULL);
997 SetErrorCode("Error during executing of python script !!!");
999 PyGILState_Release(gstate);
1005 PyObject * func = NULL;
1006 func = PyObject_GetAttrString(main_mod, "coordCalculator");
1009 SetErrorCode("Can't get function from python module !!!");
1010 PyGILState_Release(gstate);
1016 coords = PyObject_CallFunction(func,(char*)"(d, d, i)", theParamMin, theParamMax, theParamNbStep );
1018 coords = PyObject_CallFunction(func,(char*)"(d, d, d)", theParamMin, theParamMax, theParamStep );
1020 if (coords == NULL){
1022 std::string err_description="";
1023 PyObject* new_stderr = newPyStdOut(err_description);
1024 PyObject* old_stderr = PySys_GetObject((char*)"stderr");
1025 Py_INCREF(old_stderr);
1026 PySys_SetObject((char*)"stderr", new_stderr);
1028 PySys_SetObject((char*)"stderr", old_stderr);
1029 Py_DECREF(new_stderr);
1030 MESSAGE("Can't evaluate coordCalculator()" << " error is " << err_description);
1031 SetErrorCode("Can't evaluate the expressions, please check them !!!");
1032 PyGILState_Release(gstate);
1036 int lsize = PyList_Size( coords );
1039 SetErrorCode("Empty list of the points, please check input parameters !!!");
1043 Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, lsize * 3);
1046 for ( Py_ssize_t i = 0; i < lsize; ++i ) {
1047 PyObject* coord = PyList_GetItem( coords, i );
1048 if (coord != NULL) {
1049 for ( Py_ssize_t j = 0; j < PyList_Size(coord); ++j) {
1050 PyObject* item = PyList_GetItem(coord, j);
1051 aCoordsArray->SetValue(k, PyFloat_AsDouble(item));
1059 PyGILState_Release(gstate);
1061 Handle(GEOM_Object) aCurve;
1062 Handle(GEOM_Function) aFunction;
1063 TCollection_AsciiString aCurveType;
1065 switch(theCurveType) {
1067 //Add a new Polyline object
1068 aCurve = GetEngine()->AddObject(GEOM_POLYLINE);
1070 //Add a new Polyline function for creation a polyline relatively to points set
1071 aFunction = aCurve->AddFunction(GEOMImpl_PolylineDriver::GetID(), POLYLINE_POINTS);
1072 if (aFunction.IsNull()) return NULL;
1074 //Check if the function is set correctly
1075 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) return NULL;
1077 GEOMImpl_IPolyline aCI (aFunction);
1079 aCI.SetLength(lsize);
1080 aCI.SetConstructorType(COORD_CONSTRUCTOR);
1081 aCI.SetIsClosed(false);
1082 aCI.SetCoordinates(aCoordsArray);
1083 aCurveType = "GEOM.Polyline";
1087 //Add a new Spline object
1088 aCurve = GetEngine()->AddObject(GEOM_SPLINE);
1089 //Add a new Spline function for creation a bezier curve relatively to points set
1091 aCurve->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_BEZIER);
1092 if (aFunction.IsNull()) return NULL;
1094 //Check if the function is set correctly
1095 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
1097 GEOMImpl_ISpline aCI (aFunction);
1099 aCI.SetConstructorType(COORD_CONSTRUCTOR);
1100 aCI.SetIsClosed(false);
1101 aCI.SetCoordinates(aCoordsArray);
1102 aCurveType = "GEOM.Bezier";
1105 case Interpolation: {
1106 //Add a new Spline object
1107 aCurve = GetEngine()->AddObject(GEOM_SPLINE);
1109 //Add a new Spline function for creation a bezier curve relatively to points set
1110 aFunction = aCurve->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOLATION);
1111 if (aFunction.IsNull()) return NULL;
1113 //Check if the function is set correctly
1114 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
1116 GEOMImpl_ISpline aCI (aFunction);
1117 aCI.SetConstructorType(COORD_CONSTRUCTOR);
1118 aCI.SetIsClosed(false);
1119 aCI.SetDoReordering(false);
1120 aCI.SetCoordinates(aCoordsArray);
1121 aCurveType = "GEOM.Interpolation";
1126 GEOMImpl_ICurveParametric aIP(aFunction);
1127 aIP.SetExprX (thexExpr);
1128 aIP.SetExprY (theyExpr);
1129 aIP.SetExprZ (thezExpr);
1130 aIP.SetParamMin (theParamMin);
1131 aIP.SetParamMax (theParamMax);
1133 aIP.SetParamNbStep(theParamNbStep);
1135 aIP.SetParamStep (theParamStep);
1137 //Compute the Curve value
1140 if (!GetSolver()->ComputeFunction(aFunction)) {
1141 SetErrorCode("Curve driver failed !!!");
1145 catch (Standard_Failure& aFail) {
1146 SetErrorCode(aFail.GetMessageString());
1150 //Make a Python command
1151 GEOM::TPythonDump pd (aFunction);
1152 pd << aCurve << " = geompy.MakeCurveParametric(";
1153 pd << "\"" << thexExpr << "\", ";
1154 pd << "\"" << theyExpr << "\", ";
1155 pd << "\"" << thezExpr << "\", ";
1157 pd << theParamMin <<", ";
1158 pd << theParamMax <<", ";
1160 pd << theParamNbStep <<", ";
1162 pd << theParamStep <<", ";
1163 pd << aCurveType.ToCString() <<", ";
1164 pd << theNewMethod <<")";
1170 //=============================================================================
1174 //=============================================================================
1175 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCommand,
1176 std::list<double> theWorkingPlane)
1180 if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
1182 //Add a new Sketcher object
1183 Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GEOM_SKETCHER);
1185 //Add a new Sketcher function
1186 Handle(GEOM_Function) aFunction =
1187 aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_NINE_DOUBLS);
1188 if (aFunction.IsNull()) return NULL;
1190 //Check if the function is set correctly
1191 if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL;
1193 GEOMImpl_ISketcher aCI (aFunction);
1195 TCollection_AsciiString aCommand((char*) theCommand);
1196 aCI.SetCommand(aCommand);
1199 std::list<double>::iterator it = theWorkingPlane.begin();
1200 for (; it != theWorkingPlane.end(); it++, ind++)
1201 aCI.SetWorkingPlane(ind, *it);
1203 //Compute the Sketcher value
1206 if (!GetSolver()->ComputeFunction(aFunction)) {
1207 SetErrorCode("Sketcher driver failed");
1211 catch (Standard_Failure& aFail) {
1212 SetErrorCode(aFail.GetMessageString());
1216 //Make a Python command
1217 GEOM::TPythonDump pd (aFunction);
1218 pd << aSketcher << " = geompy.MakeSketcher(\"" << aCommand.ToCString() << "\", [";
1220 it = theWorkingPlane.begin();
1222 while (it != theWorkingPlane.end()) {
1223 pd << ", " << (*it++);
1231 //=============================================================================
1233 * MakeSketcherOnPlane
1235 //=============================================================================
1236 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane
1237 (const char* theCommand,
1238 Handle(GEOM_Object) theWorkingPlane)
1242 if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
1244 //Add a new Sketcher object
1245 Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GEOM_SKETCHER);
1247 //Add a new Sketcher function
1248 Handle(GEOM_Function) aFunction =
1249 aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_PLANE);
1250 if (aFunction.IsNull()) return NULL;
1252 //Check if the function is set correctly
1253 if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL;
1255 GEOMImpl_ISketcher aCI (aFunction);
1257 TCollection_AsciiString aCommand((char*) theCommand);
1258 aCI.SetCommand(aCommand);
1260 Handle(GEOM_Function) aRefPlane = theWorkingPlane->GetLastFunction();
1261 if (aRefPlane.IsNull()) return NULL;
1262 aCI.SetWorkingPlane( aRefPlane );
1264 //Compute the Sketcher value
1267 if (!GetSolver()->ComputeFunction(aFunction)) {
1268 SetErrorCode("Sketcher driver failed");
1272 catch (Standard_Failure& aFail) {
1273 SetErrorCode(aFail.GetMessageString());
1277 //Make a Python command
1278 GEOM::TPythonDump (aFunction) << aSketcher << " = geompy.MakeSketcherOnPlane(\""
1279 << aCommand.ToCString() << "\", " << theWorkingPlane << " )";
1285 //=============================================================================
1287 * Make3DSketcherCommand
1289 //=============================================================================
1290 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcherCommand (const char* theCommand)
1294 if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
1296 //Add a new Sketcher object
1297 Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GEOM_3DSKETCHER);
1299 //Add a new Sketcher function
1300 Handle(GEOM_Function) aFunction =
1301 aSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), SKETCHER3D_COMMAND);
1302 if (aFunction.IsNull()) return NULL;
1304 //Check if the function is set correctly
1305 if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
1307 GEOMImpl_I3DSketcher aCI (aFunction);
1309 TCollection_AsciiString aCommand ((char*) theCommand);
1310 aCI.SetCommand(aCommand);
1312 //Compute the 3D Sketcher value
1315 if (!GetSolver()->ComputeFunction(aFunction)) {
1316 SetErrorCode("3D Sketcher driver failed");
1320 catch (Standard_Failure& aFail) {
1321 SetErrorCode(aFail.GetMessageString());
1325 //Make a Python command
1326 GEOM::TPythonDump pd (aFunction);
1327 pd << aSketcher << " = geompy.Make3DSketcherCommand(\"" << aCommand.ToCString() << "\")";
1333 //=============================================================================
1337 //=============================================================================
1338 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (std::list<double> theCoordinates)
1342 //Add a new Sketcher object
1343 Handle(GEOM_Object) a3DSketcher = GetEngine()->AddObject(GEOM_3DSKETCHER);
1345 //Add a new Sketcher function
1346 Handle(GEOM_Function) aFunction =
1347 a3DSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), SKETCHER3D_COORDS);
1348 if (aFunction.IsNull()) return NULL;
1350 //Check if the function is set correctly
1351 if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
1353 GEOMImpl_I3DSketcher aCI (aFunction);
1356 std::list<double>::iterator it = theCoordinates.begin();
1357 for (; it != theCoordinates.end(); it++)
1360 Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, nbOfCoords);
1362 it = theCoordinates.begin();
1364 for (; it != theCoordinates.end(); it++, ind++)
1365 aCoordsArray->SetValue(ind, *it);
1367 aCI.SetCoordinates(aCoordsArray);
1369 //Compute the Sketcher value
1372 if (!GetSolver()->ComputeFunction(aFunction)) {
1373 SetErrorCode("3D Sketcher driver failed");
1377 catch (Standard_Failure& aFail) {
1378 SetErrorCode(aFail.GetMessageString());
1382 //Make a Python command
1383 GEOM::TPythonDump pd (aFunction);
1384 pd << a3DSketcher << " = geompy.Make3DSketcher([";
1386 it = theCoordinates.begin();
1388 while (it != theCoordinates.end()) {
1389 pd << ", " << (*it++);
1397 //=============================================================================
1401 //=============================================================================
1402 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeIsoline
1403 (const Handle(GEOM_Object) &theFace,
1405 const double theParameter)
1409 if (theFace.IsNull()) {
1413 //Add a new Spline object
1414 Handle(GEOM_Object) anIsoline =
1415 GetEngine()->AddObject(GEOM_ISOLINE);
1417 //Add a new Spline function for interpolation type
1418 Handle(GEOM_Function) aFunction =
1419 anIsoline->AddFunction(GEOMImpl_ShapeDriver::GetID(), SHAPE_ISOLINE);
1421 if (aFunction.IsNull()) {
1425 //Check if the function is set correctly
1426 if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) {
1430 GEOMImpl_IIsoline aCI (aFunction);
1431 Handle(GEOM_Function) aRefFace = theFace->GetLastFunction();
1433 if (aRefFace.IsNull()) {
1437 aCI.SetFace(aRefFace);
1438 aCI.SetIsUIso(IsUIso);
1439 aCI.SetParameter(theParameter);
1441 //Compute the isoline curve
1444 if (!GetSolver()->ComputeFunction(aFunction)) {
1445 SetErrorCode("Shape driver failed");
1449 catch (Standard_Failure& aFail) {
1450 SetErrorCode(aFail.GetMessageString());
1454 //Make a Python command
1455 GEOM::TPythonDump (aFunction) << anIsoline << " = geompy.MakeIsoline( "
1456 << theFace << ", " << IsUIso << ", " << theParameter << " )";
1462 //=============================================================================
1466 //=============================================================================
1467 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline2D
1468 (const std::list <std::list <double> > &theCoords,
1469 const Handle(TColStd_HArray1OfExtendedString) &theNames,
1470 const Handle(TColStd_HArray1OfByte) &theTypes,
1471 const Handle(TColStd_HArray1OfByte) &theCloseds,
1472 const Handle(TColStd_HArray1OfReal) &theWorkingPlane)
1476 if (theCoords.empty() || theNames.IsNull() || theTypes.IsNull() ||
1477 theCloseds.IsNull() || theWorkingPlane.IsNull()) {
1481 // Add a new Polyline object
1482 Handle(GEOM_Object) aResult =
1483 GetEngine()->AddObject(GEOM_POLYLINE2D);
1484 Handle(GEOM_Function) aFunction = aResult->AddFunction
1485 (GEOMImpl_PolylineDriver::GetID(), POLYLINE2D_PLN_COORDS);
1487 if (aFunction.IsNull()) {
1491 // Check if the function is set correctly
1492 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) {
1496 GEOMImpl_IPolyline2D aCI(aFunction);
1498 aCI.SetCoords(theCoords);
1499 aCI.SetNames(theNames);
1500 aCI.SetTypes(theTypes);
1501 aCI.SetClosedFlags(theCloseds);
1502 aCI.SetWorkingPlaneDbls(theWorkingPlane);
1504 // Compute the isoline curve
1507 if (!GetSolver()->ComputeFunction(aFunction)) {
1508 SetErrorCode("Polyline driver failed");
1512 catch (Standard_Failure& aFail) {
1513 SetErrorCode(aFail.GetMessageString());
1517 //Make a Python command
1518 GEOMImpl_PolylineDumper aDumper(theCoords, theNames, theTypes,
1519 theCloseds, theWorkingPlane);
1521 aDumper.Dump(aResult);
1523 if (aDumper.IsDone() == Standard_False) {
1524 SetErrorCode("Python dump failed");
1532 //=============================================================================
1534 * MakePolyline2DOnPlane
1536 //=============================================================================
1537 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline2DOnPlane
1538 (const std::list <std::list <double> > &theCoords,
1539 const Handle(TColStd_HArray1OfExtendedString) &theNames,
1540 const Handle(TColStd_HArray1OfByte) &theTypes,
1541 const Handle(TColStd_HArray1OfByte) &theCloseds,
1542 const Handle(GEOM_Object) &theWorkingPlane)
1546 if (theCoords.empty() || theNames.IsNull() || theTypes.IsNull() ||
1547 theCloseds.IsNull() || theWorkingPlane.IsNull()) {
1551 //Add a new Polyline object
1552 Handle(GEOM_Object) aResult =
1553 GetEngine()->AddObject(GEOM_POLYLINE2D);
1554 Handle(GEOM_Function) aFunction = aResult->AddFunction
1555 (GEOMImpl_PolylineDriver::GetID(), POLYLINE2D_PLN_OBJECT);
1557 if (aFunction.IsNull()) {
1561 //Check if the function is set correctly
1562 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) {
1566 Handle(GEOM_Function) aRefPlane = theWorkingPlane->GetLastFunction();
1568 if (aRefPlane.IsNull()) {
1572 GEOMImpl_IPolyline2D aCI(aFunction);
1574 aCI.SetCoords(theCoords);
1575 aCI.SetNames(theNames);
1576 aCI.SetTypes(theTypes);
1577 aCI.SetClosedFlags(theCloseds);
1578 aCI.SetWorkingPlane(aRefPlane);
1580 //Compute the isoline curve
1583 if (!GetSolver()->ComputeFunction(aFunction)) {
1584 SetErrorCode("Polyline driver failed");
1588 catch (Standard_Failure& aFail) {
1589 SetErrorCode(aFail.GetMessageString());
1593 //Make a Python command
1594 GEOMImpl_PolylineDumper aDumper(theCoords, theNames, theTypes,
1595 theCloseds, theWorkingPlane);
1597 aDumper.Dump(aResult);
1599 if (aDumper.IsDone() == Standard_False) {
1600 SetErrorCode("Python dump failed");