EllipsePy.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 EllipsePyImp.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 EllipsePy::Type = {
00021     PyObject_HEAD_INIT(&PyType_Type)
00022     0,                                                /*ob_size*/
00023     "Part.GeomEllipse",     /*tp_name*/
00024     sizeof(EllipsePy),                       /*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     "Describes an ellipse in 3D space\n"
00046     "                           To create an ellipse there are several ways:\n"
00047     "                           Part.Ellipse()\n"
00048     "                                   Creates an ellipse with major radius 2 and minor radius 1 with the\n"
00049     "                                   center in (0,0,0)\n"
00050     "\n"
00051     "                           Part.Ellipse(Ellipse)\n"
00052     "                                   Create a copy of the given ellipse\n"
00053     "\n"
00054     "                           Part.Ellipse(S1,S2,Center)\n"
00055     "                                   Creates an ellipse centered on the point Center, where\n"
00056     "                                   the plane of the ellipse is defined by Center, S1 and S2,\n"
00057     "                                   its major axis is defined by Center and S1,\n"
00058     "                                   its major radius is the distance between Center and S1, and\n"
00059     "                                   its minor radius is the distance between S2 and the major axis.\n"
00060     "\n"
00061     "                           Part.Ellipse(Center,MajorRadius,MinorRadius)\n"
00062     "                                   Creates an ellipse with major and minor radii MajorRadius and\n"
00063     "                                   MinorRadius, and located in the plane defined by Center and\n"
00064     "                                   the normal (0,0,1)\n"
00065     "                   ",           /*tp_doc */
00066     0,                                                /*tp_traverse */
00067     0,                                                /*tp_clear */
00068     0,                                                /*tp_richcompare */
00069     0,                                                /*tp_weaklistoffset */
00070     0,                                                /*tp_iter */
00071     0,                                                /*tp_iternext */
00072     Part::EllipsePy::Methods,                     /*tp_methods */
00073     0,                                                /*tp_members */
00074     Part::EllipsePy::GetterSetter,                     /*tp_getset */
00075     &Part::GeometryCurvePy::Type,                        /*tp_base */
00076     0,                                                /*tp_dict */
00077     0,                                                /*tp_descr_get */
00078     0,                                                /*tp_descr_set */
00079     0,                                                /*tp_dictoffset */
00080     __PyInit,                                         /*tp_init */
00081     0,                                                /*tp_alloc */
00082     Part::EllipsePy::PyMake,/*tp_new */
00083     0,                                                /*tp_free   Low-level free-memory routine */
00084     0,                                                /*tp_is_gc  For PyObject_IS_GC */
00085     0,                                                /*tp_bases */
00086     0,                                                /*tp_mro    method resolution order */
00087     0,                                                /*tp_cache */
00088     0,                                                /*tp_subclasses */
00089     0,                                                /*tp_weaklist */
00090     0                                                 /*tp_del */
00091 };
00092 
00094 PyMethodDef EllipsePy::Methods[] = {
00095     {NULL, NULL, 0, NULL}               /* Sentinel */
00096 };
00097 
00098 
00099 
00101 PyGetSetDef EllipsePy::GetterSetter[] = {
00102     {"MajorRadius",
00103         (getter) staticCallback_getMajorRadius,
00104         (setter) staticCallback_setMajorRadius, 
00105         "The major radius of the ellipse.",
00106         NULL
00107     },
00108     {"MinorRadius",
00109         (getter) staticCallback_getMinorRadius,
00110         (setter) staticCallback_setMinorRadius, 
00111         "The minor radius of the ellipse.",
00112         NULL
00113     },
00114     {"Eccentricity",
00115         (getter) staticCallback_getEccentricity,
00116         (setter) staticCallback_setEccentricity, 
00117         "The eccentricity of the ellipse.",
00118         NULL
00119     },
00120     {"Focal",
00121         (getter) staticCallback_getFocal,
00122         (setter) staticCallback_setFocal, 
00123         "The focal distance of the ellipse.",
00124         NULL
00125     },
00126     {"Focus1",
00127         (getter) staticCallback_getFocus1,
00128         (setter) staticCallback_setFocus1, 
00129         "The first focus is on the positive side of the major axis of the ellipse;\nthe second focus is on the negative side.",
00130         NULL
00131     },
00132     {"Focus2",
00133         (getter) staticCallback_getFocus2,
00134         (setter) staticCallback_setFocus2, 
00135         "",
00136         NULL
00137     },
00138     {"Center",
00139         (getter) staticCallback_getCenter,
00140         (setter) staticCallback_setCenter, 
00141         "Center of the ellipse.",
00142         NULL
00143     },
00144     {"Axis",
00145         (getter) staticCallback_getAxis,
00146         (setter) staticCallback_setAxis, 
00147         "The axis direction of the circle",
00148         NULL
00149     },
00150     {NULL, NULL, NULL, NULL, NULL}              /* Sentinel */
00151 };
00152 
00153 // MajorRadius() callback and implementer
00154 // PyObject*  EllipsePy::MajorRadius(PyObject *args){};
00155 // has to be implemented in EllipsePyImp.cpp
00156 PyObject * EllipsePy::staticCallback_getMajorRadius (PyObject *self, void * /*closure*/)
00157 {
00158     if (!((PyObjectBase*) self)->isValid()){
00159         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00160         return NULL;
00161     }
00162 
00163     try {
00164         return Py::new_reference_to(((EllipsePy*)self)->getMajorRadius());
00165     } catch (const Py::Exception&) {
00166         // The exception text is already set
00167         return NULL;
00168     } catch (...) {
00169         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'MajorRadius' of object 'GeomEllipse'");
00170         return NULL;
00171     }
00172 }
00173 
00174 int EllipsePy::staticCallback_setMajorRadius (PyObject *self, PyObject *value, void * /*closure*/)
00175 {    
00176     if (!((PyObjectBase*) self)->isValid()){
00177         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00178         return -1;
00179     }
00180     if (((PyObjectBase*) self)->isConst()){
00181         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
00182         return -1;
00183     }
00184 
00185     try {
00186         ((EllipsePy*)self)->setMajorRadius(Py::Float(value,false));
00187         return 0;
00188     } catch (const Py::Exception&) {
00189         // The exception text is already set
00190         return -1;
00191     } catch (...) {
00192         PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'MajorRadius' of object 'GeomEllipse'");
00193         return -1;
00194     }
00195 }
00196 
00197 // MinorRadius() callback and implementer
00198 // PyObject*  EllipsePy::MinorRadius(PyObject *args){};
00199 // has to be implemented in EllipsePyImp.cpp
00200 PyObject * EllipsePy::staticCallback_getMinorRadius (PyObject *self, void * /*closure*/)
00201 {
00202     if (!((PyObjectBase*) self)->isValid()){
00203         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00204         return NULL;
00205     }
00206 
00207     try {
00208         return Py::new_reference_to(((EllipsePy*)self)->getMinorRadius());
00209     } catch (const Py::Exception&) {
00210         // The exception text is already set
00211         return NULL;
00212     } catch (...) {
00213         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'MinorRadius' of object 'GeomEllipse'");
00214         return NULL;
00215     }
00216 }
00217 
00218 int EllipsePy::staticCallback_setMinorRadius (PyObject *self, PyObject *value, void * /*closure*/)
00219 {    
00220     if (!((PyObjectBase*) self)->isValid()){
00221         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00222         return -1;
00223     }
00224     if (((PyObjectBase*) self)->isConst()){
00225         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
00226         return -1;
00227     }
00228 
00229     try {
00230         ((EllipsePy*)self)->setMinorRadius(Py::Float(value,false));
00231         return 0;
00232     } catch (const Py::Exception&) {
00233         // The exception text is already set
00234         return -1;
00235     } catch (...) {
00236         PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'MinorRadius' of object 'GeomEllipse'");
00237         return -1;
00238     }
00239 }
00240 
00241 // Eccentricity() callback and implementer
00242 // PyObject*  EllipsePy::Eccentricity(PyObject *args){};
00243 // has to be implemented in EllipsePyImp.cpp
00244 PyObject * EllipsePy::staticCallback_getEccentricity (PyObject *self, void * /*closure*/)
00245 {
00246     if (!((PyObjectBase*) self)->isValid()){
00247         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00248         return NULL;
00249     }
00250 
00251     try {
00252         return Py::new_reference_to(((EllipsePy*)self)->getEccentricity());
00253     } catch (const Py::Exception&) {
00254         // The exception text is already set
00255         return NULL;
00256     } catch (...) {
00257         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'Eccentricity' of object 'GeomEllipse'");
00258         return NULL;
00259     }
00260 }
00261 
00262 int EllipsePy::staticCallback_setEccentricity (PyObject *self, PyObject * /*value*/, void * /*closure*/)
00263 {
00264     if (!((PyObjectBase*) self)->isValid()){
00265         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00266         return -1;
00267     }
00268 
00269     PyErr_SetString(PyExc_AttributeError, "Attribute 'Eccentricity' of object 'GeomEllipse' is read-only");
00270     return -1;
00271 }
00272 
00273 // Focal() callback and implementer
00274 // PyObject*  EllipsePy::Focal(PyObject *args){};
00275 // has to be implemented in EllipsePyImp.cpp
00276 PyObject * EllipsePy::staticCallback_getFocal (PyObject *self, void * /*closure*/)
00277 {
00278     if (!((PyObjectBase*) self)->isValid()){
00279         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00280         return NULL;
00281     }
00282 
00283     try {
00284         return Py::new_reference_to(((EllipsePy*)self)->getFocal());
00285     } catch (const Py::Exception&) {
00286         // The exception text is already set
00287         return NULL;
00288     } catch (...) {
00289         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'Focal' of object 'GeomEllipse'");
00290         return NULL;
00291     }
00292 }
00293 
00294 int EllipsePy::staticCallback_setFocal (PyObject *self, PyObject * /*value*/, void * /*closure*/)
00295 {
00296     if (!((PyObjectBase*) self)->isValid()){
00297         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00298         return -1;
00299     }
00300 
00301     PyErr_SetString(PyExc_AttributeError, "Attribute 'Focal' of object 'GeomEllipse' is read-only");
00302     return -1;
00303 }
00304 
00305 // Focus1() callback and implementer
00306 // PyObject*  EllipsePy::Focus1(PyObject *args){};
00307 // has to be implemented in EllipsePyImp.cpp
00308 PyObject * EllipsePy::staticCallback_getFocus1 (PyObject *self, void * /*closure*/)
00309 {
00310     if (!((PyObjectBase*) self)->isValid()){
00311         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00312         return NULL;
00313     }
00314 
00315     try {
00316         return Py::new_reference_to(((EllipsePy*)self)->getFocus1());
00317     } catch (const Py::Exception&) {
00318         // The exception text is already set
00319         return NULL;
00320     } catch (...) {
00321         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'Focus1' of object 'GeomEllipse'");
00322         return NULL;
00323     }
00324 }
00325 
00326 int EllipsePy::staticCallback_setFocus1 (PyObject *self, PyObject * /*value*/, void * /*closure*/)
00327 {
00328     if (!((PyObjectBase*) self)->isValid()){
00329         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00330         return -1;
00331     }
00332 
00333     PyErr_SetString(PyExc_AttributeError, "Attribute 'Focus1' of object 'GeomEllipse' is read-only");
00334     return -1;
00335 }
00336 
00337 // Focus2() callback and implementer
00338 // PyObject*  EllipsePy::Focus2(PyObject *args){};
00339 // has to be implemented in EllipsePyImp.cpp
00340 PyObject * EllipsePy::staticCallback_getFocus2 (PyObject *self, void * /*closure*/)
00341 {
00342     if (!((PyObjectBase*) self)->isValid()){
00343         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00344         return NULL;
00345     }
00346 
00347     try {
00348         return Py::new_reference_to(((EllipsePy*)self)->getFocus2());
00349     } catch (const Py::Exception&) {
00350         // The exception text is already set
00351         return NULL;
00352     } catch (...) {
00353         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'Focus2' of object 'GeomEllipse'");
00354         return NULL;
00355     }
00356 }
00357 
00358 int EllipsePy::staticCallback_setFocus2 (PyObject *self, PyObject * /*value*/, void * /*closure*/)
00359 {
00360     if (!((PyObjectBase*) self)->isValid()){
00361         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00362         return -1;
00363     }
00364 
00365     PyErr_SetString(PyExc_AttributeError, "Attribute 'Focus2' of object 'GeomEllipse' is read-only");
00366     return -1;
00367 }
00368 
00369 // Center() callback and implementer
00370 // PyObject*  EllipsePy::Center(PyObject *args){};
00371 // has to be implemented in EllipsePyImp.cpp
00372 PyObject * EllipsePy::staticCallback_getCenter (PyObject *self, void * /*closure*/)
00373 {
00374     if (!((PyObjectBase*) self)->isValid()){
00375         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00376         return NULL;
00377     }
00378 
00379     try {
00380         return Py::new_reference_to(((EllipsePy*)self)->getCenter());
00381     } catch (const Py::Exception&) {
00382         // The exception text is already set
00383         return NULL;
00384     } catch (...) {
00385         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'Center' of object 'GeomEllipse'");
00386         return NULL;
00387     }
00388 }
00389 
00390 int EllipsePy::staticCallback_setCenter (PyObject *self, PyObject *value, void * /*closure*/)
00391 {    
00392     if (!((PyObjectBase*) self)->isValid()){
00393         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00394         return -1;
00395     }
00396     if (((PyObjectBase*) self)->isConst()){
00397         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
00398         return -1;
00399     }
00400 
00401     try {
00402         ((EllipsePy*)self)->setCenter(Py::Object(value,false));
00403         return 0;
00404     } catch (const Py::Exception&) {
00405         // The exception text is already set
00406         return -1;
00407     } catch (...) {
00408         PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'Center' of object 'GeomEllipse'");
00409         return -1;
00410     }
00411 }
00412 
00413 // Axis() callback and implementer
00414 // PyObject*  EllipsePy::Axis(PyObject *args){};
00415 // has to be implemented in EllipsePyImp.cpp
00416 PyObject * EllipsePy::staticCallback_getAxis (PyObject *self, void * /*closure*/)
00417 {
00418     if (!((PyObjectBase*) self)->isValid()){
00419         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00420         return NULL;
00421     }
00422 
00423     try {
00424         return Py::new_reference_to(((EllipsePy*)self)->getAxis());
00425     } catch (const Py::Exception&) {
00426         // The exception text is already set
00427         return NULL;
00428     } catch (...) {
00429         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'Axis' of object 'GeomEllipse'");
00430         return NULL;
00431     }
00432 }
00433 
00434 int EllipsePy::staticCallback_setAxis (PyObject *self, PyObject *value, void * /*closure*/)
00435 {    
00436     if (!((PyObjectBase*) self)->isValid()){
00437         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00438         return -1;
00439     }
00440     if (((PyObjectBase*) self)->isConst()){
00441         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
00442         return -1;
00443     }
00444 
00445     try {
00446         ((EllipsePy*)self)->setAxis(Py::Object(value,false));
00447         return 0;
00448     } catch (const Py::Exception&) {
00449         // The exception text is already set
00450         return -1;
00451     } catch (...) {
00452         PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'Axis' of object 'GeomEllipse'");
00453         return -1;
00454     }
00455 }
00456 
00457 
00458 
00459 //--------------------------------------------------------------------------
00460 // Parents structure
00461 //--------------------------------------------------------------------------
00462 PyParentObject EllipsePy::Parents[] = { PARENTSPartEllipsePy };
00463 
00464 //--------------------------------------------------------------------------
00465 // Constructor
00466 //--------------------------------------------------------------------------
00467 EllipsePy::EllipsePy(GeomEllipse *pcObject, PyTypeObject *T)
00468     : GeometryCurvePy(reinterpret_cast<GeometryCurvePy::PointerType>(pcObject), T)
00469 {
00470 }
00471 
00472 
00473 //--------------------------------------------------------------------------
00474 // destructor
00475 //--------------------------------------------------------------------------
00476 EllipsePy::~EllipsePy()                                // Everything handled in parent
00477 {
00478 }
00479 
00480 //--------------------------------------------------------------------------
00481 // EllipsePy representation
00482 //--------------------------------------------------------------------------
00483 PyObject *EllipsePy::_repr(void)
00484 {
00485     return Py_BuildValue("s", representation().c_str());
00486 }
00487 
00488 //--------------------------------------------------------------------------
00489 // EllipsePy Attributes
00490 //--------------------------------------------------------------------------
00491 PyObject *EllipsePy::_getattr(char *attr)                               // __getattr__ function: note only need to handle new state
00492 {
00493     try {
00494         // getter method for special Attributes (e.g. dynamic ones)
00495         PyObject *r = getCustomAttributes(attr);
00496         if(r) return r;
00497     }
00498 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00499     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00500     {
00501         std::string str;
00502         str += "FreeCAD exception thrown (";
00503         str += e.what();
00504         str += ")";
00505         e.ReportException();
00506         PyErr_SetString(PyExc_Exception,str.c_str());
00507         return NULL;
00508     }
00509     catch(const std::exception& e) // catch other c++ exceptions
00510     {
00511         std::string str;
00512         str += "FC++ exception thrown (";
00513         str += e.what();
00514         str += ")";
00515         Base::Console().Error(str.c_str());
00516         PyErr_SetString(PyExc_Exception,str.c_str());
00517         return NULL;
00518     }
00519     catch(const Py::Exception&)
00520     {
00521         // The exception text is already set
00522         return NULL;
00523     }
00524     catch(...)  // catch the rest!
00525     {
00526         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00527         return NULL;
00528     }
00529 #else  // DONT_CATCH_CXX_EXCEPTIONS  
00530     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00531     {
00532         std::string str;
00533         str += "FreeCAD exception thrown (";
00534         str += e.what();
00535         str += ")";
00536         e.ReportException();
00537         PyErr_SetString(PyExc_Exception,str.c_str());
00538         return NULL;
00539     }
00540     catch(const Py::Exception&)
00541     {
00542         // The exception text is already set
00543         return NULL;
00544     }
00545 #endif  // DONT_CATCH_CXX_EXCEPTIONS
00546 
00547     PyObject *rvalue = Py_FindMethod(Methods, this, attr);
00548     if (rvalue == NULL)
00549     {
00550         PyErr_Clear();
00551         return GeometryCurvePy::_getattr(attr);
00552     }
00553     else
00554     {
00555         return rvalue;
00556     }
00557 }
00558 
00559 int EllipsePy::_setattr(char *attr, PyObject *value)    // __setattr__ function: note only need to handle new state
00560 {
00561     try {
00562         // setter for  special Attributes (e.g. dynamic ones)
00563         int r = setCustomAttributes(attr, value);
00564         if(r==1) return 0;
00565     }
00566 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00567     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00568     {
00569         std::string str;
00570         str += "FreeCAD exception thrown (";
00571         str += e.what();
00572         str += ")";
00573         e.ReportException();
00574         PyErr_SetString(PyExc_Exception,str.c_str());
00575         return -1;
00576     }
00577     catch(const std::exception& e) // catch other c++ exceptions
00578     {
00579         std::string str;
00580         str += "FC++ exception thrown (";
00581         str += e.what();
00582         str += ")";
00583         Base::Console().Error(str.c_str());
00584         PyErr_SetString(PyExc_Exception,str.c_str());
00585         return -1;
00586     }
00587     catch(const Py::Exception&)
00588     {
00589         // The exception text is already set
00590         return -1;
00591     }
00592     catch(...)  // catch the rest!
00593     {
00594         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00595         return -1;
00596     }
00597 #else  // DONT_CATCH_CXX_EXCEPTIONS  
00598     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00599     {
00600         std::string str;
00601         str += "FreeCAD exception thrown (";
00602         str += e.what();
00603         str += ")";
00604         e.ReportException();
00605         PyErr_SetString(PyExc_Exception,str.c_str());
00606         return -1;
00607     }
00608     catch(const Py::Exception&)
00609     {
00610         // The exception text is already set
00611         return -1;
00612     }
00613 #endif  // DONT_CATCH_CXX_EXCEPTIONS
00614 
00615     return GeometryCurvePy::_setattr(attr, value);
00616 }
00617 
00618 GeomEllipse *EllipsePy::getGeomEllipsePtr(void) const
00619 {
00620     return static_cast<GeomEllipse *>(_pcTwinPointer);
00621 }
00622 
00623 #if 0
00624 /* From here on come the methods you have to implement, but NOT in this module. Implement in EllipsePyImp.cpp! This prototypes 
00625  * are just for convenience when you add a new method.
00626  */
00627 
00628 PyObject *EllipsePy::PyMake(struct _typeobject *, PyObject *, PyObject *)  // Python wrapper
00629 {
00630     // create a new instance of EllipsePy and the Twin object 
00631     return new EllipsePy(new GeomEllipse);
00632 }
00633 
00634 // constructor method
00635 int EllipsePy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
00636 {
00637     return 0;
00638 }
00639 
00640 // returns a string which represents the object e.g. when printed in python
00641 std::string EllipsePy::representation(void) const
00642 {
00643     return std::string("<GeomEllipse object>");
00644 }
00645 
00646 
00647 
00648 Py::Float EllipsePy::getMajorRadius(void) const
00649 {
00650     //return Py::Float();
00651     throw Py::AttributeError("Not yet implemented");
00652 }
00653 
00654 void  EllipsePy::setMajorRadius(Py::Float arg)
00655 {
00656     throw Py::AttributeError("Not yet implemented");
00657 }
00658 
00659 Py::Float EllipsePy::getMinorRadius(void) const
00660 {
00661     //return Py::Float();
00662     throw Py::AttributeError("Not yet implemented");
00663 }
00664 
00665 void  EllipsePy::setMinorRadius(Py::Float arg)
00666 {
00667     throw Py::AttributeError("Not yet implemented");
00668 }
00669 
00670 Py::Float EllipsePy::getEccentricity(void) const
00671 {
00672     //return Py::Float();
00673     throw Py::AttributeError("Not yet implemented");
00674 }
00675 
00676 Py::Float EllipsePy::getFocal(void) const
00677 {
00678     //return Py::Float();
00679     throw Py::AttributeError("Not yet implemented");
00680 }
00681 
00682 Py::Object EllipsePy::getFocus1(void) const
00683 {
00684     //return Py::Object();
00685     throw Py::AttributeError("Not yet implemented");
00686 }
00687 
00688 Py::Object EllipsePy::getFocus2(void) const
00689 {
00690     //return Py::Object();
00691     throw Py::AttributeError("Not yet implemented");
00692 }
00693 
00694 Py::Object EllipsePy::getCenter(void) const
00695 {
00696     //return Py::Object();
00697     throw Py::AttributeError("Not yet implemented");
00698 }
00699 
00700 void  EllipsePy::setCenter(Py::Object arg)
00701 {
00702     throw Py::AttributeError("Not yet implemented");
00703 }
00704 
00705 Py::Object EllipsePy::getAxis(void) const
00706 {
00707     //return Py::Object();
00708     throw Py::AttributeError("Not yet implemented");
00709 }
00710 
00711 void  EllipsePy::setAxis(Py::Object arg)
00712 {
00713     throw Py::AttributeError("Not yet implemented");
00714 }
00715 
00716 PyObject *EllipsePy::getCustomAttributes(const char* attr) const
00717 {
00718     return 0;
00719 }
00720 
00721 int EllipsePy::setCustomAttributes(const char* attr, PyObject *obj)
00722 {
00723     return 0; 
00724 }
00725 #endif
00726 
00727 
00728 

Generated on Wed Nov 23 19:00:10 2011 for FreeCAD by  doxygen 1.6.1