BezierCurvePy.cpp

Go to the documentation of this file.
00001 
00002 // This file is generated by src/Tools/generateTemaplates/templateClassPyExport.py out of the .XML file
00003 // Every change you make here get lost at the next full rebuild!
00004 // This File is normaly build as an include in BezierCurvePyImp.cpp! Its not intended to be in a project!
00005 
00006 #include <boost/filesystem/path.hpp>
00007 #include <boost/filesystem/operations.hpp>
00008 #include <boost/filesystem/exception.hpp>
00009 #include <Base/PyObjectBase.h>
00010 #include <Base/Console.h>
00011 #include <Base/Exception.h>
00012 #include <CXX/Objects.hxx>
00013 
00014 #define new DEBUG_CLIENTBLOCK
00015 
00016 using Base::streq;
00017 using namespace Part;
00018 
00020 PyTypeObject BezierCurvePy::Type = {
00021     PyObject_HEAD_INIT(&PyType_Type)
00022     0,                                                /*ob_size*/
00023     "Part.GeomBezierCurve",     /*tp_name*/
00024     sizeof(BezierCurvePy),                       /*tp_basicsize*/
00025     0,                                                /*tp_itemsize*/
00026     /* methods */
00027     PyDestructor,                                     /*tp_dealloc*/
00028     0,                                                /*tp_print*/
00029     __getattr,                                        /*tp_getattr*/
00030     __setattr,                                        /*tp_setattr*/
00031     0,                                                /*tp_compare*/
00032     __repr,                                           /*tp_repr*/
00033     0,                                                /*tp_as_number*/
00034     0,                                                /*tp_as_sequence*/
00035     0,                                                /*tp_as_mapping*/
00036     0,                                                /*tp_hash*/
00037     0,                                                /*tp_call */
00038     0,                                                /*tp_str  */
00039     0,                                                /*tp_getattro*/
00040     0,                                                /*tp_setattro*/
00041     /* --- Functions to access object as input/output buffer ---------*/
00042     0,                                                /* tp_as_buffer */
00043     /* --- Flags to define presence of optional/expanded features */
00044     Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_CLASS,        /*tp_flags */
00045     "\n"
00046     "                           Describes a rational or non-rational Bezier curve:\n"
00047     "                           -- a non-rational Bezier curve is defined by a table of poles (also called control points)\n"
00048     "                           -- a rational Bezier curve is defined by a table of poles with varying weights\n"
00049     "                   ",           /*tp_doc */
00050     0,                                                /*tp_traverse */
00051     0,                                                /*tp_clear */
00052     0,                                                /*tp_richcompare */
00053     0,                                                /*tp_weaklistoffset */
00054     0,                                                /*tp_iter */
00055     0,                                                /*tp_iternext */
00056     Part::BezierCurvePy::Methods,                     /*tp_methods */
00057     0,                                                /*tp_members */
00058     Part::BezierCurvePy::GetterSetter,                     /*tp_getset */
00059     &Part::GeometryCurvePy::Type,                        /*tp_base */
00060     0,                                                /*tp_dict */
00061     0,                                                /*tp_descr_get */
00062     0,                                                /*tp_descr_set */
00063     0,                                                /*tp_dictoffset */
00064     __PyInit,                                         /*tp_init */
00065     0,                                                /*tp_alloc */
00066     Part::BezierCurvePy::PyMake,/*tp_new */
00067     0,                                                /*tp_free   Low-level free-memory routine */
00068     0,                                                /*tp_is_gc  For PyObject_IS_GC */
00069     0,                                                /*tp_bases */
00070     0,                                                /*tp_mro    method resolution order */
00071     0,                                                /*tp_cache */
00072     0,                                                /*tp_subclasses */
00073     0,                                                /*tp_weaklist */
00074     0                                                 /*tp_del */
00075 };
00076 
00078 PyMethodDef BezierCurvePy::Methods[] = {
00079     {"isRational",
00080         (PyCFunction) staticCallback_isRational,
00081         METH_VARARGS,
00082         "Returns false if the weights of all the poles of this Bezier curve are equal."
00083     },
00084     {"isPeriodic",
00085         (PyCFunction) staticCallback_isPeriodic,
00086         METH_VARARGS,
00087         "Returns false."
00088     },
00089     {"isClosed",
00090         (PyCFunction) staticCallback_isClosed,
00091         METH_VARARGS,
00092         "Returns true if the distance between the start point and end point of\n                                        this Bezier curve is less than or equal to gp::Resolution().\n                          "
00093     },
00094     {"increase",
00095         (PyCFunction) staticCallback_increase,
00096         METH_VARARGS,
00097         "increase(Int=Degree)\nIncreases the degree of this Bezier curve to Degree.\nAs a result, the poles and weights tables are modified."
00098     },
00099     {"insertPoleAfter",
00100         (PyCFunction) staticCallback_insertPoleAfter,
00101         METH_VARARGS,
00102         "Inserts after the pole of index."
00103     },
00104     {"insertPoleBefore",
00105         (PyCFunction) staticCallback_insertPoleBefore,
00106         METH_VARARGS,
00107         "Inserts before the pole of index."
00108     },
00109     {"removePole",
00110         (PyCFunction) staticCallback_removePole,
00111         METH_VARARGS,
00112         "Removes the pole of index Index from the table of poles of this Bezier curve.\nIf this Bezier curve is rational, it can become non-rational."
00113     },
00114     {"segment",
00115         (PyCFunction) staticCallback_segment,
00116         METH_VARARGS,
00117         "Modifies this Bezier curve by segmenting it."
00118     },
00119     {"setPole",
00120         (PyCFunction) staticCallback_setPole,
00121         METH_VARARGS,
00122         "Set a pole of the Bezier curve."
00123     },
00124     {"getPole",
00125         (PyCFunction) staticCallback_getPole,
00126         METH_VARARGS,
00127         "Get a pole of the Bezier curve."
00128     },
00129     {"getPoles",
00130         (PyCFunction) staticCallback_getPoles,
00131         METH_VARARGS,
00132         "Get all poles of the Bezier curve."
00133     },
00134     {"setPoles",
00135         (PyCFunction) staticCallback_setPoles,
00136         METH_VARARGS,
00137         "Set the poles of the Bezier curve."
00138     },
00139     {"setWeight",
00140         (PyCFunction) staticCallback_setWeight,
00141         METH_VARARGS,
00142         "Set a weight of the Bezier curve."
00143     },
00144     {"getWeight",
00145         (PyCFunction) staticCallback_getWeight,
00146         METH_VARARGS,
00147         "Get a weight of the Bezier curve."
00148     },
00149     {"getWeights",
00150         (PyCFunction) staticCallback_getWeights,
00151         METH_VARARGS,
00152         "Get all weights of the Bezier curve."
00153     },
00154     {"getResolution",
00155         (PyCFunction) staticCallback_getResolution,
00156         METH_VARARGS,
00157         "Computes for this Bezier curve the parametric tolerance (UTolerance)\nfor a given 3D tolerance (Tolerance3D).\nIf f(t) is the equation of this Bezier curve, the parametric tolerance\nensures that:\n|t1-t0| < UTolerance =""==> |f(t1)-f(t0)| < Tolerance3D"
00158     },
00159     {NULL, NULL, 0, NULL}               /* Sentinel */
00160 };
00161 
00162 
00163 
00165 PyGetSetDef BezierCurvePy::GetterSetter[] = {
00166     {"Degree",
00167         (getter) staticCallback_getDegree,
00168         (setter) staticCallback_setDegree, 
00169         "Returns the polynomial degree of this Bezier curve,\nwhich is equal to the number of poles minus 1.",
00170         NULL
00171     },
00172     {"MaxDegree",
00173         (getter) staticCallback_getMaxDegree,
00174         (setter) staticCallback_setMaxDegree, 
00175         "Returns the value of the maximum polynomial degree of any\nBezier curve curve. This value is 25.",
00176         NULL
00177     },
00178     {"NbPoles",
00179         (getter) staticCallback_getNbPoles,
00180         (setter) staticCallback_setNbPoles, 
00181         "Returns the number of poles of this Bezier curve.\n                            ",
00182         NULL
00183     },
00184     {"StartPoint",
00185         (getter) staticCallback_getStartPoint,
00186         (setter) staticCallback_setStartPoint, 
00187         "Returns the start point of this Bezier curve.",
00188         NULL
00189     },
00190     {"EndPoint",
00191         (getter) staticCallback_getEndPoint,
00192         (setter) staticCallback_setEndPoint, 
00193         "Returns the end point of this Bezier curve.",
00194         NULL
00195     },
00196     {NULL, NULL, NULL, NULL, NULL}              /* Sentinel */
00197 };
00198 
00199 // isRational() callback and implementer
00200 // PyObject*  BezierCurvePy::isRational(PyObject *args){};
00201 // has to be implemented in BezierCurvePyImp.cpp
00202 PyObject * BezierCurvePy::staticCallback_isRational (PyObject *self, PyObject *args)
00203 {
00204     // test if twin object not allready deleted
00205     if (!((PyObjectBase*) self)->isValid()){
00206         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00207         return NULL;
00208     }
00209 
00210     // test if object is set Const
00211     if (((PyObjectBase*) self)->isConst()){
00212         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00213         return NULL;
00214     }
00215 
00216     try { // catches all exceptions coming up from c++ and generate a python exception
00217         PyObject* ret = ((BezierCurvePy*)self)->isRational(args);
00218         if (ret != 0)
00219             ((BezierCurvePy*)self)->startNotify();
00220         return ret;
00221     }
00222     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00223     {
00224         std::string str;
00225         str += "FreeCAD exception thrown (";
00226         str += e.what();
00227         str += ")";
00228         e.ReportException();
00229         PyErr_SetString(PyExc_Exception,str.c_str());
00230         return NULL;
00231     }
00232     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00233     {
00234         std::string str;
00235         str += "File system exception thrown (";
00236         //str += e.who();
00237         //str += ", ";
00238         str += e.what();
00239         str += ")\n";
00240         Base::Console().Error(str.c_str());
00241         PyErr_SetString(PyExc_Exception,str.c_str());
00242         return NULL;
00243     }
00244     catch(const Py::Exception&)
00245     {
00246         // The exception text is already set
00247         return NULL;
00248     }
00249     catch(const char* e) // catch simple string exceptions
00250     {
00251         Base::Console().Error(e);
00252         PyErr_SetString(PyExc_Exception,e);
00253         return NULL;
00254     }
00255     // in debug not all exceptions will be catched to get the attention of the developer!
00256 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00257     catch(const std::exception& e) // catch other c++ exceptions
00258     {
00259         std::string str;
00260         str += "FC++ exception thrown (";
00261         str += e.what();
00262         str += ")";
00263         Base::Console().Error(str.c_str());
00264         PyErr_SetString(PyExc_Exception,str.c_str());
00265         return NULL;
00266     }
00267     catch(...)  // catch the rest!
00268     {
00269         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00270         return NULL;
00271     }
00272 #endif
00273 }
00274 
00275 // isPeriodic() callback and implementer
00276 // PyObject*  BezierCurvePy::isPeriodic(PyObject *args){};
00277 // has to be implemented in BezierCurvePyImp.cpp
00278 PyObject * BezierCurvePy::staticCallback_isPeriodic (PyObject *self, PyObject *args)
00279 {
00280     // test if twin object not allready deleted
00281     if (!((PyObjectBase*) self)->isValid()){
00282         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00283         return NULL;
00284     }
00285 
00286     // test if object is set Const
00287     if (((PyObjectBase*) self)->isConst()){
00288         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00289         return NULL;
00290     }
00291 
00292     try { // catches all exceptions coming up from c++ and generate a python exception
00293         PyObject* ret = ((BezierCurvePy*)self)->isPeriodic(args);
00294         if (ret != 0)
00295             ((BezierCurvePy*)self)->startNotify();
00296         return ret;
00297     }
00298     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00299     {
00300         std::string str;
00301         str += "FreeCAD exception thrown (";
00302         str += e.what();
00303         str += ")";
00304         e.ReportException();
00305         PyErr_SetString(PyExc_Exception,str.c_str());
00306         return NULL;
00307     }
00308     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00309     {
00310         std::string str;
00311         str += "File system exception thrown (";
00312         //str += e.who();
00313         //str += ", ";
00314         str += e.what();
00315         str += ")\n";
00316         Base::Console().Error(str.c_str());
00317         PyErr_SetString(PyExc_Exception,str.c_str());
00318         return NULL;
00319     }
00320     catch(const Py::Exception&)
00321     {
00322         // The exception text is already set
00323         return NULL;
00324     }
00325     catch(const char* e) // catch simple string exceptions
00326     {
00327         Base::Console().Error(e);
00328         PyErr_SetString(PyExc_Exception,e);
00329         return NULL;
00330     }
00331     // in debug not all exceptions will be catched to get the attention of the developer!
00332 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00333     catch(const std::exception& e) // catch other c++ exceptions
00334     {
00335         std::string str;
00336         str += "FC++ exception thrown (";
00337         str += e.what();
00338         str += ")";
00339         Base::Console().Error(str.c_str());
00340         PyErr_SetString(PyExc_Exception,str.c_str());
00341         return NULL;
00342     }
00343     catch(...)  // catch the rest!
00344     {
00345         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00346         return NULL;
00347     }
00348 #endif
00349 }
00350 
00351 // isClosed() callback and implementer
00352 // PyObject*  BezierCurvePy::isClosed(PyObject *args){};
00353 // has to be implemented in BezierCurvePyImp.cpp
00354 PyObject * BezierCurvePy::staticCallback_isClosed (PyObject *self, PyObject *args)
00355 {
00356     // test if twin object not allready deleted
00357     if (!((PyObjectBase*) self)->isValid()){
00358         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00359         return NULL;
00360     }
00361 
00362     // test if object is set Const
00363     if (((PyObjectBase*) self)->isConst()){
00364         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00365         return NULL;
00366     }
00367 
00368     try { // catches all exceptions coming up from c++ and generate a python exception
00369         PyObject* ret = ((BezierCurvePy*)self)->isClosed(args);
00370         if (ret != 0)
00371             ((BezierCurvePy*)self)->startNotify();
00372         return ret;
00373     }
00374     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00375     {
00376         std::string str;
00377         str += "FreeCAD exception thrown (";
00378         str += e.what();
00379         str += ")";
00380         e.ReportException();
00381         PyErr_SetString(PyExc_Exception,str.c_str());
00382         return NULL;
00383     }
00384     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00385     {
00386         std::string str;
00387         str += "File system exception thrown (";
00388         //str += e.who();
00389         //str += ", ";
00390         str += e.what();
00391         str += ")\n";
00392         Base::Console().Error(str.c_str());
00393         PyErr_SetString(PyExc_Exception,str.c_str());
00394         return NULL;
00395     }
00396     catch(const Py::Exception&)
00397     {
00398         // The exception text is already set
00399         return NULL;
00400     }
00401     catch(const char* e) // catch simple string exceptions
00402     {
00403         Base::Console().Error(e);
00404         PyErr_SetString(PyExc_Exception,e);
00405         return NULL;
00406     }
00407     // in debug not all exceptions will be catched to get the attention of the developer!
00408 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00409     catch(const std::exception& e) // catch other c++ exceptions
00410     {
00411         std::string str;
00412         str += "FC++ exception thrown (";
00413         str += e.what();
00414         str += ")";
00415         Base::Console().Error(str.c_str());
00416         PyErr_SetString(PyExc_Exception,str.c_str());
00417         return NULL;
00418     }
00419     catch(...)  // catch the rest!
00420     {
00421         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00422         return NULL;
00423     }
00424 #endif
00425 }
00426 
00427 // increase() callback and implementer
00428 // PyObject*  BezierCurvePy::increase(PyObject *args){};
00429 // has to be implemented in BezierCurvePyImp.cpp
00430 PyObject * BezierCurvePy::staticCallback_increase (PyObject *self, PyObject *args)
00431 {
00432     // test if twin object not allready deleted
00433     if (!((PyObjectBase*) self)->isValid()){
00434         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00435         return NULL;
00436     }
00437 
00438     // test if object is set Const
00439     if (((PyObjectBase*) self)->isConst()){
00440         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00441         return NULL;
00442     }
00443 
00444     try { // catches all exceptions coming up from c++ and generate a python exception
00445         PyObject* ret = ((BezierCurvePy*)self)->increase(args);
00446         if (ret != 0)
00447             ((BezierCurvePy*)self)->startNotify();
00448         return ret;
00449     }
00450     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00451     {
00452         std::string str;
00453         str += "FreeCAD exception thrown (";
00454         str += e.what();
00455         str += ")";
00456         e.ReportException();
00457         PyErr_SetString(PyExc_Exception,str.c_str());
00458         return NULL;
00459     }
00460     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00461     {
00462         std::string str;
00463         str += "File system exception thrown (";
00464         //str += e.who();
00465         //str += ", ";
00466         str += e.what();
00467         str += ")\n";
00468         Base::Console().Error(str.c_str());
00469         PyErr_SetString(PyExc_Exception,str.c_str());
00470         return NULL;
00471     }
00472     catch(const Py::Exception&)
00473     {
00474         // The exception text is already set
00475         return NULL;
00476     }
00477     catch(const char* e) // catch simple string exceptions
00478     {
00479         Base::Console().Error(e);
00480         PyErr_SetString(PyExc_Exception,e);
00481         return NULL;
00482     }
00483     // in debug not all exceptions will be catched to get the attention of the developer!
00484 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00485     catch(const std::exception& e) // catch other c++ exceptions
00486     {
00487         std::string str;
00488         str += "FC++ exception thrown (";
00489         str += e.what();
00490         str += ")";
00491         Base::Console().Error(str.c_str());
00492         PyErr_SetString(PyExc_Exception,str.c_str());
00493         return NULL;
00494     }
00495     catch(...)  // catch the rest!
00496     {
00497         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00498         return NULL;
00499     }
00500 #endif
00501 }
00502 
00503 // insertPoleAfter() callback and implementer
00504 // PyObject*  BezierCurvePy::insertPoleAfter(PyObject *args){};
00505 // has to be implemented in BezierCurvePyImp.cpp
00506 PyObject * BezierCurvePy::staticCallback_insertPoleAfter (PyObject *self, PyObject *args)
00507 {
00508     // test if twin object not allready deleted
00509     if (!((PyObjectBase*) self)->isValid()){
00510         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00511         return NULL;
00512     }
00513 
00514     // test if object is set Const
00515     if (((PyObjectBase*) self)->isConst()){
00516         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00517         return NULL;
00518     }
00519 
00520     try { // catches all exceptions coming up from c++ and generate a python exception
00521         PyObject* ret = ((BezierCurvePy*)self)->insertPoleAfter(args);
00522         if (ret != 0)
00523             ((BezierCurvePy*)self)->startNotify();
00524         return ret;
00525     }
00526     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00527     {
00528         std::string str;
00529         str += "FreeCAD exception thrown (";
00530         str += e.what();
00531         str += ")";
00532         e.ReportException();
00533         PyErr_SetString(PyExc_Exception,str.c_str());
00534         return NULL;
00535     }
00536     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00537     {
00538         std::string str;
00539         str += "File system exception thrown (";
00540         //str += e.who();
00541         //str += ", ";
00542         str += e.what();
00543         str += ")\n";
00544         Base::Console().Error(str.c_str());
00545         PyErr_SetString(PyExc_Exception,str.c_str());
00546         return NULL;
00547     }
00548     catch(const Py::Exception&)
00549     {
00550         // The exception text is already set
00551         return NULL;
00552     }
00553     catch(const char* e) // catch simple string exceptions
00554     {
00555         Base::Console().Error(e);
00556         PyErr_SetString(PyExc_Exception,e);
00557         return NULL;
00558     }
00559     // in debug not all exceptions will be catched to get the attention of the developer!
00560 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00561     catch(const std::exception& e) // catch other c++ exceptions
00562     {
00563         std::string str;
00564         str += "FC++ exception thrown (";
00565         str += e.what();
00566         str += ")";
00567         Base::Console().Error(str.c_str());
00568         PyErr_SetString(PyExc_Exception,str.c_str());
00569         return NULL;
00570     }
00571     catch(...)  // catch the rest!
00572     {
00573         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00574         return NULL;
00575     }
00576 #endif
00577 }
00578 
00579 // insertPoleBefore() callback and implementer
00580 // PyObject*  BezierCurvePy::insertPoleBefore(PyObject *args){};
00581 // has to be implemented in BezierCurvePyImp.cpp
00582 PyObject * BezierCurvePy::staticCallback_insertPoleBefore (PyObject *self, PyObject *args)
00583 {
00584     // test if twin object not allready deleted
00585     if (!((PyObjectBase*) self)->isValid()){
00586         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00587         return NULL;
00588     }
00589 
00590     // test if object is set Const
00591     if (((PyObjectBase*) self)->isConst()){
00592         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00593         return NULL;
00594     }
00595 
00596     try { // catches all exceptions coming up from c++ and generate a python exception
00597         PyObject* ret = ((BezierCurvePy*)self)->insertPoleBefore(args);
00598         if (ret != 0)
00599             ((BezierCurvePy*)self)->startNotify();
00600         return ret;
00601     }
00602     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00603     {
00604         std::string str;
00605         str += "FreeCAD exception thrown (";
00606         str += e.what();
00607         str += ")";
00608         e.ReportException();
00609         PyErr_SetString(PyExc_Exception,str.c_str());
00610         return NULL;
00611     }
00612     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00613     {
00614         std::string str;
00615         str += "File system exception thrown (";
00616         //str += e.who();
00617         //str += ", ";
00618         str += e.what();
00619         str += ")\n";
00620         Base::Console().Error(str.c_str());
00621         PyErr_SetString(PyExc_Exception,str.c_str());
00622         return NULL;
00623     }
00624     catch(const Py::Exception&)
00625     {
00626         // The exception text is already set
00627         return NULL;
00628     }
00629     catch(const char* e) // catch simple string exceptions
00630     {
00631         Base::Console().Error(e);
00632         PyErr_SetString(PyExc_Exception,e);
00633         return NULL;
00634     }
00635     // in debug not all exceptions will be catched to get the attention of the developer!
00636 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00637     catch(const std::exception& e) // catch other c++ exceptions
00638     {
00639         std::string str;
00640         str += "FC++ exception thrown (";
00641         str += e.what();
00642         str += ")";
00643         Base::Console().Error(str.c_str());
00644         PyErr_SetString(PyExc_Exception,str.c_str());
00645         return NULL;
00646     }
00647     catch(...)  // catch the rest!
00648     {
00649         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00650         return NULL;
00651     }
00652 #endif
00653 }
00654 
00655 // removePole() callback and implementer
00656 // PyObject*  BezierCurvePy::removePole(PyObject *args){};
00657 // has to be implemented in BezierCurvePyImp.cpp
00658 PyObject * BezierCurvePy::staticCallback_removePole (PyObject *self, PyObject *args)
00659 {
00660     // test if twin object not allready deleted
00661     if (!((PyObjectBase*) self)->isValid()){
00662         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00663         return NULL;
00664     }
00665 
00666     // test if object is set Const
00667     if (((PyObjectBase*) self)->isConst()){
00668         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00669         return NULL;
00670     }
00671 
00672     try { // catches all exceptions coming up from c++ and generate a python exception
00673         PyObject* ret = ((BezierCurvePy*)self)->removePole(args);
00674         if (ret != 0)
00675             ((BezierCurvePy*)self)->startNotify();
00676         return ret;
00677     }
00678     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00679     {
00680         std::string str;
00681         str += "FreeCAD exception thrown (";
00682         str += e.what();
00683         str += ")";
00684         e.ReportException();
00685         PyErr_SetString(PyExc_Exception,str.c_str());
00686         return NULL;
00687     }
00688     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00689     {
00690         std::string str;
00691         str += "File system exception thrown (";
00692         //str += e.who();
00693         //str += ", ";
00694         str += e.what();
00695         str += ")\n";
00696         Base::Console().Error(str.c_str());
00697         PyErr_SetString(PyExc_Exception,str.c_str());
00698         return NULL;
00699     }
00700     catch(const Py::Exception&)
00701     {
00702         // The exception text is already set
00703         return NULL;
00704     }
00705     catch(const char* e) // catch simple string exceptions
00706     {
00707         Base::Console().Error(e);
00708         PyErr_SetString(PyExc_Exception,e);
00709         return NULL;
00710     }
00711     // in debug not all exceptions will be catched to get the attention of the developer!
00712 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00713     catch(const std::exception& e) // catch other c++ exceptions
00714     {
00715         std::string str;
00716         str += "FC++ exception thrown (";
00717         str += e.what();
00718         str += ")";
00719         Base::Console().Error(str.c_str());
00720         PyErr_SetString(PyExc_Exception,str.c_str());
00721         return NULL;
00722     }
00723     catch(...)  // catch the rest!
00724     {
00725         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00726         return NULL;
00727     }
00728 #endif
00729 }
00730 
00731 // segment() callback and implementer
00732 // PyObject*  BezierCurvePy::segment(PyObject *args){};
00733 // has to be implemented in BezierCurvePyImp.cpp
00734 PyObject * BezierCurvePy::staticCallback_segment (PyObject *self, PyObject *args)
00735 {
00736     // test if twin object not allready deleted
00737     if (!((PyObjectBase*) self)->isValid()){
00738         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00739         return NULL;
00740     }
00741 
00742     // test if object is set Const
00743     if (((PyObjectBase*) self)->isConst()){
00744         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00745         return NULL;
00746     }
00747 
00748     try { // catches all exceptions coming up from c++ and generate a python exception
00749         PyObject* ret = ((BezierCurvePy*)self)->segment(args);
00750         if (ret != 0)
00751             ((BezierCurvePy*)self)->startNotify();
00752         return ret;
00753     }
00754     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00755     {
00756         std::string str;
00757         str += "FreeCAD exception thrown (";
00758         str += e.what();
00759         str += ")";
00760         e.ReportException();
00761         PyErr_SetString(PyExc_Exception,str.c_str());
00762         return NULL;
00763     }
00764     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00765     {
00766         std::string str;
00767         str += "File system exception thrown (";
00768         //str += e.who();
00769         //str += ", ";
00770         str += e.what();
00771         str += ")\n";
00772         Base::Console().Error(str.c_str());
00773         PyErr_SetString(PyExc_Exception,str.c_str());
00774         return NULL;
00775     }
00776     catch(const Py::Exception&)
00777     {
00778         // The exception text is already set
00779         return NULL;
00780     }
00781     catch(const char* e) // catch simple string exceptions
00782     {
00783         Base::Console().Error(e);
00784         PyErr_SetString(PyExc_Exception,e);
00785         return NULL;
00786     }
00787     // in debug not all exceptions will be catched to get the attention of the developer!
00788 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00789     catch(const std::exception& e) // catch other c++ exceptions
00790     {
00791         std::string str;
00792         str += "FC++ exception thrown (";
00793         str += e.what();
00794         str += ")";
00795         Base::Console().Error(str.c_str());
00796         PyErr_SetString(PyExc_Exception,str.c_str());
00797         return NULL;
00798     }
00799     catch(...)  // catch the rest!
00800     {
00801         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00802         return NULL;
00803     }
00804 #endif
00805 }
00806 
00807 // setPole() callback and implementer
00808 // PyObject*  BezierCurvePy::setPole(PyObject *args){};
00809 // has to be implemented in BezierCurvePyImp.cpp
00810 PyObject * BezierCurvePy::staticCallback_setPole (PyObject *self, PyObject *args)
00811 {
00812     // test if twin object not allready deleted
00813     if (!((PyObjectBase*) self)->isValid()){
00814         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00815         return NULL;
00816     }
00817 
00818     // test if object is set Const
00819     if (((PyObjectBase*) self)->isConst()){
00820         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00821         return NULL;
00822     }
00823 
00824     try { // catches all exceptions coming up from c++ and generate a python exception
00825         PyObject* ret = ((BezierCurvePy*)self)->setPole(args);
00826         if (ret != 0)
00827             ((BezierCurvePy*)self)->startNotify();
00828         return ret;
00829     }
00830     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00831     {
00832         std::string str;
00833         str += "FreeCAD exception thrown (";
00834         str += e.what();
00835         str += ")";
00836         e.ReportException();
00837         PyErr_SetString(PyExc_Exception,str.c_str());
00838         return NULL;
00839     }
00840     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00841     {
00842         std::string str;
00843         str += "File system exception thrown (";
00844         //str += e.who();
00845         //str += ", ";
00846         str += e.what();
00847         str += ")\n";
00848         Base::Console().Error(str.c_str());
00849         PyErr_SetString(PyExc_Exception,str.c_str());
00850         return NULL;
00851     }
00852     catch(const Py::Exception&)
00853     {
00854         // The exception text is already set
00855         return NULL;
00856     }
00857     catch(const char* e) // catch simple string exceptions
00858     {
00859         Base::Console().Error(e);
00860         PyErr_SetString(PyExc_Exception,e);
00861         return NULL;
00862     }
00863     // in debug not all exceptions will be catched to get the attention of the developer!
00864 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00865     catch(const std::exception& e) // catch other c++ exceptions
00866     {
00867         std::string str;
00868         str += "FC++ exception thrown (";
00869         str += e.what();
00870         str += ")";
00871         Base::Console().Error(str.c_str());
00872         PyErr_SetString(PyExc_Exception,str.c_str());
00873         return NULL;
00874     }
00875     catch(...)  // catch the rest!
00876     {
00877         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00878         return NULL;
00879     }
00880 #endif
00881 }
00882 
00883 // getPole() callback and implementer
00884 // PyObject*  BezierCurvePy::getPole(PyObject *args){};
00885 // has to be implemented in BezierCurvePyImp.cpp
00886 PyObject * BezierCurvePy::staticCallback_getPole (PyObject *self, PyObject *args)
00887 {
00888     // test if twin object not allready deleted
00889     if (!((PyObjectBase*) self)->isValid()){
00890         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00891         return NULL;
00892     }
00893 
00894     // test if object is set Const
00895     if (((PyObjectBase*) self)->isConst()){
00896         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00897         return NULL;
00898     }
00899 
00900     try { // catches all exceptions coming up from c++ and generate a python exception
00901         PyObject* ret = ((BezierCurvePy*)self)->getPole(args);
00902         if (ret != 0)
00903             ((BezierCurvePy*)self)->startNotify();
00904         return ret;
00905     }
00906     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00907     {
00908         std::string str;
00909         str += "FreeCAD exception thrown (";
00910         str += e.what();
00911         str += ")";
00912         e.ReportException();
00913         PyErr_SetString(PyExc_Exception,str.c_str());
00914         return NULL;
00915     }
00916     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00917     {
00918         std::string str;
00919         str += "File system exception thrown (";
00920         //str += e.who();
00921         //str += ", ";
00922         str += e.what();
00923         str += ")\n";
00924         Base::Console().Error(str.c_str());
00925         PyErr_SetString(PyExc_Exception,str.c_str());
00926         return NULL;
00927     }
00928     catch(const Py::Exception&)
00929     {
00930         // The exception text is already set
00931         return NULL;
00932     }
00933     catch(const char* e) // catch simple string exceptions
00934     {
00935         Base::Console().Error(e);
00936         PyErr_SetString(PyExc_Exception,e);
00937         return NULL;
00938     }
00939     // in debug not all exceptions will be catched to get the attention of the developer!
00940 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00941     catch(const std::exception& e) // catch other c++ exceptions
00942     {
00943         std::string str;
00944         str += "FC++ exception thrown (";
00945         str += e.what();
00946         str += ")";
00947         Base::Console().Error(str.c_str());
00948         PyErr_SetString(PyExc_Exception,str.c_str());
00949         return NULL;
00950     }
00951     catch(...)  // catch the rest!
00952     {
00953         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00954         return NULL;
00955     }
00956 #endif
00957 }
00958 
00959 // getPoles() callback and implementer
00960 // PyObject*  BezierCurvePy::getPoles(PyObject *args){};
00961 // has to be implemented in BezierCurvePyImp.cpp
00962 PyObject * BezierCurvePy::staticCallback_getPoles (PyObject *self, PyObject *args)
00963 {
00964     // test if twin object not allready deleted
00965     if (!((PyObjectBase*) self)->isValid()){
00966         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00967         return NULL;
00968     }
00969 
00970     // test if object is set Const
00971     if (((PyObjectBase*) self)->isConst()){
00972         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00973         return NULL;
00974     }
00975 
00976     try { // catches all exceptions coming up from c++ and generate a python exception
00977         PyObject* ret = ((BezierCurvePy*)self)->getPoles(args);
00978         if (ret != 0)
00979             ((BezierCurvePy*)self)->startNotify();
00980         return ret;
00981     }
00982     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00983     {
00984         std::string str;
00985         str += "FreeCAD exception thrown (";
00986         str += e.what();
00987         str += ")";
00988         e.ReportException();
00989         PyErr_SetString(PyExc_Exception,str.c_str());
00990         return NULL;
00991     }
00992     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00993     {
00994         std::string str;
00995         str += "File system exception thrown (";
00996         //str += e.who();
00997         //str += ", ";
00998         str += e.what();
00999         str += ")\n";
01000         Base::Console().Error(str.c_str());
01001         PyErr_SetString(PyExc_Exception,str.c_str());
01002         return NULL;
01003     }
01004     catch(const Py::Exception&)
01005     {
01006         // The exception text is already set
01007         return NULL;
01008     }
01009     catch(const char* e) // catch simple string exceptions
01010     {
01011         Base::Console().Error(e);
01012         PyErr_SetString(PyExc_Exception,e);
01013         return NULL;
01014     }
01015     // in debug not all exceptions will be catched to get the attention of the developer!
01016 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01017     catch(const std::exception& e) // catch other c++ exceptions
01018     {
01019         std::string str;
01020         str += "FC++ exception thrown (";
01021         str += e.what();
01022         str += ")";
01023         Base::Console().Error(str.c_str());
01024         PyErr_SetString(PyExc_Exception,str.c_str());
01025         return NULL;
01026     }
01027     catch(...)  // catch the rest!
01028     {
01029         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01030         return NULL;
01031     }
01032 #endif
01033 }
01034 
01035 // setPoles() callback and implementer
01036 // PyObject*  BezierCurvePy::setPoles(PyObject *args){};
01037 // has to be implemented in BezierCurvePyImp.cpp
01038 PyObject * BezierCurvePy::staticCallback_setPoles (PyObject *self, PyObject *args)
01039 {
01040     // test if twin object not allready deleted
01041     if (!((PyObjectBase*) self)->isValid()){
01042         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01043         return NULL;
01044     }
01045 
01046     // test if object is set Const
01047     if (((PyObjectBase*) self)->isConst()){
01048         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01049         return NULL;
01050     }
01051 
01052     try { // catches all exceptions coming up from c++ and generate a python exception
01053         PyObject* ret = ((BezierCurvePy*)self)->setPoles(args);
01054         if (ret != 0)
01055             ((BezierCurvePy*)self)->startNotify();
01056         return ret;
01057     }
01058     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01059     {
01060         std::string str;
01061         str += "FreeCAD exception thrown (";
01062         str += e.what();
01063         str += ")";
01064         e.ReportException();
01065         PyErr_SetString(PyExc_Exception,str.c_str());
01066         return NULL;
01067     }
01068     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01069     {
01070         std::string str;
01071         str += "File system exception thrown (";
01072         //str += e.who();
01073         //str += ", ";
01074         str += e.what();
01075         str += ")\n";
01076         Base::Console().Error(str.c_str());
01077         PyErr_SetString(PyExc_Exception,str.c_str());
01078         return NULL;
01079     }
01080     catch(const Py::Exception&)
01081     {
01082         // The exception text is already set
01083         return NULL;
01084     }
01085     catch(const char* e) // catch simple string exceptions
01086     {
01087         Base::Console().Error(e);
01088         PyErr_SetString(PyExc_Exception,e);
01089         return NULL;
01090     }
01091     // in debug not all exceptions will be catched to get the attention of the developer!
01092 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01093     catch(const std::exception& e) // catch other c++ exceptions
01094     {
01095         std::string str;
01096         str += "FC++ exception thrown (";
01097         str += e.what();
01098         str += ")";
01099         Base::Console().Error(str.c_str());
01100         PyErr_SetString(PyExc_Exception,str.c_str());
01101         return NULL;
01102     }
01103     catch(...)  // catch the rest!
01104     {
01105         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01106         return NULL;
01107     }
01108 #endif
01109 }
01110 
01111 // setWeight() callback and implementer
01112 // PyObject*  BezierCurvePy::setWeight(PyObject *args){};
01113 // has to be implemented in BezierCurvePyImp.cpp
01114 PyObject * BezierCurvePy::staticCallback_setWeight (PyObject *self, PyObject *args)
01115 {
01116     // test if twin object not allready deleted
01117     if (!((PyObjectBase*) self)->isValid()){
01118         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01119         return NULL;
01120     }
01121 
01122     // test if object is set Const
01123     if (((PyObjectBase*) self)->isConst()){
01124         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01125         return NULL;
01126     }
01127 
01128     try { // catches all exceptions coming up from c++ and generate a python exception
01129         PyObject* ret = ((BezierCurvePy*)self)->setWeight(args);
01130         if (ret != 0)
01131             ((BezierCurvePy*)self)->startNotify();
01132         return ret;
01133     }
01134     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01135     {
01136         std::string str;
01137         str += "FreeCAD exception thrown (";
01138         str += e.what();
01139         str += ")";
01140         e.ReportException();
01141         PyErr_SetString(PyExc_Exception,str.c_str());
01142         return NULL;
01143     }
01144     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01145     {
01146         std::string str;
01147         str += "File system exception thrown (";
01148         //str += e.who();
01149         //str += ", ";
01150         str += e.what();
01151         str += ")\n";
01152         Base::Console().Error(str.c_str());
01153         PyErr_SetString(PyExc_Exception,str.c_str());
01154         return NULL;
01155     }
01156     catch(const Py::Exception&)
01157     {
01158         // The exception text is already set
01159         return NULL;
01160     }
01161     catch(const char* e) // catch simple string exceptions
01162     {
01163         Base::Console().Error(e);
01164         PyErr_SetString(PyExc_Exception,e);
01165         return NULL;
01166     }
01167     // in debug not all exceptions will be catched to get the attention of the developer!
01168 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01169     catch(const std::exception& e) // catch other c++ exceptions
01170     {
01171         std::string str;
01172         str += "FC++ exception thrown (";
01173         str += e.what();
01174         str += ")";
01175         Base::Console().Error(str.c_str());
01176         PyErr_SetString(PyExc_Exception,str.c_str());
01177         return NULL;
01178     }
01179     catch(...)  // catch the rest!
01180     {
01181         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01182         return NULL;
01183     }
01184 #endif
01185 }
01186 
01187 // getWeight() callback and implementer
01188 // PyObject*  BezierCurvePy::getWeight(PyObject *args){};
01189 // has to be implemented in BezierCurvePyImp.cpp
01190 PyObject * BezierCurvePy::staticCallback_getWeight (PyObject *self, PyObject *args)
01191 {
01192     // test if twin object not allready deleted
01193     if (!((PyObjectBase*) self)->isValid()){
01194         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01195         return NULL;
01196     }
01197 
01198     // test if object is set Const
01199     if (((PyObjectBase*) self)->isConst()){
01200         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01201         return NULL;
01202     }
01203 
01204     try { // catches all exceptions coming up from c++ and generate a python exception
01205         PyObject* ret = ((BezierCurvePy*)self)->getWeight(args);
01206         if (ret != 0)
01207             ((BezierCurvePy*)self)->startNotify();
01208         return ret;
01209     }
01210     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01211     {
01212         std::string str;
01213         str += "FreeCAD exception thrown (";
01214         str += e.what();
01215         str += ")";
01216         e.ReportException();
01217         PyErr_SetString(PyExc_Exception,str.c_str());
01218         return NULL;
01219     }
01220     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01221     {
01222         std::string str;
01223         str += "File system exception thrown (";
01224         //str += e.who();
01225         //str += ", ";
01226         str += e.what();
01227         str += ")\n";
01228         Base::Console().Error(str.c_str());
01229         PyErr_SetString(PyExc_Exception,str.c_str());
01230         return NULL;
01231     }
01232     catch(const Py::Exception&)
01233     {
01234         // The exception text is already set
01235         return NULL;
01236     }
01237     catch(const char* e) // catch simple string exceptions
01238     {
01239         Base::Console().Error(e);
01240         PyErr_SetString(PyExc_Exception,e);
01241         return NULL;
01242     }
01243     // in debug not all exceptions will be catched to get the attention of the developer!
01244 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01245     catch(const std::exception& e) // catch other c++ exceptions
01246     {
01247         std::string str;
01248         str += "FC++ exception thrown (";
01249         str += e.what();
01250         str += ")";
01251         Base::Console().Error(str.c_str());
01252         PyErr_SetString(PyExc_Exception,str.c_str());
01253         return NULL;
01254     }
01255     catch(...)  // catch the rest!
01256     {
01257         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01258         return NULL;
01259     }
01260 #endif
01261 }
01262 
01263 // getWeights() callback and implementer
01264 // PyObject*  BezierCurvePy::getWeights(PyObject *args){};
01265 // has to be implemented in BezierCurvePyImp.cpp
01266 PyObject * BezierCurvePy::staticCallback_getWeights (PyObject *self, PyObject *args)
01267 {
01268     // test if twin object not allready deleted
01269     if (!((PyObjectBase*) self)->isValid()){
01270         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01271         return NULL;
01272     }
01273 
01274     // test if object is set Const
01275     if (((PyObjectBase*) self)->isConst()){
01276         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01277         return NULL;
01278     }
01279 
01280     try { // catches all exceptions coming up from c++ and generate a python exception
01281         PyObject* ret = ((BezierCurvePy*)self)->getWeights(args);
01282         if (ret != 0)
01283             ((BezierCurvePy*)self)->startNotify();
01284         return ret;
01285     }
01286     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01287     {
01288         std::string str;
01289         str += "FreeCAD exception thrown (";
01290         str += e.what();
01291         str += ")";
01292         e.ReportException();
01293         PyErr_SetString(PyExc_Exception,str.c_str());
01294         return NULL;
01295     }
01296     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01297     {
01298         std::string str;
01299         str += "File system exception thrown (";
01300         //str += e.who();
01301         //str += ", ";
01302         str += e.what();
01303         str += ")\n";
01304         Base::Console().Error(str.c_str());
01305         PyErr_SetString(PyExc_Exception,str.c_str());
01306         return NULL;
01307     }
01308     catch(const Py::Exception&)
01309     {
01310         // The exception text is already set
01311         return NULL;
01312     }
01313     catch(const char* e) // catch simple string exceptions
01314     {
01315         Base::Console().Error(e);
01316         PyErr_SetString(PyExc_Exception,e);
01317         return NULL;
01318     }
01319     // in debug not all exceptions will be catched to get the attention of the developer!
01320 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01321     catch(const std::exception& e) // catch other c++ exceptions
01322     {
01323         std::string str;
01324         str += "FC++ exception thrown (";
01325         str += e.what();
01326         str += ")";
01327         Base::Console().Error(str.c_str());
01328         PyErr_SetString(PyExc_Exception,str.c_str());
01329         return NULL;
01330     }
01331     catch(...)  // catch the rest!
01332     {
01333         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01334         return NULL;
01335     }
01336 #endif
01337 }
01338 
01339 // getResolution() callback and implementer
01340 // PyObject*  BezierCurvePy::getResolution(PyObject *args){};
01341 // has to be implemented in BezierCurvePyImp.cpp
01342 PyObject * BezierCurvePy::staticCallback_getResolution (PyObject *self, PyObject *args)
01343 {
01344     // test if twin object not allready deleted
01345     if (!((PyObjectBase*) self)->isValid()){
01346         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01347         return NULL;
01348     }
01349 
01350 
01351     try { // catches all exceptions coming up from c++ and generate a python exception
01352         PyObject* ret = ((BezierCurvePy*)self)->getResolution(args);
01353         return ret;
01354     }
01355     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01356     {
01357         std::string str;
01358         str += "FreeCAD exception thrown (";
01359         str += e.what();
01360         str += ")";
01361         e.ReportException();
01362         PyErr_SetString(PyExc_Exception,str.c_str());
01363         return NULL;
01364     }
01365     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01366     {
01367         std::string str;
01368         str += "File system exception thrown (";
01369         //str += e.who();
01370         //str += ", ";
01371         str += e.what();
01372         str += ")\n";
01373         Base::Console().Error(str.c_str());
01374         PyErr_SetString(PyExc_Exception,str.c_str());
01375         return NULL;
01376     }
01377     catch(const Py::Exception&)
01378     {
01379         // The exception text is already set
01380         return NULL;
01381     }
01382     catch(const char* e) // catch simple string exceptions
01383     {
01384         Base::Console().Error(e);
01385         PyErr_SetString(PyExc_Exception,e);
01386         return NULL;
01387     }
01388     // in debug not all exceptions will be catched to get the attention of the developer!
01389 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01390     catch(const std::exception& e) // catch other c++ exceptions
01391     {
01392         std::string str;
01393         str += "FC++ exception thrown (";
01394         str += e.what();
01395         str += ")";
01396         Base::Console().Error(str.c_str());
01397         PyErr_SetString(PyExc_Exception,str.c_str());
01398         return NULL;
01399     }
01400     catch(...)  // catch the rest!
01401     {
01402         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01403         return NULL;
01404     }
01405 #endif
01406 }
01407 
01408 // Degree() callback and implementer
01409 // PyObject*  BezierCurvePy::Degree(PyObject *args){};
01410 // has to be implemented in BezierCurvePyImp.cpp
01411 PyObject * BezierCurvePy::staticCallback_getDegree (PyObject *self, void * /*closure*/)
01412 {
01413     if (!((PyObjectBase*) self)->isValid()){
01414         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01415         return NULL;
01416     }
01417 
01418     try {
01419         return Py::new_reference_to(((BezierCurvePy*)self)->getDegree());
01420     } catch (const Py::Exception&) {
01421         // The exception text is already set
01422         return NULL;
01423     } catch (...) {
01424         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'Degree' of object 'GeomBezierCurve'");
01425         return NULL;
01426     }
01427 }
01428 
01429 int BezierCurvePy::staticCallback_setDegree (PyObject *self, PyObject * /*value*/, void * /*closure*/)
01430 {
01431     if (!((PyObjectBase*) self)->isValid()){
01432         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01433         return -1;
01434     }
01435 
01436     PyErr_SetString(PyExc_AttributeError, "Attribute 'Degree' of object 'GeomBezierCurve' is read-only");
01437     return -1;
01438 }
01439 
01440 // MaxDegree() callback and implementer
01441 // PyObject*  BezierCurvePy::MaxDegree(PyObject *args){};
01442 // has to be implemented in BezierCurvePyImp.cpp
01443 PyObject * BezierCurvePy::staticCallback_getMaxDegree (PyObject *self, void * /*closure*/)
01444 {
01445     if (!((PyObjectBase*) self)->isValid()){
01446         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01447         return NULL;
01448     }
01449 
01450     try {
01451         return Py::new_reference_to(((BezierCurvePy*)self)->getMaxDegree());
01452     } catch (const Py::Exception&) {
01453         // The exception text is already set
01454         return NULL;
01455     } catch (...) {
01456         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'MaxDegree' of object 'GeomBezierCurve'");
01457         return NULL;
01458     }
01459 }
01460 
01461 int BezierCurvePy::staticCallback_setMaxDegree (PyObject *self, PyObject * /*value*/, void * /*closure*/)
01462 {
01463     if (!((PyObjectBase*) self)->isValid()){
01464         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01465         return -1;
01466     }
01467 
01468     PyErr_SetString(PyExc_AttributeError, "Attribute 'MaxDegree' of object 'GeomBezierCurve' is read-only");
01469     return -1;
01470 }
01471 
01472 // NbPoles() callback and implementer
01473 // PyObject*  BezierCurvePy::NbPoles(PyObject *args){};
01474 // has to be implemented in BezierCurvePyImp.cpp
01475 PyObject * BezierCurvePy::staticCallback_getNbPoles (PyObject *self, void * /*closure*/)
01476 {
01477     if (!((PyObjectBase*) self)->isValid()){
01478         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01479         return NULL;
01480     }
01481 
01482     try {
01483         return Py::new_reference_to(((BezierCurvePy*)self)->getNbPoles());
01484     } catch (const Py::Exception&) {
01485         // The exception text is already set
01486         return NULL;
01487     } catch (...) {
01488         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'NbPoles' of object 'GeomBezierCurve'");
01489         return NULL;
01490     }
01491 }
01492 
01493 int BezierCurvePy::staticCallback_setNbPoles (PyObject *self, PyObject * /*value*/, void * /*closure*/)
01494 {
01495     if (!((PyObjectBase*) self)->isValid()){
01496         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01497         return -1;
01498     }
01499 
01500     PyErr_SetString(PyExc_AttributeError, "Attribute 'NbPoles' of object 'GeomBezierCurve' is read-only");
01501     return -1;
01502 }
01503 
01504 // StartPoint() callback and implementer
01505 // PyObject*  BezierCurvePy::StartPoint(PyObject *args){};
01506 // has to be implemented in BezierCurvePyImp.cpp
01507 PyObject * BezierCurvePy::staticCallback_getStartPoint (PyObject *self, void * /*closure*/)
01508 {
01509     if (!((PyObjectBase*) self)->isValid()){
01510         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01511         return NULL;
01512     }
01513 
01514     try {
01515         return Py::new_reference_to(((BezierCurvePy*)self)->getStartPoint());
01516     } catch (const Py::Exception&) {
01517         // The exception text is already set
01518         return NULL;
01519     } catch (...) {
01520         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'StartPoint' of object 'GeomBezierCurve'");
01521         return NULL;
01522     }
01523 }
01524 
01525 int BezierCurvePy::staticCallback_setStartPoint (PyObject *self, PyObject * /*value*/, void * /*closure*/)
01526 {
01527     if (!((PyObjectBase*) self)->isValid()){
01528         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01529         return -1;
01530     }
01531 
01532     PyErr_SetString(PyExc_AttributeError, "Attribute 'StartPoint' of object 'GeomBezierCurve' is read-only");
01533     return -1;
01534 }
01535 
01536 // EndPoint() callback and implementer
01537 // PyObject*  BezierCurvePy::EndPoint(PyObject *args){};
01538 // has to be implemented in BezierCurvePyImp.cpp
01539 PyObject * BezierCurvePy::staticCallback_getEndPoint (PyObject *self, void * /*closure*/)
01540 {
01541     if (!((PyObjectBase*) self)->isValid()){
01542         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01543         return NULL;
01544     }
01545 
01546     try {
01547         return Py::new_reference_to(((BezierCurvePy*)self)->getEndPoint());
01548     } catch (const Py::Exception&) {
01549         // The exception text is already set
01550         return NULL;
01551     } catch (...) {
01552         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'EndPoint' of object 'GeomBezierCurve'");
01553         return NULL;
01554     }
01555 }
01556 
01557 int BezierCurvePy::staticCallback_setEndPoint (PyObject *self, PyObject * /*value*/, void * /*closure*/)
01558 {
01559     if (!((PyObjectBase*) self)->isValid()){
01560         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01561         return -1;
01562     }
01563 
01564     PyErr_SetString(PyExc_AttributeError, "Attribute 'EndPoint' of object 'GeomBezierCurve' is read-only");
01565     return -1;
01566 }
01567 
01568 
01569 
01570 //--------------------------------------------------------------------------
01571 // Parents structure
01572 //--------------------------------------------------------------------------
01573 PyParentObject BezierCurvePy::Parents[] = { PARENTSPartBezierCurvePy };
01574 
01575 //--------------------------------------------------------------------------
01576 // Constructor
01577 //--------------------------------------------------------------------------
01578 BezierCurvePy::BezierCurvePy(GeomBezierCurve *pcObject, PyTypeObject *T)
01579     : GeometryCurvePy(reinterpret_cast<GeometryCurvePy::PointerType>(pcObject), T)
01580 {
01581 }
01582 
01583 
01584 //--------------------------------------------------------------------------
01585 // destructor
01586 //--------------------------------------------------------------------------
01587 BezierCurvePy::~BezierCurvePy()                                // Everything handled in parent
01588 {
01589 }
01590 
01591 //--------------------------------------------------------------------------
01592 // BezierCurvePy representation
01593 //--------------------------------------------------------------------------
01594 PyObject *BezierCurvePy::_repr(void)
01595 {
01596     return Py_BuildValue("s", representation().c_str());
01597 }
01598 
01599 //--------------------------------------------------------------------------
01600 // BezierCurvePy Attributes
01601 //--------------------------------------------------------------------------
01602 PyObject *BezierCurvePy::_getattr(char *attr)                           // __getattr__ function: note only need to handle new state
01603 {
01604     try {
01605         // getter method for special Attributes (e.g. dynamic ones)
01606         PyObject *r = getCustomAttributes(attr);
01607         if(r) return r;
01608     }
01609 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01610     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01611     {
01612         std::string str;
01613         str += "FreeCAD exception thrown (";
01614         str += e.what();
01615         str += ")";
01616         e.ReportException();
01617         PyErr_SetString(PyExc_Exception,str.c_str());
01618         return NULL;
01619     }
01620     catch(const std::exception& e) // catch other c++ exceptions
01621     {
01622         std::string str;
01623         str += "FC++ exception thrown (";
01624         str += e.what();
01625         str += ")";
01626         Base::Console().Error(str.c_str());
01627         PyErr_SetString(PyExc_Exception,str.c_str());
01628         return NULL;
01629     }
01630     catch(const Py::Exception&)
01631     {
01632         // The exception text is already set
01633         return NULL;
01634     }
01635     catch(...)  // catch the rest!
01636     {
01637         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01638         return NULL;
01639     }
01640 #else  // DONT_CATCH_CXX_EXCEPTIONS  
01641     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01642     {
01643         std::string str;
01644         str += "FreeCAD exception thrown (";
01645         str += e.what();
01646         str += ")";
01647         e.ReportException();
01648         PyErr_SetString(PyExc_Exception,str.c_str());
01649         return NULL;
01650     }
01651     catch(const Py::Exception&)
01652     {
01653         // The exception text is already set
01654         return NULL;
01655     }
01656 #endif  // DONT_CATCH_CXX_EXCEPTIONS
01657 
01658     PyObject *rvalue = Py_FindMethod(Methods, this, attr);
01659     if (rvalue == NULL)
01660     {
01661         PyErr_Clear();
01662         return GeometryCurvePy::_getattr(attr);
01663     }
01664     else
01665     {
01666         return rvalue;
01667     }
01668 }
01669 
01670 int BezierCurvePy::_setattr(char *attr, PyObject *value)        // __setattr__ function: note only need to handle new state
01671 {
01672     try {
01673         // setter for  special Attributes (e.g. dynamic ones)
01674         int r = setCustomAttributes(attr, value);
01675         if(r==1) return 0;
01676     }
01677 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01678     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01679     {
01680         std::string str;
01681         str += "FreeCAD exception thrown (";
01682         str += e.what();
01683         str += ")";
01684         e.ReportException();
01685         PyErr_SetString(PyExc_Exception,str.c_str());
01686         return -1;
01687     }
01688     catch(const std::exception& e) // catch other c++ exceptions
01689     {
01690         std::string str;
01691         str += "FC++ exception thrown (";
01692         str += e.what();
01693         str += ")";
01694         Base::Console().Error(str.c_str());
01695         PyErr_SetString(PyExc_Exception,str.c_str());
01696         return -1;
01697     }
01698     catch(const Py::Exception&)
01699     {
01700         // The exception text is already set
01701         return -1;
01702     }
01703     catch(...)  // catch the rest!
01704     {
01705         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01706         return -1;
01707     }
01708 #else  // DONT_CATCH_CXX_EXCEPTIONS  
01709     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01710     {
01711         std::string str;
01712         str += "FreeCAD exception thrown (";
01713         str += e.what();
01714         str += ")";
01715         e.ReportException();
01716         PyErr_SetString(PyExc_Exception,str.c_str());
01717         return -1;
01718     }
01719     catch(const Py::Exception&)
01720     {
01721         // The exception text is already set
01722         return -1;
01723     }
01724 #endif  // DONT_CATCH_CXX_EXCEPTIONS
01725 
01726     return GeometryCurvePy::_setattr(attr, value);
01727 }
01728 
01729 GeomBezierCurve *BezierCurvePy::getGeomBezierCurvePtr(void) const
01730 {
01731     return static_cast<GeomBezierCurve *>(_pcTwinPointer);
01732 }
01733 
01734 #if 0
01735 /* From here on come the methods you have to implement, but NOT in this module. Implement in BezierCurvePyImp.cpp! This prototypes 
01736  * are just for convenience when you add a new method.
01737  */
01738 
01739 PyObject *BezierCurvePy::PyMake(struct _typeobject *, PyObject *, PyObject *)  // Python wrapper
01740 {
01741     // create a new instance of BezierCurvePy and the Twin object 
01742     return new BezierCurvePy(new GeomBezierCurve);
01743 }
01744 
01745 // constructor method
01746 int BezierCurvePy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
01747 {
01748     return 0;
01749 }
01750 
01751 // returns a string which represents the object e.g. when printed in python
01752 std::string BezierCurvePy::representation(void) const
01753 {
01754     return std::string("<GeomBezierCurve object>");
01755 }
01756 
01757 PyObject* BezierCurvePy::isRational(PyObject *args)
01758 {
01759     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01760     return 0;
01761 }
01762 
01763 PyObject* BezierCurvePy::isPeriodic(PyObject *args)
01764 {
01765     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01766     return 0;
01767 }
01768 
01769 PyObject* BezierCurvePy::isClosed(PyObject *args)
01770 {
01771     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01772     return 0;
01773 }
01774 
01775 PyObject* BezierCurvePy::increase(PyObject *args)
01776 {
01777     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01778     return 0;
01779 }
01780 
01781 PyObject* BezierCurvePy::insertPoleAfter(PyObject *args)
01782 {
01783     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01784     return 0;
01785 }
01786 
01787 PyObject* BezierCurvePy::insertPoleBefore(PyObject *args)
01788 {
01789     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01790     return 0;
01791 }
01792 
01793 PyObject* BezierCurvePy::removePole(PyObject *args)
01794 {
01795     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01796     return 0;
01797 }
01798 
01799 PyObject* BezierCurvePy::segment(PyObject *args)
01800 {
01801     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01802     return 0;
01803 }
01804 
01805 PyObject* BezierCurvePy::setPole(PyObject *args)
01806 {
01807     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01808     return 0;
01809 }
01810 
01811 PyObject* BezierCurvePy::getPole(PyObject *args)
01812 {
01813     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01814     return 0;
01815 }
01816 
01817 PyObject* BezierCurvePy::getPoles(PyObject *args)
01818 {
01819     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01820     return 0;
01821 }
01822 
01823 PyObject* BezierCurvePy::setPoles(PyObject *args)
01824 {
01825     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01826     return 0;
01827 }
01828 
01829 PyObject* BezierCurvePy::setWeight(PyObject *args)
01830 {
01831     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01832     return 0;
01833 }
01834 
01835 PyObject* BezierCurvePy::getWeight(PyObject *args)
01836 {
01837     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01838     return 0;
01839 }
01840 
01841 PyObject* BezierCurvePy::getWeights(PyObject *args)
01842 {
01843     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01844     return 0;
01845 }
01846 
01847 PyObject* BezierCurvePy::getResolution(PyObject *args)
01848 {
01849     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01850     return 0;
01851 }
01852 
01853 
01854 
01855 Py::Int BezierCurvePy::getDegree(void) const
01856 {
01857     //return Py::Int();
01858     throw Py::AttributeError("Not yet implemented");
01859 }
01860 
01861 Py::Int BezierCurvePy::getMaxDegree(void) const
01862 {
01863     //return Py::Int();
01864     throw Py::AttributeError("Not yet implemented");
01865 }
01866 
01867 Py::Int BezierCurvePy::getNbPoles(void) const
01868 {
01869     //return Py::Int();
01870     throw Py::AttributeError("Not yet implemented");
01871 }
01872 
01873 Py::Object BezierCurvePy::getStartPoint(void) const
01874 {
01875     //return Py::Object();
01876     throw Py::AttributeError("Not yet implemented");
01877 }
01878 
01879 Py::Object BezierCurvePy::getEndPoint(void) const
01880 {
01881     //return Py::Object();
01882     throw Py::AttributeError("Not yet implemented");
01883 }
01884 
01885 PyObject *BezierCurvePy::getCustomAttributes(const char* attr) const
01886 {
01887     return 0;
01888 }
01889 
01890 int BezierCurvePy::setCustomAttributes(const char* attr, PyObject *obj)
01891 {
01892     return 0; 
01893 }
01894 #endif
01895 
01896 
01897 

Generated on Wed Nov 23 18:59:58 2011 for FreeCAD by  doxygen 1.6.1