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

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