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

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