1 // Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, 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>
32 #include <structmember.h>
38 #include "GEOMImpl_ICurvesOperations.hxx"
39 #include "GEOMImpl_Types.hxx"
41 #include "GEOM_Function.hxx"
42 #include "GEOM_PythonDump.hxx"
44 #include "GEOMImpl_PolylineDriver.hxx"
45 #include "GEOMImpl_CircleDriver.hxx"
46 #include "GEOMImpl_SplineDriver.hxx"
47 #include "GEOMImpl_EllipseDriver.hxx"
48 #include "GEOMImpl_ArcDriver.hxx"
49 #include "GEOMImpl_ShapeDriver.hxx"
50 #include "GEOMImpl_SketcherDriver.hxx"
51 #include "GEOMImpl_3DSketcherDriver.hxx"
53 #include "GEOMImpl_IPolyline.hxx"
54 #include "GEOMImpl_IPolyline2D.hxx"
55 #include "GEOMImpl_ICircle.hxx"
56 #include "GEOMImpl_ISpline.hxx"
57 #include "GEOMImpl_IEllipse.hxx"
58 #include "GEOMImpl_IArc.hxx"
59 #include "GEOMImpl_ISketcher.hxx"
60 #include "GEOMImpl_I3DSketcher.hxx"
61 #include "GEOMImpl_ICurveParametric.hxx"
62 #include "GEOMImpl_IIsoline.hxx"
63 #include "GEOMImpl_PolylineDumper.hxx"
65 #include "utilities.h"
67 #include <TDF_Tool.hxx>
68 #include <TColStd_HArray1OfByte.hxx>
69 #include <TColStd_HArray1OfReal.hxx>
71 #include <Standard_Failure.hxx>
72 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
75 /* ==================================
76 * =========== PYTHON ==============
77 * ==================================*/
88 PyStdOut_dealloc(PyStdOut *self)
94 PyStdOut_write(PyStdOut* self, PyObject* args)
97 if (!PyArg_ParseTuple(args, "s", &c))
100 *(self->out) = *(self->out) + c;
106 static PyMethodDef PyStdOut_methods[] = {
107 {"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
108 PyDoc_STR("write(string) -> None")},
109 {NULL, NULL} /* sentinel */
112 static PyMemberDef PyStdOut_memberlist[] = {
113 {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
114 (char*)"flag indicating that a space needs to be printed; used by print"},
115 {NULL} /* Sentinel */
118 static PyTypeObject PyStdOut_Type = {
119 /* The ob_type field must be initialized in the module init function
120 * to be portable to Windows without using C++. */
121 PyVarObject_HEAD_INIT(NULL, 0)
124 sizeof(PyStdOut), /*tp_basicsize*/
127 (destructor)PyStdOut_dealloc, /*tp_dealloc*/
134 0, /*tp_as_sequence*/
139 PyObject_GenericGetAttr, /*tp_getattro*/
140 /* softspace is writable: we must supply tp_setattro */
141 PyObject_GenericSetAttr, /* tp_setattro */
143 Py_TPFLAGS_DEFAULT, /*tp_flags*/
147 0, /*tp_richcompare*/
148 0, /*tp_weaklistoffset*/
151 PyStdOut_methods, /*tp_methods*/
152 PyStdOut_memberlist, /*tp_members*/
170 0, /*tp_version_tag*/
174 PyObject* newPyStdOut( std::string& out )
176 PyStdOut* self = PyObject_New(PyStdOut, &PyStdOut_Type);
181 return (PyObject*)self;
185 ////////////////////////END PYTHON///////////////////////////
186 //=============================================================================
190 //=============================================================================
191 GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations (GEOM_Engine* theEngine)
192 : GEOM_IOperations(theEngine)
194 MESSAGE("GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations");
197 //=============================================================================
201 //=============================================================================
202 GEOMImpl_ICurvesOperations::~GEOMImpl_ICurvesOperations()
204 MESSAGE("GEOMImpl_ICurvesOperations::~GEOMImpl_ICurvesOperations");
208 //=============================================================================
212 //=============================================================================
213 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleThreePnt (Handle(GEOM_Object) thePnt1,
214 Handle(GEOM_Object) thePnt2,
215 Handle(GEOM_Object) thePnt3)
219 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
221 //Add a new Circle object
222 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GEOM_CIRCLE);
224 //Add a new Circle function for creation a circle relatively to three points
225 Handle(GEOM_Function) aFunction =
226 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_THREE_PNT);
227 if (aFunction.IsNull()) return NULL;
229 //Check if the function is set correctly
230 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
232 GEOMImpl_ICircle aCI (aFunction);
234 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
235 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
236 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
238 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
240 aCI.SetPoint1(aRefPnt1);
241 aCI.SetPoint2(aRefPnt2);
242 aCI.SetPoint3(aRefPnt3);
244 //Compute the Circle value
247 if (!GetSolver()->ComputeFunction(aFunction)) {
248 SetErrorCode("Circle driver failed");
252 catch (Standard_Failure& aFail) {
253 SetErrorCode(aFail.GetMessageString());
257 //Make a Python command
258 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircleThreePnt("
259 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
265 //=============================================================================
267 * MakeCircleCenter2Pnt
269 //=============================================================================
270 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleCenter2Pnt (Handle(GEOM_Object) thePnt1,
271 Handle(GEOM_Object) thePnt2,
272 Handle(GEOM_Object) thePnt3)
276 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
278 //Add a new Circle object
279 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GEOM_CIRCLE);
281 //Add a new Circle function for creation a circle relatively to center and 2 points
282 Handle(GEOM_Function) aFunction =
283 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_CENTER_TWO_PNT);
284 if (aFunction.IsNull()) return NULL;
286 //Check if the function is set correctly
287 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
289 GEOMImpl_ICircle aCI (aFunction);
291 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
292 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
293 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
295 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
297 aCI.SetPoint1(aRefPnt1);
298 aCI.SetPoint2(aRefPnt2);
299 aCI.SetPoint3(aRefPnt3);
301 //Compute the Circle value
304 if (!GetSolver()->ComputeFunction(aFunction)) {
305 SetErrorCode("Circle driver failed");
309 catch (Standard_Failure& aFail) {
310 SetErrorCode(aFail.GetMessageString());
314 //Make a Python command
315 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircleCenter2Pnt("
316 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
322 //=============================================================================
326 //=============================================================================
327 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR
328 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, double theR)
332 // Not set thePnt means origin of global CS,
333 // Not set theVec means Z axis of global CS
334 //if (thePnt.IsNull() || theVec.IsNull()) return NULL;
336 //Add a new Circle object
337 Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GEOM_CIRCLE);
339 //Add a new Circle function for creation a circle relatively to point and vector
340 Handle(GEOM_Function) aFunction =
341 aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_PNT_VEC_R);
342 if (aFunction.IsNull()) return NULL;
344 //Check if the function is set correctly
345 if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;
347 GEOMImpl_ICircle aCI (aFunction);
349 if (!thePnt.IsNull()) {
350 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
351 if (aRefPnt.IsNull()) return NULL;
352 aCI.SetCenter(aRefPnt);
355 if (!theVec.IsNull()) {
356 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
357 if (aRefVec.IsNull()) return NULL;
358 aCI.SetVector(aRefVec);
363 //Compute the Circle value
366 if (!GetSolver()->ComputeFunction(aFunction)) {
367 SetErrorCode("Circle driver failed");
371 catch (Standard_Failure& aFail) {
372 SetErrorCode(aFail.GetMessageString());
376 //Make a Python command
377 GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircle("
378 << thePnt << ", " << theVec << ", " << theR << ")";
384 //=============================================================================
388 //=============================================================================
389 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse
390 (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec,
391 double theRMajor, double theRMinor,
392 Handle(GEOM_Object) theVecMaj)
396 // Not set thePnt means origin of global CS,
397 // Not set theVec means Z axis of global CS
398 // Not set theVecMaj means X axis of global CS
399 //if (thePnt.IsNull() || theVec.IsNull()) return NULL;
401 //Add a new Ellipse object
402 Handle(GEOM_Object) anEll = GetEngine()->AddObject(GEOM_ELLIPSE);
404 //Add a new Ellipse function
405 Handle(GEOM_Function) aFunction =
406 anEll->AddFunction(GEOMImpl_EllipseDriver::GetID(), ELLIPSE_PNT_VEC_RR);
407 if (aFunction.IsNull()) return NULL;
409 //Check if the function is set correctly
410 if (aFunction->GetDriverGUID() != GEOMImpl_EllipseDriver::GetID()) return NULL;
412 GEOMImpl_IEllipse aCI (aFunction);
414 if (!thePnt.IsNull()) {
415 Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
416 if (aRefPnt.IsNull()) return NULL;
417 aCI.SetCenter(aRefPnt);
420 if (!theVec.IsNull()) {
421 Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
422 if (aRefVec.IsNull()) return NULL;
423 aCI.SetVector(aRefVec);
426 aCI.SetRMajor(theRMajor);
427 aCI.SetRMinor(theRMinor);
429 if (!theVecMaj.IsNull()) {
430 Handle(GEOM_Function) aRefVecMaj = theVecMaj->GetLastFunction();
431 if (aRefVecMaj.IsNull()) return NULL;
432 aCI.SetVectorMajor(aRefVecMaj);
435 //Compute the Ellipse value
438 if (!GetSolver()->ComputeFunction(aFunction)) {
439 SetErrorCode("Ellipse driver failed");
443 catch (Standard_Failure& aFail) {
444 SetErrorCode(aFail.GetMessageString());
448 //Make a Python command
449 if (!theVecMaj.IsNull()) {
450 GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse("
451 << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor
452 << ", " << theVecMaj << ")";
455 GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse("
456 << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")";
463 //=============================================================================
467 //=============================================================================
468 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArc (Handle(GEOM_Object) thePnt1,
469 Handle(GEOM_Object) thePnt2,
470 Handle(GEOM_Object) thePnt3)
474 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
476 //Add a new Circle Arc object
477 Handle(GEOM_Object) anArc = GetEngine()->AddObject(GEOM_CIRC_ARC);
479 //Add a new Circle Arc function
480 Handle(GEOM_Function) aFunction =
481 anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_THREE_PNT);
483 if (aFunction.IsNull()) return NULL;
485 //Check if the function is set correctly
486 if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
487 GEOMImpl_IArc aCI (aFunction);
489 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
490 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
491 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
493 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
495 aCI.SetPoint1(aRefPnt1);
496 aCI.SetPoint2(aRefPnt2);
497 aCI.SetPoint3(aRefPnt3);
499 //Compute the Arc value
502 if (!GetSolver()->ComputeFunction(aFunction)) {
503 SetErrorCode("Arc driver failed");
507 catch (Standard_Failure& aFail) {
508 SetErrorCode(aFail.GetMessageString());
512 //Make a Python command
513 GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArc("
514 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
520 //=============================================================================
524 //=============================================================================
525 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcCenter (Handle(GEOM_Object) thePnt1,
526 Handle(GEOM_Object) thePnt2,
527 Handle(GEOM_Object) thePnt3,
531 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
533 //Add a new Circle Arc object
534 Handle(GEOM_Object) anArc = GetEngine()->AddObject(GEOM_CIRC_ARC);
536 //Add a new Circle Arc function
537 Handle(GEOM_Function) aFunction =
538 anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_CENTER);
539 if (aFunction.IsNull()) return NULL;
541 //Check if the function is set correctly
542 if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
544 GEOMImpl_IArc aCI (aFunction);
546 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
547 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
548 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
550 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
552 aCI.SetPoint1(aRefPnt1);
553 aCI.SetPoint2(aRefPnt2);
554 aCI.SetPoint3(aRefPnt3);
555 aCI.SetSense(theSense);
557 //Compute the Arc value
560 if (!GetSolver()->ComputeFunction(aFunction)) {
561 SetErrorCode("Arc driver failed");
565 catch (Standard_Failure& aFail) {
566 SetErrorCode(aFail.GetMessageString());
569 //Make a Python command
570 GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArcCenter("
571 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << "," << theSense << ")";
577 //=============================================================================
581 //=============================================================================
582 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcOfEllipse (Handle(GEOM_Object) thePnt1,
583 Handle(GEOM_Object) thePnt2,
584 Handle(GEOM_Object) thePnt3)
588 if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
590 //Add a new Circle Arc object
591 Handle(GEOM_Object) anArc = GetEngine()->AddObject(GEOM_ELLIPSE_ARC);
593 //Add a new Circle Arc function
594 Handle(GEOM_Function) aFunction =
595 anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), ELLIPSE_ARC_CENTER_TWO_PNT);
597 if (aFunction.IsNull()) return NULL;
599 //Check if the function is set correctly
600 if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
601 GEOMImpl_IArc aCI (aFunction);
603 Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
604 Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
605 Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
607 if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
609 aCI.SetPoint1(aRefPnt1);
610 aCI.SetPoint2(aRefPnt2);
611 aCI.SetPoint3(aRefPnt3);
613 //Compute the Arc value
616 if (!GetSolver()->ComputeFunction(aFunction)) {
617 SetErrorCode("Arc driver failed");
621 catch (Standard_Failure& aFail) {
622 SetErrorCode(aFail.GetMessageString());
626 //Make a Python command
627 GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArcOfEllipse("
628 << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
634 //=============================================================================
638 //=============================================================================
639 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline (std::list<Handle(GEOM_Object)> thePoints,
644 //Add a new Polyline object
645 Handle(GEOM_Object) aPolyline = GetEngine()->AddObject(GEOM_POLYLINE);
647 //Add a new Polyline function for creation a polyline relatively to points set
648 Handle(GEOM_Function) aFunction =
649 aPolyline->AddFunction(GEOMImpl_PolylineDriver::GetID(), POLYLINE_POINTS);
650 if (aFunction.IsNull()) return NULL;
652 //Check if the function is set correctly
653 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) return NULL;
655 GEOMImpl_IPolyline aCI (aFunction);
657 int aLen = thePoints.size();
659 aCI.SetConstructorType(POINT_CONSTRUCTOR);
662 std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
663 for (; it != thePoints.end(); it++, ind++) {
664 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
665 if (aRefPnt.IsNull()) {
666 SetErrorCode("NULL point for Polyline");
669 aCI.SetPoint(ind, aRefPnt);
672 aCI.SetIsClosed(theIsClosed);
674 //Compute the Polyline value
677 if (!GetSolver()->ComputeFunction(aFunction)) {
678 SetErrorCode("Polyline driver failed");
682 catch (Standard_Failure& aFail) {
683 SetErrorCode(aFail.GetMessageString());
687 //Make a Python command
688 GEOM::TPythonDump pd (aFunction);
689 pd << aPolyline << " = geompy.MakePolyline([";
691 it = thePoints.begin();
693 while (it != thePoints.end()) {
694 pd << ", " << (*it++);
696 pd << "], " << theIsClosed << ")";
702 //=============================================================================
706 //=============================================================================
707 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier
708 (std::list<Handle(GEOM_Object)> thePoints,
713 //Add a new Spline object
714 Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GEOM_SPLINE);
716 //Add a new Spline function for creation a bezier curve relatively to points set
717 Handle(GEOM_Function) aFunction =
718 aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_BEZIER);
719 if (aFunction.IsNull()) return NULL;
721 //Check if the function is set correctly
722 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
724 GEOMImpl_ISpline aCI (aFunction);
726 aCI.SetConstructorType(POINT_CONSTRUCTOR);
728 Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient;
729 std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
730 for (; it != thePoints.end(); it++) {
731 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
732 if (aRefPnt.IsNull()) {
733 SetErrorCode("NULL point for Besier curve");
736 aPoints->Append(aRefPnt);
738 aCI.SetPoints(aPoints);
740 aCI.SetIsClosed(theIsClosed);
742 //Compute the Spline value
745 if (!GetSolver()->ComputeFunction(aFunction)) {
746 SetErrorCode("Spline driver failed");
750 catch (Standard_Failure& aFail) {
751 SetErrorCode(aFail.GetMessageString());
755 //Make a Python command
756 GEOM::TPythonDump pd (aFunction);
757 pd << aSpline << " = geompy.MakeBezier([";
759 it = thePoints.begin();
761 while (it != thePoints.end()) {
762 pd << ", " << (*it++);
764 pd << "], " << theIsClosed << ")";
770 //=============================================================================
772 * MakeSplineInterpolation
774 //=============================================================================
775 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation
776 (std::list<Handle(GEOM_Object)> thePoints,
778 bool theDoReordering)
782 //Add a new Spline object
783 Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GEOM_SPLINE);
785 //Add a new Spline function for interpolation type
786 Handle(GEOM_Function) aFunction =
787 aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOLATION);
788 if (aFunction.IsNull()) return NULL;
790 //Check if the function is set correctly
791 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
793 GEOMImpl_ISpline aCI (aFunction);
795 aCI.SetConstructorType(POINT_CONSTRUCTOR);
797 Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient;
798 std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
799 for (; it != thePoints.end(); it++) {
800 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
801 if (aRefPnt.IsNull()) {
804 aPoints->Append(aRefPnt);
806 aCI.SetPoints(aPoints);
808 aCI.SetIsClosed(theIsClosed);
809 aCI.SetDoReordering(theDoReordering);
811 //Compute the Spline value
814 if (!GetSolver()->ComputeFunction(aFunction)) {
815 SetErrorCode("Spline driver failed");
819 catch (Standard_Failure& aFail) {
820 SetErrorCode(aFail.GetMessageString());
824 //Make a Python command
825 GEOM::TPythonDump pd (aFunction);
826 pd << aSpline << " = geompy.MakeInterpol([";
828 it = thePoints.begin();
830 while (it != thePoints.end()) {
831 pd << ", " << (*it++);
833 pd << "], " << theIsClosed << ", " << theDoReordering << ")";
840 //=============================================================================
842 * MakeSplineInterpolWithTangents
844 //=============================================================================
845 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolWithTangents
846 (std::list<Handle(GEOM_Object)> thePoints,
847 Handle(GEOM_Object) theFirstVec,
848 Handle(GEOM_Object) theLastVec)
852 //Add a new Spline object
853 Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GEOM_SPLINE);
855 //Add a new Spline function for interpolation type
856 Handle(GEOM_Function) aFunction =
857 aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOL_TANGENTS);
858 if (aFunction.IsNull()) return NULL;
860 //Check if the function is set correctly
861 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
863 GEOMImpl_ISpline aCI (aFunction);
865 aCI.SetConstructorType(POINT_CONSTRUCTOR);
867 Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient;
868 std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
869 for (; it != thePoints.end(); it++) {
870 Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
871 if (aRefPnt.IsNull()) {
872 SetErrorCode("NULL point for Interpolation");
875 aPoints->Append(aRefPnt);
877 aCI.SetPoints(aPoints);
879 Handle(GEOM_Function) aVec1 = theFirstVec->GetLastFunction();
880 Handle(GEOM_Function) aVec2 = theLastVec->GetLastFunction();
882 if (aVec1.IsNull() || aVec2.IsNull()) return NULL;
884 aCI.SetFirstVector(aVec1);
885 aCI.SetLastVector(aVec2);
887 //Compute the Spline value
890 if (!GetSolver()->ComputeFunction(aFunction)) {
891 SetErrorCode("Spline driver failed");
895 catch (Standard_Failure& aFail) {
896 SetErrorCode(aFail.GetMessageString());
900 //Make a Python command
901 GEOM::TPythonDump pd (aFunction);
902 pd << aSpline << " = geompy.MakeInterpolWithTangents([";
904 it = thePoints.begin();
906 while (it != thePoints.end()) {
907 pd << ", " << (*it++);
909 pd << "], " << theFirstVec << ", " << theLastVec << ")";
915 //=============================================================================
917 * MakeCurveParametric
919 //=============================================================================
920 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCurveParametric
921 (const char* thexExpr, const char* theyExpr, const char* thezExpr,
922 double theParamMin, double theParamMax, double theParamStep,
923 CurveType theCurveType,
924 int theParamNbStep, bool theNewMethod)
926 TCollection_AsciiString aPyScript;
927 aPyScript +="from math import * \n";
928 aPyScript +="def X(t): \n";
929 aPyScript +=" return ";
930 aPyScript += thexExpr;
932 aPyScript +="def Y(t): \n";
933 aPyScript +=" return ";
934 aPyScript += theyExpr;
937 aPyScript +="def Z(t): \n";
938 aPyScript +=" return ";
939 aPyScript += thezExpr;
944 aPyScript +="def coordCalculator(tmin, tmax, nstep): \n";
945 aPyScript +=" coords = [] \n";
946 aPyScript +=" tstep = (tmax - tmin) / nstep \n";
947 aPyScript +=" n = 0 \n";
948 aPyScript +=" while n <= nstep : \n";
949 aPyScript +=" t = tmin + n*tstep \n";
950 aPyScript +=" coords.append([X(t), Y(t), Z(t)]) \n";
951 aPyScript +=" n = n+1 \n";
952 aPyScript +=" return coords \n";
956 aPyScript +="def coordCalculator(tmin, tmax, tstep): \n";
957 aPyScript +=" coords = [] \n";
958 aPyScript +=" while tmin <= tmax : \n";
959 aPyScript +=" coords.append([X(tmin), Y(tmin), Z(tmin)]) \n";
960 aPyScript +=" tmin = tmin + tstep \n";
961 aPyScript +=" return coords \n";
966 if(theParamMin >= theParamMax) {
967 SetErrorCode("The minimum value of the parameter must be less than maximum value !!!");
971 if(!theNewMethod && theParamStep <= 0.0) {
972 SetErrorCode("Value of the step must be positive !!!");
975 else if(theNewMethod && theParamNbStep < 0) {
976 SetErrorCode("The number of steps must be positive !!!");
980 /* Initialize the Python interpreter */
981 if (! Py_IsInitialized()) {
982 SetErrorCode("Python interpreter is not initialized !!! ");
986 PyGILState_STATE gstate;
987 gstate = PyGILState_Ensure();
989 PyObject* main_mod = PyImport_AddModule("__main__");
990 PyObject* main_dict = PyModule_GetDict(main_mod);
992 PyObject* obj = PyRun_String(aPyScript.ToCString(), Py_file_input, main_dict, NULL);
995 SetErrorCode("Error during executing of python script !!!");
997 PyGILState_Release(gstate);
1003 PyObject * func = NULL;
1004 func = PyObject_GetAttrString(main_mod, "coordCalculator");
1007 SetErrorCode("Can't get function from python module !!!");
1008 PyGILState_Release(gstate);
1014 coords = PyObject_CallFunction(func,(char*)"(d, d, i)", theParamMin, theParamMax, theParamNbStep );
1016 coords = PyObject_CallFunction(func,(char*)"(d, d, d)", theParamMin, theParamMax, theParamStep );
1018 if (coords == NULL){
1020 std::string err_description="";
1021 PyObject* new_stderr = newPyStdOut(err_description);
1022 PyObject* old_stderr = PySys_GetObject((char*)"stderr");
1023 Py_INCREF(old_stderr);
1024 PySys_SetObject((char*)"stderr", new_stderr);
1026 PySys_SetObject((char*)"stderr", old_stderr);
1027 Py_DECREF(new_stderr);
1028 MESSAGE("Can't evaluate coordCalculator()" << " error is " << err_description);
1029 SetErrorCode("Can't evaluate the expressions, please check them !!!");
1030 PyGILState_Release(gstate);
1034 int lsize = PyList_Size( coords );
1037 SetErrorCode("Empty list of the points, please check input parameters !!!");
1041 Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, lsize * 3);
1044 for ( Py_ssize_t i = 0; i < lsize; ++i ) {
1045 PyObject* coord = PyList_GetItem( coords, i );
1046 if (coord != NULL) {
1047 for ( Py_ssize_t j = 0; j < PyList_Size(coord); ++j) {
1048 PyObject* item = PyList_GetItem(coord, j);
1049 aCoordsArray->SetValue(k, PyFloat_AsDouble(item));
1057 PyGILState_Release(gstate);
1059 Handle(GEOM_Object) aCurve;
1060 Handle(GEOM_Function) aFunction;
1061 TCollection_AsciiString aCurveType;
1063 switch(theCurveType) {
1065 //Add a new Polyline object
1066 aCurve = GetEngine()->AddObject(GEOM_POLYLINE);
1068 //Add a new Polyline function for creation a polyline relatively to points set
1069 aFunction = aCurve->AddFunction(GEOMImpl_PolylineDriver::GetID(), POLYLINE_POINTS);
1070 if (aFunction.IsNull()) return NULL;
1072 //Check if the function is set correctly
1073 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) return NULL;
1075 GEOMImpl_IPolyline aCI (aFunction);
1077 aCI.SetLength(lsize);
1078 aCI.SetConstructorType(COORD_CONSTRUCTOR);
1079 aCI.SetIsClosed(false);
1080 aCI.SetCoordinates(aCoordsArray);
1081 aCurveType = "GEOM.Polyline";
1085 //Add a new Spline object
1086 aCurve = GetEngine()->AddObject(GEOM_SPLINE);
1087 //Add a new Spline function for creation a bezier curve relatively to points set
1089 aCurve->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_BEZIER);
1090 if (aFunction.IsNull()) return NULL;
1092 //Check if the function is set correctly
1093 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
1095 GEOMImpl_ISpline aCI (aFunction);
1097 aCI.SetConstructorType(COORD_CONSTRUCTOR);
1098 aCI.SetIsClosed(false);
1099 aCI.SetCoordinates(aCoordsArray);
1100 aCurveType = "GEOM.Bezier";
1103 case Interpolation: {
1104 //Add a new Spline object
1105 aCurve = GetEngine()->AddObject(GEOM_SPLINE);
1107 //Add a new Spline function for creation a bezier curve relatively to points set
1108 aFunction = aCurve->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOLATION);
1109 if (aFunction.IsNull()) return NULL;
1111 //Check if the function is set correctly
1112 if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
1114 GEOMImpl_ISpline aCI (aFunction);
1115 aCI.SetConstructorType(COORD_CONSTRUCTOR);
1116 aCI.SetIsClosed(false);
1117 aCI.SetDoReordering(false);
1118 aCI.SetCoordinates(aCoordsArray);
1119 aCurveType = "GEOM.Interpolation";
1124 GEOMImpl_ICurveParametric aIP(aFunction);
1125 aIP.SetExprX (thexExpr);
1126 aIP.SetExprY (theyExpr);
1127 aIP.SetExprZ (thezExpr);
1128 aIP.SetParamMin (theParamMin);
1129 aIP.SetParamMax (theParamMax);
1131 aIP.SetParamNbStep(theParamNbStep);
1133 aIP.SetParamStep (theParamStep);
1135 //Compute the Curve value
1138 if (!GetSolver()->ComputeFunction(aFunction)) {
1139 SetErrorCode("Curve driver failed !!!");
1143 catch (Standard_Failure& aFail) {
1144 SetErrorCode(aFail.GetMessageString());
1148 //Make a Python command
1149 GEOM::TPythonDump pd (aFunction);
1150 pd << aCurve << " = geompy.MakeCurveParametric(";
1151 pd << "\"" << thexExpr << "\", ";
1152 pd << "\"" << theyExpr << "\", ";
1153 pd << "\"" << thezExpr << "\", ";
1155 pd << theParamMin <<", ";
1156 pd << theParamMax <<", ";
1158 pd << theParamNbStep <<", ";
1160 pd << theParamStep <<", ";
1161 pd << aCurveType.ToCString() <<", ";
1162 pd << theNewMethod <<")";
1168 //=============================================================================
1172 //=============================================================================
1173 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCommand,
1174 std::list<double> theWorkingPlane)
1178 if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
1180 //Add a new Sketcher object
1181 Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GEOM_SKETCHER);
1183 //Add a new Sketcher function
1184 Handle(GEOM_Function) aFunction =
1185 aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_NINE_DOUBLS);
1186 if (aFunction.IsNull()) return NULL;
1188 //Check if the function is set correctly
1189 if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL;
1191 GEOMImpl_ISketcher aCI (aFunction);
1193 TCollection_AsciiString aCommand((char*) theCommand);
1194 aCI.SetCommand(aCommand);
1197 std::list<double>::iterator it = theWorkingPlane.begin();
1198 for (; it != theWorkingPlane.end(); it++, ind++)
1199 aCI.SetWorkingPlane(ind, *it);
1201 //Compute the Sketcher value
1204 if (!GetSolver()->ComputeFunction(aFunction)) {
1205 SetErrorCode("Sketcher driver failed");
1209 catch (Standard_Failure& aFail) {
1210 SetErrorCode(aFail.GetMessageString());
1214 //Make a Python command
1215 GEOM::TPythonDump pd (aFunction);
1216 pd << aSketcher << " = geompy.MakeSketcher(\"" << aCommand.ToCString() << "\", [";
1218 it = theWorkingPlane.begin();
1220 while (it != theWorkingPlane.end()) {
1221 pd << ", " << (*it++);
1229 //=============================================================================
1231 * MakeSketcherOnPlane
1233 //=============================================================================
1234 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane
1235 (const char* theCommand,
1236 Handle(GEOM_Object) theWorkingPlane)
1240 if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
1242 //Add a new Sketcher object
1243 Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GEOM_SKETCHER);
1245 //Add a new Sketcher function
1246 Handle(GEOM_Function) aFunction =
1247 aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_PLANE);
1248 if (aFunction.IsNull()) return NULL;
1250 //Check if the function is set correctly
1251 if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL;
1253 GEOMImpl_ISketcher aCI (aFunction);
1255 TCollection_AsciiString aCommand((char*) theCommand);
1256 aCI.SetCommand(aCommand);
1258 Handle(GEOM_Function) aRefPlane = theWorkingPlane->GetLastFunction();
1259 if (aRefPlane.IsNull()) return NULL;
1260 aCI.SetWorkingPlane( aRefPlane );
1262 //Compute the Sketcher value
1265 if (!GetSolver()->ComputeFunction(aFunction)) {
1266 SetErrorCode("Sketcher driver failed");
1270 catch (Standard_Failure& aFail) {
1271 SetErrorCode(aFail.GetMessageString());
1275 //Make a Python command
1276 GEOM::TPythonDump (aFunction) << aSketcher << " = geompy.MakeSketcherOnPlane(\""
1277 << aCommand.ToCString() << "\", " << theWorkingPlane << " )";
1283 //=============================================================================
1285 * Make3DSketcherCommand
1287 //=============================================================================
1288 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcherCommand (const char* theCommand)
1292 if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
1294 //Add a new Sketcher object
1295 Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GEOM_3DSKETCHER);
1297 //Add a new Sketcher function
1298 Handle(GEOM_Function) aFunction =
1299 aSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), SKETCHER3D_COMMAND);
1300 if (aFunction.IsNull()) return NULL;
1302 //Check if the function is set correctly
1303 if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
1305 GEOMImpl_I3DSketcher aCI (aFunction);
1307 TCollection_AsciiString aCommand ((char*) theCommand);
1308 aCI.SetCommand(aCommand);
1310 //Compute the 3D Sketcher value
1313 if (!GetSolver()->ComputeFunction(aFunction)) {
1314 SetErrorCode("3D Sketcher driver failed");
1318 catch (Standard_Failure& aFail) {
1319 SetErrorCode(aFail.GetMessageString());
1323 //Make a Python command
1324 GEOM::TPythonDump pd (aFunction);
1325 pd << aSketcher << " = geompy.Make3DSketcherCommand(\"" << aCommand.ToCString() << "\")";
1331 //=============================================================================
1335 //=============================================================================
1336 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (std::list<double> theCoordinates)
1340 //Add a new Sketcher object
1341 Handle(GEOM_Object) a3DSketcher = GetEngine()->AddObject(GEOM_3DSKETCHER);
1343 //Add a new Sketcher function
1344 Handle(GEOM_Function) aFunction =
1345 a3DSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), SKETCHER3D_COORDS);
1346 if (aFunction.IsNull()) return NULL;
1348 //Check if the function is set correctly
1349 if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
1351 GEOMImpl_I3DSketcher aCI (aFunction);
1354 std::list<double>::iterator it = theCoordinates.begin();
1355 for (; it != theCoordinates.end(); it++)
1358 Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, nbOfCoords);
1360 it = theCoordinates.begin();
1362 for (; it != theCoordinates.end(); it++, ind++)
1363 aCoordsArray->SetValue(ind, *it);
1365 aCI.SetCoordinates(aCoordsArray);
1367 //Compute the Sketcher value
1370 if (!GetSolver()->ComputeFunction(aFunction)) {
1371 SetErrorCode("3D Sketcher driver failed");
1375 catch (Standard_Failure& aFail) {
1376 SetErrorCode(aFail.GetMessageString());
1380 //Make a Python command
1381 GEOM::TPythonDump pd (aFunction);
1382 pd << a3DSketcher << " = geompy.Make3DSketcher([";
1384 it = theCoordinates.begin();
1386 while (it != theCoordinates.end()) {
1387 pd << ", " << (*it++);
1395 //=============================================================================
1399 //=============================================================================
1400 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeIsoline
1401 (const Handle(GEOM_Object) &theFace,
1403 const double theParameter)
1407 if (theFace.IsNull()) {
1411 //Add a new Spline object
1412 Handle(GEOM_Object) anIsoline =
1413 GetEngine()->AddObject(GEOM_ISOLINE);
1415 //Add a new Spline function for interpolation type
1416 Handle(GEOM_Function) aFunction =
1417 anIsoline->AddFunction(GEOMImpl_ShapeDriver::GetID(), SHAPE_ISOLINE);
1419 if (aFunction.IsNull()) {
1423 //Check if the function is set correctly
1424 if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) {
1428 GEOMImpl_IIsoline aCI (aFunction);
1429 Handle(GEOM_Function) aRefFace = theFace->GetLastFunction();
1431 if (aRefFace.IsNull()) {
1435 aCI.SetFace(aRefFace);
1436 aCI.SetIsUIso(IsUIso);
1437 aCI.SetParameter(theParameter);
1439 //Compute the isoline curve
1442 if (!GetSolver()->ComputeFunction(aFunction)) {
1443 SetErrorCode("Shape driver failed");
1447 catch (Standard_Failure& aFail) {
1448 SetErrorCode(aFail.GetMessageString());
1452 //Make a Python command
1453 GEOM::TPythonDump (aFunction) << anIsoline << " = geompy.MakeIsoline( "
1454 << theFace << ", " << IsUIso << ", " << theParameter << " )";
1460 //=============================================================================
1464 //=============================================================================
1465 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline2D
1466 (const std::list <std::list <double> > &theCoords,
1467 const Handle(TColStd_HArray1OfExtendedString) &theNames,
1468 const Handle(TColStd_HArray1OfByte) &theTypes,
1469 const Handle(TColStd_HArray1OfByte) &theCloseds,
1470 const Handle(TColStd_HArray1OfReal) &theWorkingPlane)
1474 if (theCoords.empty() || theNames.IsNull() || theTypes.IsNull() ||
1475 theCloseds.IsNull() || theWorkingPlane.IsNull()) {
1479 // Add a new Polyline object
1480 Handle(GEOM_Object) aResult =
1481 GetEngine()->AddObject(GEOM_POLYLINE2D);
1482 Handle(GEOM_Function) aFunction = aResult->AddFunction
1483 (GEOMImpl_PolylineDriver::GetID(), POLYLINE2D_PLN_COORDS);
1485 if (aFunction.IsNull()) {
1489 // Check if the function is set correctly
1490 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) {
1494 GEOMImpl_IPolyline2D aCI(aFunction);
1496 aCI.SetCoords(theCoords);
1497 aCI.SetNames(theNames);
1498 aCI.SetTypes(theTypes);
1499 aCI.SetClosedFlags(theCloseds);
1500 aCI.SetWorkingPlaneDbls(theWorkingPlane);
1502 // Compute the isoline curve
1505 if (!GetSolver()->ComputeFunction(aFunction)) {
1506 SetErrorCode("Polyline driver failed");
1510 catch (Standard_Failure& aFail) {
1511 SetErrorCode(aFail.GetMessageString());
1515 //Make a Python command
1516 GEOMImpl_PolylineDumper aDumper(theCoords, theNames, theTypes,
1517 theCloseds, theWorkingPlane);
1519 aDumper.Dump(aResult);
1521 if (aDumper.IsDone() == Standard_False) {
1522 SetErrorCode("Python dump failed");
1530 //=============================================================================
1532 * MakePolyline2DOnPlane
1534 //=============================================================================
1535 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline2DOnPlane
1536 (const std::list <std::list <double> > &theCoords,
1537 const Handle(TColStd_HArray1OfExtendedString) &theNames,
1538 const Handle(TColStd_HArray1OfByte) &theTypes,
1539 const Handle(TColStd_HArray1OfByte) &theCloseds,
1540 const Handle(GEOM_Object) &theWorkingPlane)
1544 if (theCoords.empty() || theNames.IsNull() || theTypes.IsNull() ||
1545 theCloseds.IsNull() || theWorkingPlane.IsNull()) {
1549 //Add a new Polyline object
1550 Handle(GEOM_Object) aResult =
1551 GetEngine()->AddObject(GEOM_POLYLINE2D);
1552 Handle(GEOM_Function) aFunction = aResult->AddFunction
1553 (GEOMImpl_PolylineDriver::GetID(), POLYLINE2D_PLN_OBJECT);
1555 if (aFunction.IsNull()) {
1559 //Check if the function is set correctly
1560 if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) {
1564 Handle(GEOM_Function) aRefPlane = theWorkingPlane->GetLastFunction();
1566 if (aRefPlane.IsNull()) {
1570 GEOMImpl_IPolyline2D aCI(aFunction);
1572 aCI.SetCoords(theCoords);
1573 aCI.SetNames(theNames);
1574 aCI.SetTypes(theTypes);
1575 aCI.SetClosedFlags(theCloseds);
1576 aCI.SetWorkingPlane(aRefPlane);
1578 //Compute the isoline curve
1581 if (!GetSolver()->ComputeFunction(aFunction)) {
1582 SetErrorCode("Polyline driver failed");
1586 catch (Standard_Failure& aFail) {
1587 SetErrorCode(aFail.GetMessageString());
1591 //Make a Python command
1592 GEOMImpl_PolylineDumper aDumper(theCoords, theNames, theTypes,
1593 theCloseds, theWorkingPlane);
1595 aDumper.Dump(aResult);
1597 if (aDumper.IsDone() == Standard_False) {
1598 SetErrorCode("Python dump failed");