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_Real.hxx>
33 #include <structmember.h>
39 #include "GEOMImpl_ICurvesOperations.hxx"
40 #include "GEOMImpl_Types.hxx"
42 #include "GEOM_Function.hxx"
43 #include "GEOM_PythonDump.hxx"
45 #include "GEOMImpl_PolylineDriver.hxx"
46 #include "GEOMImpl_CircleDriver.hxx"
47 #include "GEOMImpl_SplineDriver.hxx"
48 #include "GEOMImpl_EllipseDriver.hxx"
49 #include "GEOMImpl_ArcDriver.hxx"
50 #include "GEOMImpl_ShapeDriver.hxx"
51 #include "GEOMImpl_SketcherDriver.hxx"
52 #include "GEOMImpl_3DSketcherDriver.hxx"
54 #include "GEOMImpl_IPolyline.hxx"
55 #include "GEOMImpl_IPolyline2D.hxx"
56 #include "GEOMImpl_ICircle.hxx"
57 #include "GEOMImpl_ISpline.hxx"
58 #include "GEOMImpl_IEllipse.hxx"
59 #include "GEOMImpl_IArc.hxx"
60 #include "GEOMImpl_ISketcher.hxx"
61 #include "GEOMImpl_I3DSketcher.hxx"
62 #include "GEOMImpl_ICurveParametric.hxx"
63 #include "GEOMImpl_IIsoline.hxx"
64 #include "GEOMImpl_PolylineDumper.hxx"
66 #include "utilities.h"
68 #include <TDF_Tool.hxx>
69 #include <TColStd_HArray1OfByte.hxx>
70 #include <TColStd_HArray1OfReal.hxx>
72 #include <Standard_Failure.hxx>
73 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
76 /* ==================================
77 * =========== PYTHON ==============
78 * ==================================*/
89 PyStdOut_dealloc(PyStdOut *self)
95 PyStdOut_write(PyStdOut* self, PyObject* args)
98 if (!PyArg_ParseTuple(args, "s", &c))
101 *(self->out) = *(self->out) + c;
107 static PyMethodDef PyStdOut_methods[] = {
108 {"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
109 PyDoc_STR("write(string) -> None")},
110 {0, 0, 0, 0} /* sentinel */
113 static PyMemberDef PyStdOut_memberlist[] = {
114 {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
115 (char*)"flag indicating that a space needs to be printed; used by print"},
116 {0, 0, 0, 0, 0} /* sentinel */
119 static PyTypeObject PyStdOut_Type = {
120 /* The ob_type field must be initialized in the module init function
121 * to be portable to Windows without using C++. */
122 PyVarObject_HEAD_INIT(NULL, 0)
125 sizeof(PyStdOut), /*tp_basicsize*/
128 (destructor)PyStdOut_dealloc, /*tp_dealloc*/
135 0, /*tp_as_sequence*/
140 PyObject_GenericGetAttr, /*tp_getattro*/
141 /* softspace is writable: we must supply tp_setattro */
142 PyObject_GenericSetAttr, /* tp_setattro */
144 Py_TPFLAGS_DEFAULT, /*tp_flags*/
148 0, /*tp_richcompare*/
149 0, /*tp_weaklistoffset*/
152 PyStdOut_methods, /*tp_methods*/
153 PyStdOut_memberlist, /*tp_members*/
171 0, /*tp_version_tag*/
175 PyObject* newPyStdOut( std::string& out )
177 PyStdOut* self = PyObject_New(PyStdOut, &PyStdOut_Type);
182 return (PyObject*)self;
186 ////////////////////////END PYTHON///////////////////////////
187 //=============================================================================
191 //=============================================================================
192 GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations (GEOM_Engine* theEngine)
193 : GEOM_IOperations(theEngine)
195 MESSAGE("GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations");
198 //=============================================================================
202 //=============================================================================
203 GEOMImpl_ICurvesOperations::~GEOMImpl_ICurvesOperations()
205 MESSAGE("GEOMImpl_ICurvesOperations::~GEOMImpl_ICurvesOperations");
209 //=============================================================================
213 //=============================================================================
214 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleThreePnt (Handle(GEOM_Object) thePnt1,
215 Handle(GEOM_Object) thePnt2,
216 Handle(GEOM_Object) thePnt3)
220 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
222 //Add a new Circle object
223 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GEOM_CIRCLE);
225 //Add a new Circle function for creation a circle relatively to three points
226 Handle(GEOM_Function) aFunction =
227 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_THREE_PNT);
228 if (aFunction.IsNull()) return NULL;
230 //Check if the function is set correctly
231 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
233 GEOMImpl_ICircle aCI (aFunction);
235 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
236 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
237 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
239 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
241 aCI.SetPoint1(aRefPnt1);
242 aCI.SetPoint2(aRefPnt2);
243 aCI.SetPoint3(aRefPnt3);
245 //Compute the Circle value
248 if (!GetSolver()->ComputeFunction(aFunction)) {
249 SetErrorCode("Circle driver failed");
253 catch (Standard_Failure& aFail) {
254 SetErrorCode(aFail.GetMessageString());
258 //Make a Python command
259 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircleThreePnt("
260 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
266 //=============================================================================
268 * MakeCircleCenter2Pnt
270 //=============================================================================
271 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleCenter2Pnt (Handle(GEOM_Object) thePnt1,
272 Handle(GEOM_Object) thePnt2,
273 Handle(GEOM_Object) thePnt3)
277 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
279 //Add a new Circle object
280 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GEOM_CIRCLE);
282 //Add a new Circle function for creation a circle relatively to center and 2 points
283 Handle(GEOM_Function) aFunction =
284 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_CENTER_TWO_PNT);
285 if (aFunction.IsNull()) return NULL;
287 //Check if the function is set correctly
288 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
290 GEOMImpl_ICircle aCI (aFunction);
292 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
293 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
294 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
296 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
298 aCI.SetPoint1(aRefPnt1);
299 aCI.SetPoint2(aRefPnt2);
300 aCI.SetPoint3(aRefPnt3);
302 //Compute the Circle value
305 if (!GetSolver()->ComputeFunction(aFunction)) {
306 SetErrorCode("Circle driver failed");
310 catch (Standard_Failure& aFail) {
311 SetErrorCode(aFail.GetMessageString());
315 //Make a Python command
316 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircleCenter2Pnt("
317 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
323 //=============================================================================
327 //=============================================================================
328 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR
329 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, double theR)
333 // Not set thePnt means origin of global CS,
334 // Not set theVec means Z axis of global CS
335 //if (thePnt.IsNull() || theVec.IsNull()) return NULL;
337 //Add a new Circle object
338 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GEOM_CIRCLE);
340 //Add a new Circle function for creation a circle relatively to point and vector
341 Handle(GEOM_Function) aFunction =
342 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_PNT_VEC_R);
343 if (aFunction.IsNull()) return NULL;
345 //Check if the function is set correctly
346 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
348 GEOMImpl_ICircle aCI (aFunction);
350 if (!thePnt.IsNull()) {
351 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
352 if (aRefPnt.IsNull()) return NULL;
353 aCI.SetCenter(aRefPnt);
356 if (!theVec.IsNull()) {
357 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
358 if (aRefVec.IsNull()) return NULL;
359 aCI.SetVector(aRefVec);
364 //Compute the Circle value
367 if (!GetSolver()->ComputeFunction(aFunction)) {
368 SetErrorCode("Circle driver failed");
372 catch (Standard_Failure& aFail) {
373 SetErrorCode(aFail.GetMessageString());
377 //Make a Python command
378 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircle("
379 << thePnt << ", " << theVec << ", " << theR << ")";
385 //=============================================================================
389 //=============================================================================
390 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse
391 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec,
392 double theRMajor, double theRMinor,
393 Handle(GEOM_Object) theVecMaj)
397 // Not set thePnt means origin of global CS,
398 // Not set theVec means Z axis of global CS
399 // Not set theVecMaj means X axis of global CS
400 //if (thePnt.IsNull() || theVec.IsNull()) return NULL;
402 //Add a new Ellipse object
403 Handle(GEOM_Object) anEll = GetEngine()->AddObject(GEOM_ELLIPSE);
405 //Add a new Ellipse function
406 Handle(GEOM_Function) aFunction =
407 anEll->AddFunction(GEOMImpl_EllipseDriver::GetID(), ELLIPSE_PNT_VEC_RR);
408 if (aFunction.IsNull()) return NULL;
410 //Check if the function is set correctly
411 if (aFunction->GetDriverGUID() != GEOMImpl_EllipseDriver::GetID()) return NULL;
413 GEOMImpl_IEllipse aCI (aFunction);
415 if (!thePnt.IsNull()) {
416 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
417 if (aRefPnt.IsNull()) return NULL;
418 aCI.SetCenter(aRefPnt);
421 if (!theVec.IsNull()) {
422 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
423 if (aRefVec.IsNull()) return NULL;
424 aCI.SetVector(aRefVec);
427 aCI.SetRMajor(theRMajor);
428 aCI.SetRMinor(theRMinor);
430 if (!theVecMaj.IsNull()) {
431 Handle(GEOM_Function) aRefVecMaj = theVecMaj->GetLastFunction();
432 if (aRefVecMaj.IsNull()) return NULL;
433 aCI.SetVectorMajor(aRefVecMaj);
436 //Compute the Ellipse value
439 if (!GetSolver()->ComputeFunction(aFunction)) {
440 SetErrorCode("Ellipse driver failed");
444 catch (Standard_Failure& aFail) {
445 SetErrorCode(aFail.GetMessageString());
449 //Make a Python command
450 if (!theVecMaj.IsNull()) {
451 GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse("
452 << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor
453 << ", " << theVecMaj << ")";
456 GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse("
457 << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")";
464 //=============================================================================
468 //=============================================================================
469 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArc (Handle(GEOM_Object) thePnt1,
470 Handle(GEOM_Object) thePnt2,
471 Handle(GEOM_Object) thePnt3)
475 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
477 //Add a new Circle Arc object
478 Handle(GEOM_Object) anArc = GetEngine()->AddObject(GEOM_CIRC_ARC);
480 //Add a new Circle Arc function
481 Handle(GEOM_Function) aFunction =
482 anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_THREE_PNT);
484 if (aFunction.IsNull()) return NULL;
486 //Check if the function is set correctly
487 if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
488 GEOMImpl_IArc aCI (aFunction);
490 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
491 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
492 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
494 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
496 aCI.SetPoint1(aRefPnt1);
497 aCI.SetPoint2(aRefPnt2);
498 aCI.SetPoint3(aRefPnt3);
500 //Compute the Arc value
503 if (!GetSolver()->ComputeFunction(aFunction)) {
504 SetErrorCode("Arc driver failed");
508 catch (Standard_Failure& aFail) {
509 SetErrorCode(aFail.GetMessageString());
513 //Make a Python command
514 GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArc("
515 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
521 //=============================================================================
525 //=============================================================================
526 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcCenter (Handle(GEOM_Object) thePnt1,
527 Handle(GEOM_Object) thePnt2,
528 Handle(GEOM_Object) thePnt3,
532 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
534 //Add a new Circle Arc object
535 Handle(GEOM_Object) anArc = GetEngine()->AddObject(GEOM_CIRC_ARC);
537 //Add a new Circle Arc function
538 Handle(GEOM_Function) aFunction =
539 anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_CENTER);
540 if (aFunction.IsNull()) return NULL;
542 //Check if the function is set correctly
543 if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
545 GEOMImpl_IArc aCI (aFunction);
547 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
548 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
549 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
551 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
553 aCI.SetPoint1(aRefPnt1);
554 aCI.SetPoint2(aRefPnt2);
555 aCI.SetPoint3(aRefPnt3);
556 aCI.SetSense(theSense);
558 //Compute the Arc value
561 if (!GetSolver()->ComputeFunction(aFunction)) {
562 SetErrorCode("Arc driver failed");
566 catch (Standard_Failure& aFail) {
567 SetErrorCode(aFail.GetMessageString());
570 //Make a Python command
571 GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArcCenter("
572 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << "," << theSense << ")";
578 //=============================================================================
582 //=============================================================================
583 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcOfEllipse (Handle(GEOM_Object) thePnt1,
584 Handle(GEOM_Object) thePnt2,
585 Handle(GEOM_Object) thePnt3)
589 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
591 //Add a new Circle Arc object
592 Handle(GEOM_Object) anArc = GetEngine()->AddObject(GEOM_ELLIPSE_ARC);
594 //Add a new Circle Arc function
595 Handle(GEOM_Function) aFunction =
596 anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), ELLIPSE_ARC_CENTER_TWO_PNT);
598 if (aFunction.IsNull()) return NULL;
600 //Check if the function is set correctly
601 if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
602 GEOMImpl_IArc aCI (aFunction);
604 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
605 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
606 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
608 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
610 aCI.SetPoint1(aRefPnt1);
611 aCI.SetPoint2(aRefPnt2);
612 aCI.SetPoint3(aRefPnt3);
614 //Compute the Arc value
617 if (!GetSolver()->ComputeFunction(aFunction)) {
618 SetErrorCode("Arc driver failed");
622 catch (Standard_Failure& aFail) {
623 SetErrorCode(aFail.GetMessageString());
627 //Make a Python command
628 GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArcOfEllipse("
629 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
635 //=============================================================================
639 //=============================================================================
640 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline (std::list<Handle(GEOM_Object)> thePoints,
645 //Add a new Polyline object
646 Handle(GEOM_Object) aPolyline = GetEngine()->AddObject(GEOM_POLYLINE);
648 //Add a new Polyline function for creation a polyline relatively to points set
649 Handle(GEOM_Function) aFunction =
650 aPolyline->AddFunction(GEOMImpl_PolylineDriver::GetID(), POLYLINE_POINTS);
651 if (aFunction.IsNull()) return NULL;
653 //Check if the function is set correctly
654 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) return NULL;
656 GEOMImpl_IPolyline aCI (aFunction);
658 int aLen = thePoints.size();
660 aCI.SetConstructorType(POINT_CONSTRUCTOR);
663 std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
664 for (; it != thePoints.end(); it++, ind++) {
665 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
666 if (aRefPnt.IsNull()) {
667 SetErrorCode("NULL point for Polyline");
670 aCI.SetPoint(ind, aRefPnt);
673 aCI.SetIsClosed(theIsClosed);
675 //Compute the Polyline value
678 if (!GetSolver()->ComputeFunction(aFunction)) {
679 SetErrorCode("Polyline driver failed");
683 catch (Standard_Failure& aFail) {
684 SetErrorCode(aFail.GetMessageString());
688 //Make a Python command
689 GEOM::TPythonDump pd (aFunction);
690 pd << aPolyline << " = geompy.MakePolyline([";
692 it = thePoints.begin();
694 while (it != thePoints.end()) {
695 pd << ", " << (*it++);
697 pd << "], " << theIsClosed << ")";
703 //=============================================================================
707 //=============================================================================
708 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier
709 (std::list<Handle(GEOM_Object)> thePoints,
714 //Add a new Spline object
715 Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GEOM_SPLINE);
717 //Add a new Spline function for creation a bezier curve relatively to points set
718 Handle(GEOM_Function) aFunction =
719 aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_BEZIER);
720 if (aFunction.IsNull()) return NULL;
722 //Check if the function is set correctly
723 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
725 GEOMImpl_ISpline aCI (aFunction);
727 aCI.SetConstructorType(POINT_CONSTRUCTOR);
729 Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient;
730 std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
731 for (; it != thePoints.end(); it++) {
732 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
733 if (aRefPnt.IsNull()) {
734 SetErrorCode("NULL point for Besier curve");
737 aPoints->Append(aRefPnt);
739 aCI.SetPoints(aPoints);
741 aCI.SetIsClosed(theIsClosed);
743 //Compute the Spline value
746 if (!GetSolver()->ComputeFunction(aFunction)) {
747 SetErrorCode("Spline driver failed");
751 catch (Standard_Failure& aFail) {
752 SetErrorCode(aFail.GetMessageString());
756 //Make a Python command
757 GEOM::TPythonDump pd (aFunction);
758 pd << aSpline << " = geompy.MakeBezier([";
760 it = thePoints.begin();
762 while (it != thePoints.end()) {
763 pd << ", " << (*it++);
765 pd << "], " << theIsClosed << ")";
771 //=============================================================================
773 * MakeSplineInterpolation
775 //=============================================================================
776 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation
777 (std::list<Handle(GEOM_Object)> thePoints,
779 bool theDoReordering)
783 //Add a new Spline object
784 Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GEOM_SPLINE);
786 //Add a new Spline function for interpolation type
787 Handle(GEOM_Function) aFunction =
788 aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOLATION);
789 if (aFunction.IsNull()) return NULL;
791 //Check if the function is set correctly
792 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
794 GEOMImpl_ISpline aCI (aFunction);
796 aCI.SetConstructorType(POINT_CONSTRUCTOR);
798 Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient;
799 std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
800 for (; it != thePoints.end(); it++) {
801 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
802 if (aRefPnt.IsNull()) {
805 aPoints->Append(aRefPnt);
807 aCI.SetPoints(aPoints);
809 aCI.SetIsClosed(theIsClosed);
810 aCI.SetDoReordering(theDoReordering);
812 //Compute the Spline value
815 if (!GetSolver()->ComputeFunction(aFunction)) {
816 SetErrorCode("Spline driver failed");
820 catch (Standard_Failure& aFail) {
821 SetErrorCode(aFail.GetMessageString());
825 //Make a Python command
826 GEOM::TPythonDump pd (aFunction);
827 pd << aSpline << " = geompy.MakeInterpol([";
829 it = thePoints.begin();
831 while (it != thePoints.end()) {
832 pd << ", " << (*it++);
834 pd << "], " << theIsClosed << ", " << theDoReordering << ")";
841 //=============================================================================
843 * MakeSplineInterpolWithTangents
845 //=============================================================================
846 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolWithTangents
847 (std::list<Handle(GEOM_Object)> thePoints,
848 Handle(GEOM_Object) theFirstVec,
849 Handle(GEOM_Object) theLastVec)
853 //Add a new Spline object
854 Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GEOM_SPLINE);
856 //Add a new Spline function for interpolation type
857 Handle(GEOM_Function) aFunction =
858 aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOL_TANGENTS);
859 if (aFunction.IsNull()) return NULL;
861 //Check if the function is set correctly
862 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
864 GEOMImpl_ISpline aCI (aFunction);
866 aCI.SetConstructorType(POINT_CONSTRUCTOR);
868 Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient;
869 std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
870 for (; it != thePoints.end(); it++) {
871 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
872 if (aRefPnt.IsNull()) {
873 SetErrorCode("NULL point for Interpolation");
876 aPoints->Append(aRefPnt);
878 aCI.SetPoints(aPoints);
880 Handle(GEOM_Function) aVec1 = theFirstVec->GetLastFunction();
881 Handle(GEOM_Function) aVec2 = theLastVec->GetLastFunction();
883 if (aVec1.IsNull() || aVec2.IsNull()) return NULL;
885 aCI.SetFirstVector(aVec1);
886 aCI.SetLastVector(aVec2);
888 //Compute the Spline value
891 if (!GetSolver()->ComputeFunction(aFunction)) {
892 SetErrorCode("Spline driver failed");
896 catch (Standard_Failure& aFail) {
897 SetErrorCode(aFail.GetMessageString());
901 //Make a Python command
902 GEOM::TPythonDump pd (aFunction);
903 pd << aSpline << " = geompy.MakeInterpolWithTangents([";
905 it = thePoints.begin();
907 while (it != thePoints.end()) {
908 pd << ", " << (*it++);
910 pd << "], " << theFirstVec << ", " << theLastVec << ")";
916 //=============================================================================
918 * MakeCurveParametric
920 //=============================================================================
921 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCurveParametric
922 (const char* thexExpr, const char* theyExpr, const char* thezExpr,
923 double theParamMin, double theParamMax, double theParamStep,
924 CurveType theCurveType,
925 int theParamNbStep, bool theNewMethod)
927 TCollection_AsciiString aPyScript;
928 aPyScript +="from math import * \n";
929 aPyScript +="def X(t): \n";
930 aPyScript +=" return ";
931 aPyScript += thexExpr;
933 aPyScript +="def Y(t): \n";
934 aPyScript +=" return ";
935 aPyScript += theyExpr;
938 aPyScript +="def Z(t): \n";
939 aPyScript +=" return ";
940 aPyScript += thezExpr;
945 aPyScript +="def coordCalculator(tmin, tmax, nstep): \n";
946 aPyScript +=" coords = [] \n";
947 aPyScript +=" tstep = (tmax - tmin) / nstep \n";
948 aPyScript +=" n = 0 \n";
949 aPyScript +=" while n <= nstep : \n";
950 aPyScript +=" t = tmin + n*tstep \n";
951 aPyScript +=" coords.append([X(t), Y(t), Z(t)]) \n";
952 aPyScript +=" n = n+1 \n";
953 aPyScript +=" return coords \n";
957 aPyScript +="def coordCalculator(tmin, tmax, tstep): \n";
958 aPyScript +=" coords = [] \n";
959 aPyScript +=" while tmin <= tmax : \n";
960 aPyScript +=" coords.append([X(tmin), Y(tmin), Z(tmin)]) \n";
961 aPyScript +=" tmin = tmin + tstep \n";
962 aPyScript +=" return coords \n";
967 if(theParamMin >= theParamMax) {
968 SetErrorCode("The minimum value of the parameter must be less than maximum value !!!");
972 if(!theNewMethod && theParamStep <= 0.0) {
973 SetErrorCode("Value of the step must be positive !!!");
976 else if(theNewMethod && theParamNbStep < 0) {
977 SetErrorCode("The number of steps must be positive !!!");
981 /* Initialize the Python interpreter */
982 if (! Py_IsInitialized()) {
983 SetErrorCode("Python interpreter is not initialized !!! ");
987 PyGILState_STATE gstate;
988 gstate = PyGILState_Ensure();
990 PyObject* main_mod = PyImport_AddModule("__main__");
991 PyObject* main_dict = PyModule_GetDict(main_mod);
993 PyObject* obj = PyRun_String(aPyScript.ToCString(), Py_file_input, main_dict, NULL);
996 SetErrorCode("Error during executing of python script !!!");
998 PyGILState_Release(gstate);
1004 PyObject * func = NULL;
1005 func = PyObject_GetAttrString(main_mod, "coordCalculator");
1008 SetErrorCode("Can't get function from python module !!!");
1009 PyGILState_Release(gstate);
1015 coords = PyObject_CallFunction(func,(char*)"(d, d, i)", theParamMin, theParamMax, theParamNbStep );
1017 coords = PyObject_CallFunction(func,(char*)"(d, d, d)", theParamMin, theParamMax, theParamStep );
1019 if (coords == NULL){
1021 std::string err_description="";
1022 PyObject* new_stderr = newPyStdOut(err_description);
1023 PyObject* old_stderr = PySys_GetObject((char*)"stderr");
1024 Py_INCREF(old_stderr);
1025 PySys_SetObject((char*)"stderr", new_stderr);
1027 PySys_SetObject((char*)"stderr", old_stderr);
1028 Py_DECREF(new_stderr);
1029 MESSAGE("Can't evaluate coordCalculator()" << " error is " << err_description);
1030 SetErrorCode("Can't evaluate the expressions, please check them !!!");
1031 PyGILState_Release(gstate);
1035 int lsize = PyList_Size( coords );
1038 SetErrorCode("Empty list of the points, please check input parameters !!!");
1042 Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, lsize * 3);
1045 for ( Py_ssize_t i = 0; i < lsize; ++i ) {
1046 PyObject* coord = PyList_GetItem( coords, i );
1047 if (coord != NULL) {
1048 for ( Py_ssize_t j = 0; j < PyList_Size(coord); ++j) {
1049 PyObject* item = PyList_GetItem(coord, j);
1050 aCoordsArray->SetValue(k, PyFloat_AsDouble(item));
1058 PyGILState_Release(gstate);
1060 Handle(GEOM_Object) aCurve;
1061 Handle(GEOM_Function) aFunction;
1062 TCollection_AsciiString aCurveType;
1064 switch(theCurveType) {
1066 //Add a new Polyline object
1067 aCurve = GetEngine()->AddObject(GEOM_POLYLINE);
1069 //Add a new Polyline function for creation a polyline relatively to points set
1070 aFunction = aCurve->AddFunction(GEOMImpl_PolylineDriver::GetID(), POLYLINE_POINTS);
1071 if (aFunction.IsNull()) return NULL;
1073 //Check if the function is set correctly
1074 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) return NULL;
1076 GEOMImpl_IPolyline aCI (aFunction);
1078 aCI.SetLength(lsize);
1079 aCI.SetConstructorType(COORD_CONSTRUCTOR);
1080 aCI.SetIsClosed(false);
1081 aCI.SetCoordinates(aCoordsArray);
1082 aCurveType = "GEOM.Polyline";
1086 //Add a new Spline object
1087 aCurve = GetEngine()->AddObject(GEOM_SPLINE);
1088 //Add a new Spline function for creation a bezier curve relatively to points set
1090 aCurve->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_BEZIER);
1091 if (aFunction.IsNull()) return NULL;
1093 //Check if the function is set correctly
1094 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
1096 GEOMImpl_ISpline aCI (aFunction);
1098 aCI.SetConstructorType(COORD_CONSTRUCTOR);
1099 aCI.SetIsClosed(false);
1100 aCI.SetCoordinates(aCoordsArray);
1101 aCurveType = "GEOM.Bezier";
1104 case Interpolation: {
1105 //Add a new Spline object
1106 aCurve = GetEngine()->AddObject(GEOM_SPLINE);
1108 //Add a new Spline function for creation a bezier curve relatively to points set
1109 aFunction = aCurve->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOLATION);
1110 if (aFunction.IsNull()) return NULL;
1112 //Check if the function is set correctly
1113 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
1115 GEOMImpl_ISpline aCI (aFunction);
1116 aCI.SetConstructorType(COORD_CONSTRUCTOR);
1117 aCI.SetIsClosed(false);
1118 aCI.SetDoReordering(false);
1119 aCI.SetCoordinates(aCoordsArray);
1120 aCurveType = "GEOM.Interpolation";
1125 GEOMImpl_ICurveParametric aIP(aFunction);
1126 aIP.SetExprX (thexExpr);
1127 aIP.SetExprY (theyExpr);
1128 aIP.SetExprZ (thezExpr);
1129 aIP.SetParamMin (theParamMin);
1130 aIP.SetParamMax (theParamMax);
1132 aIP.SetParamNbStep(theParamNbStep);
1134 aIP.SetParamStep (theParamStep);
1136 //Compute the Curve value
1139 if (!GetSolver()->ComputeFunction(aFunction)) {
1140 SetErrorCode("Curve driver failed !!!");
1144 catch (Standard_Failure& aFail) {
1145 SetErrorCode(aFail.GetMessageString());
1149 //Make a Python command
1150 GEOM::TPythonDump pd (aFunction);
1151 pd << aCurve << " = geompy.MakeCurveParametric(";
1152 pd << "\"" << thexExpr << "\", ";
1153 pd << "\"" << theyExpr << "\", ";
1154 pd << "\"" << thezExpr << "\", ";
1156 pd << theParamMin <<", ";
1157 pd << theParamMax <<", ";
1159 pd << theParamNbStep <<", ";
1161 pd << theParamStep <<", ";
1162 pd << aCurveType.ToCString() <<", ";
1163 pd << theNewMethod <<")";
1169 //=============================================================================
1173 //=============================================================================
1174 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCommand,
1175 std::list<double> theWorkingPlane)
1179 if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
1181 //Add a new Sketcher object
1182 Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GEOM_SKETCHER);
1184 //Add a new Sketcher function
1185 Handle(GEOM_Function) aFunction =
1186 aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_NINE_DOUBLS);
1187 if (aFunction.IsNull()) return NULL;
1189 //Check if the function is set correctly
1190 if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL;
1192 GEOMImpl_ISketcher aCI (aFunction);
1194 TCollection_AsciiString aCommand((char*) theCommand);
1195 aCI.SetCommand(aCommand);
1198 std::list<double>::iterator it = theWorkingPlane.begin();
1199 for (; it != theWorkingPlane.end(); it++, ind++)
1200 aCI.SetWorkingPlane(ind, *it);
1202 //Compute the Sketcher value
1205 if (!GetSolver()->ComputeFunction(aFunction)) {
1206 SetErrorCode("Sketcher driver failed");
1210 catch (Standard_Failure& aFail) {
1211 SetErrorCode(aFail.GetMessageString());
1215 //Make a Python command
1216 GEOM::TPythonDump pd (aFunction);
1217 pd << aSketcher << " = geompy.MakeSketcher(\"" << aCommand.ToCString() << "\", [";
1219 it = theWorkingPlane.begin();
1221 while (it != theWorkingPlane.end()) {
1222 pd << ", " << (*it++);
1230 //=============================================================================
1232 * MakeSketcherOnPlane
1234 //=============================================================================
1235 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane
1236 (const char* theCommand,
1237 Handle(GEOM_Object) theWorkingPlane)
1241 if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
1243 //Add a new Sketcher object
1244 Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GEOM_SKETCHER);
1246 //Add a new Sketcher function
1247 Handle(GEOM_Function) aFunction =
1248 aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_PLANE);
1249 if (aFunction.IsNull()) return NULL;
1251 //Check if the function is set correctly
1252 if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL;
1254 GEOMImpl_ISketcher aCI (aFunction);
1256 TCollection_AsciiString aCommand((char*) theCommand);
1257 aCI.SetCommand(aCommand);
1259 Handle(GEOM_Function) aRefPlane = theWorkingPlane->GetLastFunction();
1260 if (aRefPlane.IsNull()) return NULL;
1261 aCI.SetWorkingPlane( aRefPlane );
1263 //Compute the Sketcher value
1266 if (!GetSolver()->ComputeFunction(aFunction)) {
1267 SetErrorCode("Sketcher driver failed");
1271 catch (Standard_Failure& aFail) {
1272 SetErrorCode(aFail.GetMessageString());
1276 //Make a Python command
1277 GEOM::TPythonDump (aFunction) << aSketcher << " = geompy.MakeSketcherOnPlane(\""
1278 << aCommand.ToCString() << "\", " << theWorkingPlane << " )";
1284 //=============================================================================
1286 * Make3DSketcherCommand
1288 //=============================================================================
1289 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcherCommand (const char* theCommand)
1293 if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
1295 //Add a new Sketcher object
1296 Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GEOM_3DSKETCHER);
1298 //Add a new Sketcher function
1299 Handle(GEOM_Function) aFunction =
1300 aSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), SKETCHER3D_COMMAND);
1301 if (aFunction.IsNull()) return NULL;
1303 //Check if the function is set correctly
1304 if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
1306 GEOMImpl_I3DSketcher aCI (aFunction);
1308 TCollection_AsciiString aCommand ((char*) theCommand);
1309 aCI.SetCommand(aCommand);
1311 //Compute the 3D Sketcher value
1314 if (!GetSolver()->ComputeFunction(aFunction)) {
1315 SetErrorCode("3D Sketcher driver failed");
1319 catch (Standard_Failure& aFail) {
1320 SetErrorCode(aFail.GetMessageString());
1324 //Make a Python command
1325 GEOM::TPythonDump pd (aFunction);
1326 pd << aSketcher << " = geompy.Make3DSketcherCommand(\"" << aCommand.ToCString() << "\")";
1332 //=============================================================================
1336 //=============================================================================
1337 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (std::list<double> theCoordinates)
1341 //Add a new Sketcher object
1342 Handle(GEOM_Object) a3DSketcher = GetEngine()->AddObject(GEOM_3DSKETCHER);
1344 //Add a new Sketcher function
1345 Handle(GEOM_Function) aFunction =
1346 a3DSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), SKETCHER3D_COORDS);
1347 if (aFunction.IsNull()) return NULL;
1349 //Check if the function is set correctly
1350 if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
1352 GEOMImpl_I3DSketcher aCI (aFunction);
1355 std::list<double>::iterator it = theCoordinates.begin();
1356 for (; it != theCoordinates.end(); it++)
1359 Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, nbOfCoords);
1361 it = theCoordinates.begin();
1363 for (; it != theCoordinates.end(); it++, ind++)
1364 aCoordsArray->SetValue(ind, *it);
1366 aCI.SetCoordinates(aCoordsArray);
1368 //Compute the Sketcher value
1371 if (!GetSolver()->ComputeFunction(aFunction)) {
1372 SetErrorCode("3D Sketcher driver failed");
1376 catch (Standard_Failure& aFail) {
1377 SetErrorCode(aFail.GetMessageString());
1381 //Make a Python command
1382 GEOM::TPythonDump pd (aFunction);
1383 pd << a3DSketcher << " = geompy.Make3DSketcher([";
1385 it = theCoordinates.begin();
1387 while (it != theCoordinates.end()) {
1388 pd << ", " << (*it++);
1396 //=============================================================================
1400 //=============================================================================
1401 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeIsoline
1402 (const Handle(GEOM_Object) &theFace,
1404 const double theParameter)
1408 if (theFace.IsNull()) {
1412 //Add a new Spline object
1413 Handle(GEOM_Object) anIsoline =
1414 GetEngine()->AddObject(GEOM_ISOLINE);
1416 //Add a new Spline function for interpolation type
1417 Handle(GEOM_Function) aFunction =
1418 anIsoline->AddFunction(GEOMImpl_ShapeDriver::GetID(), SHAPE_ISOLINE);
1420 if (aFunction.IsNull()) {
1424 //Check if the function is set correctly
1425 if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) {
1429 GEOMImpl_IIsoline aCI (aFunction);
1430 Handle(GEOM_Function) aRefFace = theFace->GetLastFunction();
1432 if (aRefFace.IsNull()) {
1436 aCI.SetFace(aRefFace);
1437 aCI.SetIsUIso(IsUIso);
1438 aCI.SetParameter(theParameter);
1440 //Compute the isoline curve
1443 if (!GetSolver()->ComputeFunction(aFunction)) {
1444 SetErrorCode("Shape driver failed");
1448 catch (Standard_Failure& aFail) {
1449 SetErrorCode(aFail.GetMessageString());
1453 //Make a Python command
1454 GEOM::TPythonDump (aFunction) << anIsoline << " = geompy.MakeIsoline( "
1455 << theFace << ", " << IsUIso << ", " << theParameter << " )";
1461 //=============================================================================
1465 //=============================================================================
1466 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline2D
1467 (const std::list <std::list <double> > &theCoords,
1468 const Handle(TColStd_HArray1OfExtendedString) &theNames,
1469 const Handle(TColStd_HArray1OfByte) &theTypes,
1470 const Handle(TColStd_HArray1OfByte) &theCloseds,
1471 const Handle(TColStd_HArray1OfReal) &theWorkingPlane)
1475 if (theCoords.empty() || theNames.IsNull() || theTypes.IsNull() ||
1476 theCloseds.IsNull() || theWorkingPlane.IsNull()) {
1480 // Add a new Polyline object
1481 Handle(GEOM_Object) aResult =
1482 GetEngine()->AddObject(GEOM_POLYLINE2D);
1483 Handle(GEOM_Function) aFunction = aResult->AddFunction
1484 (GEOMImpl_PolylineDriver::GetID(), POLYLINE2D_PLN_COORDS);
1486 if (aFunction.IsNull()) {
1490 // Check if the function is set correctly
1491 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) {
1495 GEOMImpl_IPolyline2D aCI(aFunction);
1497 aCI.SetCoords(theCoords);
1498 aCI.SetNames(theNames);
1499 aCI.SetTypes(theTypes);
1500 aCI.SetClosedFlags(theCloseds);
1501 aCI.SetWorkingPlaneDbls(theWorkingPlane);
1503 // Compute the isoline curve
1506 if (!GetSolver()->ComputeFunction(aFunction)) {
1507 SetErrorCode("Polyline driver failed");
1511 catch (Standard_Failure& aFail) {
1512 SetErrorCode(aFail.GetMessageString());
1516 //Make a Python command
1517 GEOMImpl_PolylineDumper aDumper(theCoords, theNames, theTypes,
1518 theCloseds, theWorkingPlane);
1520 aDumper.Dump(aResult);
1522 if (aDumper.IsDone() == Standard_False) {
1523 SetErrorCode("Python dump failed");
1531 //=============================================================================
1533 * MakePolyline2DOnPlane
1535 //=============================================================================
1536 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline2DOnPlane
1537 (const std::list <std::list <double> > &theCoords,
1538 const Handle(TColStd_HArray1OfExtendedString) &theNames,
1539 const Handle(TColStd_HArray1OfByte) &theTypes,
1540 const Handle(TColStd_HArray1OfByte) &theCloseds,
1541 const Handle(GEOM_Object) &theWorkingPlane)
1545 if (theCoords.empty() || theNames.IsNull() || theTypes.IsNull() ||
1546 theCloseds.IsNull() || theWorkingPlane.IsNull()) {
1550 //Add a new Polyline object
1551 Handle(GEOM_Object) aResult =
1552 GetEngine()->AddObject(GEOM_POLYLINE2D);
1553 Handle(GEOM_Function) aFunction = aResult->AddFunction
1554 (GEOMImpl_PolylineDriver::GetID(), POLYLINE2D_PLN_OBJECT);
1556 if (aFunction.IsNull()) {
1560 //Check if the function is set correctly
1561 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) {
1565 Handle(GEOM_Function) aRefPlane = theWorkingPlane->GetLastFunction();
1567 if (aRefPlane.IsNull()) {
1571 GEOMImpl_IPolyline2D aCI(aFunction);
1573 aCI.SetCoords(theCoords);
1574 aCI.SetNames(theNames);
1575 aCI.SetTypes(theTypes);
1576 aCI.SetClosedFlags(theCloseds);
1577 aCI.SetWorkingPlane(aRefPlane);
1579 //Compute the isoline curve
1582 if (!GetSolver()->ComputeFunction(aFunction)) {
1583 SetErrorCode("Polyline driver failed");
1587 catch (Standard_Failure& aFail) {
1588 SetErrorCode(aFail.GetMessageString());
1592 //Make a Python command
1593 GEOMImpl_PolylineDumper aDumper(theCoords, theNames, theTypes,
1594 theCloseds, theWorkingPlane);
1596 aDumper.Dump(aResult);
1598 if (aDumper.IsDone() == Standard_False) {
1599 SetErrorCode("Python dump failed");