BoundBoxPy.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 BoundBoxPyImp.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 Base;
00018 
00020 PyTypeObject BoundBoxPy::Type = {
00021     PyObject_HEAD_INIT(&PyType_Type)
00022     0,                                                /*ob_size*/
00023     "Base.BoundBox",     /*tp_name*/
00024     sizeof(BoundBoxPy),                       /*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     "Bound box class\n"
00046     "A bounding box is an orthographic cube which is a way to describe outer boundaries.\n"
00047     "You get a bounding box from a lot of 3D types. It is often used to check if a 3D\n"
00048     "entity lies in the range of another object. Checking for boundig interference first\n"
00049     "can save a lot of computing time!\n"
00050     "\n"
00051     "Constructor:\n"
00052     "App.BoundBox([Xmin,Ymin,Zmin,Xmax,Ymax,Zmax])\n"
00053     "App.BoundBox(Tuple, Tuple)\n"
00054     "App.BoundBox(Vector, Vector)\n"
00055     "App.BoundBox(BoundBox)\n"
00056     "     ",           /*tp_doc */
00057     0,                                                /*tp_traverse */
00058     0,                                                /*tp_clear */
00059     0,                                                /*tp_richcompare */
00060     0,                                                /*tp_weaklistoffset */
00061     0,                                                /*tp_iter */
00062     0,                                                /*tp_iternext */
00063     Base::BoundBoxPy::Methods,                     /*tp_methods */
00064     0,                                                /*tp_members */
00065     Base::BoundBoxPy::GetterSetter,                     /*tp_getset */
00066     &Base::PyObjectBase::Type,                        /*tp_base */
00067     0,                                                /*tp_dict */
00068     0,                                                /*tp_descr_get */
00069     0,                                                /*tp_descr_set */
00070     0,                                                /*tp_dictoffset */
00071     __PyInit,                                         /*tp_init */
00072     0,                                                /*tp_alloc */
00073     Base::BoundBoxPy::PyMake,/*tp_new */
00074     0,                                                /*tp_free   Low-level free-memory routine */
00075     0,                                                /*tp_is_gc  For PyObject_IS_GC */
00076     0,                                                /*tp_bases */
00077     0,                                                /*tp_mro    method resolution order */
00078     0,                                                /*tp_cache */
00079     0,                                                /*tp_subclasses */
00080     0,                                                /*tp_weaklist */
00081     0                                                 /*tp_del */
00082 };
00083 
00085 PyMethodDef BoundBoxPy::Methods[] = {
00086     {"add",
00087         (PyCFunction) staticCallback_add,
00088         METH_VARARGS,
00089         "method add(BoundBox)\nAdd (enlarge) the given BoundBox"
00090     },
00091     {"isIntersection",
00092         (PyCFunction) staticCallback_isIntersection,
00093         METH_VARARGS,
00094         "method isIntersection(Vector|BoundBox|Vector Base, Vector Dir)\nChecks if the given object intersects with the BoundBox. That can be:\n- A Vector (Point)\n- Another BoundBox\n- A line, specified by Base and Dir\n           "
00095     },
00096     {"enlarge",
00097         (PyCFunction) staticCallback_enlarge,
00098         METH_VARARGS,
00099         "method enlarge(Float)\nEnlarge the BoundBox by the given value in each direction.\nA negative value shrinks the box."
00100     },
00101     {"getIntersectionPoint",
00102         (PyCFunction) staticCallback_getIntersectionPoint,
00103         METH_VARARGS,
00104         "method Vector getIntersectionPoint(Vector Base, Vector Dir, [float epsilon=0.0001])\nCalculate the intersection point of a line with the BoundBox\nThe Base point must lie inside the bounding box, if not an\nexception is thrown.\n                    "
00105     },
00106     {"move",
00107         (PyCFunction) staticCallback_move,
00108         METH_VARARGS,
00109         " method getIntersectionPoint(Vector)\nMove the BoundBox by the given vector\n                    "
00110     },
00111     {"isCutPlane",
00112         (PyCFunction) staticCallback_isCutPlane,
00113         METH_VARARGS,
00114         "method bool isCutPlane(Vector Base, Vector Normal)\nCheck if the plane specified by Base and Normal intersects (cuts) the BoundBox"
00115     },
00116     {"isInside",
00117         (PyCFunction) staticCallback_isInside,
00118         METH_VARARGS,
00119         "\n                                     method bool isInside(Vector Base|BoundBox box)\nCheck if the point or bounding box is inside this bounding box\n                                "
00120     },
00121     {NULL, NULL, 0, NULL}               /* Sentinel */
00122 };
00123 
00124 
00125 
00127 PyGetSetDef BoundBoxPy::GetterSetter[] = {
00128     {"Center",
00129         (getter) staticCallback_getCenter,
00130         (setter) staticCallback_setCenter, 
00131         "Center point of the bounding box",
00132         NULL
00133     },
00134     {"XMax",
00135         (getter) staticCallback_getXMax,
00136         (setter) staticCallback_setXMax, 
00137         "The maximum x boundary position",
00138         NULL
00139     },
00140     {"YMax",
00141         (getter) staticCallback_getYMax,
00142         (setter) staticCallback_setYMax, 
00143         "The maximum y boundary position",
00144         NULL
00145     },
00146     {"ZMax",
00147         (getter) staticCallback_getZMax,
00148         (setter) staticCallback_setZMax, 
00149         "The maximum z boundary position",
00150         NULL
00151     },
00152     {"XMin",
00153         (getter) staticCallback_getXMin,
00154         (setter) staticCallback_setXMin, 
00155         "The minimum x boundary position",
00156         NULL
00157     },
00158     {"YMin",
00159         (getter) staticCallback_getYMin,
00160         (setter) staticCallback_setYMin, 
00161         "The minimum y boundary position",
00162         NULL
00163     },
00164     {"ZMin",
00165         (getter) staticCallback_getZMin,
00166         (setter) staticCallback_setZMin, 
00167         "The minimum z boundary position",
00168         NULL
00169     },
00170     {"XLength",
00171         (getter) staticCallback_getXLength,
00172         (setter) staticCallback_setXLength, 
00173         "Length of the BoundBox in x direction",
00174         NULL
00175     },
00176     {"YLength",
00177         (getter) staticCallback_getYLength,
00178         (setter) staticCallback_setYLength, 
00179         "Length of the BoundBox in y direction",
00180         NULL
00181     },
00182     {"ZLength",
00183         (getter) staticCallback_getZLength,
00184         (setter) staticCallback_setZLength, 
00185         "Length of the BoundBox in z direction",
00186         NULL
00187     },
00188     {"DiagonalLength",
00189         (getter) staticCallback_getDiagonalLength,
00190         (setter) staticCallback_setDiagonalLength, 
00191         "Diagonal length of the BoundBox",
00192         NULL
00193     },
00194     {NULL, NULL, NULL, NULL, NULL}              /* Sentinel */
00195 };
00196 
00197 // add() callback and implementer
00198 // PyObject*  BoundBoxPy::add(PyObject *args){};
00199 // has to be implemented in BoundBoxPyImp.cpp
00200 PyObject * BoundBoxPy::staticCallback_add (PyObject *self, PyObject *args)
00201 {
00202     // test if twin object not allready deleted
00203     if (!((PyObjectBase*) self)->isValid()){
00204         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00205         return NULL;
00206     }
00207 
00208     // test if object is set Const
00209     if (((PyObjectBase*) self)->isConst()){
00210         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00211         return NULL;
00212     }
00213 
00214     try { // catches all exceptions coming up from c++ and generate a python exception
00215         PyObject* ret = ((BoundBoxPy*)self)->add(args);
00216         if (ret != 0)
00217             ((BoundBoxPy*)self)->startNotify();
00218         return ret;
00219     }
00220     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00221     {
00222         std::string str;
00223         str += "FreeCAD exception thrown (";
00224         str += e.what();
00225         str += ")";
00226         e.ReportException();
00227         PyErr_SetString(PyExc_Exception,str.c_str());
00228         return NULL;
00229     }
00230     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00231     {
00232         std::string str;
00233         str += "File system exception thrown (";
00234         //str += e.who();
00235         //str += ", ";
00236         str += e.what();
00237         str += ")\n";
00238         Base::Console().Error(str.c_str());
00239         PyErr_SetString(PyExc_Exception,str.c_str());
00240         return NULL;
00241     }
00242     catch(const Py::Exception&)
00243     {
00244         // The exception text is already set
00245         return NULL;
00246     }
00247     catch(const char* e) // catch simple string exceptions
00248     {
00249         Base::Console().Error(e);
00250         PyErr_SetString(PyExc_Exception,e);
00251         return NULL;
00252     }
00253     // in debug not all exceptions will be catched to get the attention of the developer!
00254 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00255     catch(const std::exception& e) // catch other c++ exceptions
00256     {
00257         std::string str;
00258         str += "FC++ exception thrown (";
00259         str += e.what();
00260         str += ")";
00261         Base::Console().Error(str.c_str());
00262         PyErr_SetString(PyExc_Exception,str.c_str());
00263         return NULL;
00264     }
00265     catch(...)  // catch the rest!
00266     {
00267         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00268         return NULL;
00269     }
00270 #endif
00271 }
00272 
00273 // isIntersection() callback and implementer
00274 // PyObject*  BoundBoxPy::isIntersection(PyObject *args){};
00275 // has to be implemented in BoundBoxPyImp.cpp
00276 PyObject * BoundBoxPy::staticCallback_isIntersection (PyObject *self, PyObject *args)
00277 {
00278     // test if twin object not allready deleted
00279     if (!((PyObjectBase*) self)->isValid()){
00280         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00281         return NULL;
00282     }
00283 
00284     // test if object is set Const
00285     if (((PyObjectBase*) self)->isConst()){
00286         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00287         return NULL;
00288     }
00289 
00290     try { // catches all exceptions coming up from c++ and generate a python exception
00291         PyObject* ret = ((BoundBoxPy*)self)->isIntersection(args);
00292         if (ret != 0)
00293             ((BoundBoxPy*)self)->startNotify();
00294         return ret;
00295     }
00296     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00297     {
00298         std::string str;
00299         str += "FreeCAD exception thrown (";
00300         str += e.what();
00301         str += ")";
00302         e.ReportException();
00303         PyErr_SetString(PyExc_Exception,str.c_str());
00304         return NULL;
00305     }
00306     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00307     {
00308         std::string str;
00309         str += "File system exception thrown (";
00310         //str += e.who();
00311         //str += ", ";
00312         str += e.what();
00313         str += ")\n";
00314         Base::Console().Error(str.c_str());
00315         PyErr_SetString(PyExc_Exception,str.c_str());
00316         return NULL;
00317     }
00318     catch(const Py::Exception&)
00319     {
00320         // The exception text is already set
00321         return NULL;
00322     }
00323     catch(const char* e) // catch simple string exceptions
00324     {
00325         Base::Console().Error(e);
00326         PyErr_SetString(PyExc_Exception,e);
00327         return NULL;
00328     }
00329     // in debug not all exceptions will be catched to get the attention of the developer!
00330 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00331     catch(const std::exception& e) // catch other c++ exceptions
00332     {
00333         std::string str;
00334         str += "FC++ exception thrown (";
00335         str += e.what();
00336         str += ")";
00337         Base::Console().Error(str.c_str());
00338         PyErr_SetString(PyExc_Exception,str.c_str());
00339         return NULL;
00340     }
00341     catch(...)  // catch the rest!
00342     {
00343         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00344         return NULL;
00345     }
00346 #endif
00347 }
00348 
00349 // enlarge() callback and implementer
00350 // PyObject*  BoundBoxPy::enlarge(PyObject *args){};
00351 // has to be implemented in BoundBoxPyImp.cpp
00352 PyObject * BoundBoxPy::staticCallback_enlarge (PyObject *self, PyObject *args)
00353 {
00354     // test if twin object not allready deleted
00355     if (!((PyObjectBase*) self)->isValid()){
00356         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00357         return NULL;
00358     }
00359 
00360     // test if object is set Const
00361     if (((PyObjectBase*) self)->isConst()){
00362         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00363         return NULL;
00364     }
00365 
00366     try { // catches all exceptions coming up from c++ and generate a python exception
00367         PyObject* ret = ((BoundBoxPy*)self)->enlarge(args);
00368         if (ret != 0)
00369             ((BoundBoxPy*)self)->startNotify();
00370         return ret;
00371     }
00372     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00373     {
00374         std::string str;
00375         str += "FreeCAD exception thrown (";
00376         str += e.what();
00377         str += ")";
00378         e.ReportException();
00379         PyErr_SetString(PyExc_Exception,str.c_str());
00380         return NULL;
00381     }
00382     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00383     {
00384         std::string str;
00385         str += "File system exception thrown (";
00386         //str += e.who();
00387         //str += ", ";
00388         str += e.what();
00389         str += ")\n";
00390         Base::Console().Error(str.c_str());
00391         PyErr_SetString(PyExc_Exception,str.c_str());
00392         return NULL;
00393     }
00394     catch(const Py::Exception&)
00395     {
00396         // The exception text is already set
00397         return NULL;
00398     }
00399     catch(const char* e) // catch simple string exceptions
00400     {
00401         Base::Console().Error(e);
00402         PyErr_SetString(PyExc_Exception,e);
00403         return NULL;
00404     }
00405     // in debug not all exceptions will be catched to get the attention of the developer!
00406 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00407     catch(const std::exception& e) // catch other c++ exceptions
00408     {
00409         std::string str;
00410         str += "FC++ exception thrown (";
00411         str += e.what();
00412         str += ")";
00413         Base::Console().Error(str.c_str());
00414         PyErr_SetString(PyExc_Exception,str.c_str());
00415         return NULL;
00416     }
00417     catch(...)  // catch the rest!
00418     {
00419         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00420         return NULL;
00421     }
00422 #endif
00423 }
00424 
00425 // getIntersectionPoint() callback and implementer
00426 // PyObject*  BoundBoxPy::getIntersectionPoint(PyObject *args){};
00427 // has to be implemented in BoundBoxPyImp.cpp
00428 PyObject * BoundBoxPy::staticCallback_getIntersectionPoint (PyObject *self, PyObject *args)
00429 {
00430     // test if twin object not allready deleted
00431     if (!((PyObjectBase*) self)->isValid()){
00432         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00433         return NULL;
00434     }
00435 
00436     // test if object is set Const
00437     if (((PyObjectBase*) self)->isConst()){
00438         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00439         return NULL;
00440     }
00441 
00442     try { // catches all exceptions coming up from c++ and generate a python exception
00443         PyObject* ret = ((BoundBoxPy*)self)->getIntersectionPoint(args);
00444         if (ret != 0)
00445             ((BoundBoxPy*)self)->startNotify();
00446         return ret;
00447     }
00448     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00449     {
00450         std::string str;
00451         str += "FreeCAD exception thrown (";
00452         str += e.what();
00453         str += ")";
00454         e.ReportException();
00455         PyErr_SetString(PyExc_Exception,str.c_str());
00456         return NULL;
00457     }
00458     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00459     {
00460         std::string str;
00461         str += "File system exception thrown (";
00462         //str += e.who();
00463         //str += ", ";
00464         str += e.what();
00465         str += ")\n";
00466         Base::Console().Error(str.c_str());
00467         PyErr_SetString(PyExc_Exception,str.c_str());
00468         return NULL;
00469     }
00470     catch(const Py::Exception&)
00471     {
00472         // The exception text is already set
00473         return NULL;
00474     }
00475     catch(const char* e) // catch simple string exceptions
00476     {
00477         Base::Console().Error(e);
00478         PyErr_SetString(PyExc_Exception,e);
00479         return NULL;
00480     }
00481     // in debug not all exceptions will be catched to get the attention of the developer!
00482 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00483     catch(const std::exception& e) // catch other c++ exceptions
00484     {
00485         std::string str;
00486         str += "FC++ exception thrown (";
00487         str += e.what();
00488         str += ")";
00489         Base::Console().Error(str.c_str());
00490         PyErr_SetString(PyExc_Exception,str.c_str());
00491         return NULL;
00492     }
00493     catch(...)  // catch the rest!
00494     {
00495         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00496         return NULL;
00497     }
00498 #endif
00499 }
00500 
00501 // move() callback and implementer
00502 // PyObject*  BoundBoxPy::move(PyObject *args){};
00503 // has to be implemented in BoundBoxPyImp.cpp
00504 PyObject * BoundBoxPy::staticCallback_move (PyObject *self, PyObject *args)
00505 {
00506     // test if twin object not allready deleted
00507     if (!((PyObjectBase*) self)->isValid()){
00508         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00509         return NULL;
00510     }
00511 
00512     // test if object is set Const
00513     if (((PyObjectBase*) self)->isConst()){
00514         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00515         return NULL;
00516     }
00517 
00518     try { // catches all exceptions coming up from c++ and generate a python exception
00519         PyObject* ret = ((BoundBoxPy*)self)->move(args);
00520         if (ret != 0)
00521             ((BoundBoxPy*)self)->startNotify();
00522         return ret;
00523     }
00524     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00525     {
00526         std::string str;
00527         str += "FreeCAD exception thrown (";
00528         str += e.what();
00529         str += ")";
00530         e.ReportException();
00531         PyErr_SetString(PyExc_Exception,str.c_str());
00532         return NULL;
00533     }
00534     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00535     {
00536         std::string str;
00537         str += "File system exception thrown (";
00538         //str += e.who();
00539         //str += ", ";
00540         str += e.what();
00541         str += ")\n";
00542         Base::Console().Error(str.c_str());
00543         PyErr_SetString(PyExc_Exception,str.c_str());
00544         return NULL;
00545     }
00546     catch(const Py::Exception&)
00547     {
00548         // The exception text is already set
00549         return NULL;
00550     }
00551     catch(const char* e) // catch simple string exceptions
00552     {
00553         Base::Console().Error(e);
00554         PyErr_SetString(PyExc_Exception,e);
00555         return NULL;
00556     }
00557     // in debug not all exceptions will be catched to get the attention of the developer!
00558 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00559     catch(const std::exception& e) // catch other c++ exceptions
00560     {
00561         std::string str;
00562         str += "FC++ exception thrown (";
00563         str += e.what();
00564         str += ")";
00565         Base::Console().Error(str.c_str());
00566         PyErr_SetString(PyExc_Exception,str.c_str());
00567         return NULL;
00568     }
00569     catch(...)  // catch the rest!
00570     {
00571         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00572         return NULL;
00573     }
00574 #endif
00575 }
00576 
00577 // isCutPlane() callback and implementer
00578 // PyObject*  BoundBoxPy::isCutPlane(PyObject *args){};
00579 // has to be implemented in BoundBoxPyImp.cpp
00580 PyObject * BoundBoxPy::staticCallback_isCutPlane (PyObject *self, PyObject *args)
00581 {
00582     // test if twin object not allready deleted
00583     if (!((PyObjectBase*) self)->isValid()){
00584         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00585         return NULL;
00586     }
00587 
00588     // test if object is set Const
00589     if (((PyObjectBase*) self)->isConst()){
00590         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00591         return NULL;
00592     }
00593 
00594     try { // catches all exceptions coming up from c++ and generate a python exception
00595         PyObject* ret = ((BoundBoxPy*)self)->isCutPlane(args);
00596         if (ret != 0)
00597             ((BoundBoxPy*)self)->startNotify();
00598         return ret;
00599     }
00600     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00601     {
00602         std::string str;
00603         str += "FreeCAD exception thrown (";
00604         str += e.what();
00605         str += ")";
00606         e.ReportException();
00607         PyErr_SetString(PyExc_Exception,str.c_str());
00608         return NULL;
00609     }
00610     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00611     {
00612         std::string str;
00613         str += "File system exception thrown (";
00614         //str += e.who();
00615         //str += ", ";
00616         str += e.what();
00617         str += ")\n";
00618         Base::Console().Error(str.c_str());
00619         PyErr_SetString(PyExc_Exception,str.c_str());
00620         return NULL;
00621     }
00622     catch(const Py::Exception&)
00623     {
00624         // The exception text is already set
00625         return NULL;
00626     }
00627     catch(const char* e) // catch simple string exceptions
00628     {
00629         Base::Console().Error(e);
00630         PyErr_SetString(PyExc_Exception,e);
00631         return NULL;
00632     }
00633     // in debug not all exceptions will be catched to get the attention of the developer!
00634 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00635     catch(const std::exception& e) // catch other c++ exceptions
00636     {
00637         std::string str;
00638         str += "FC++ exception thrown (";
00639         str += e.what();
00640         str += ")";
00641         Base::Console().Error(str.c_str());
00642         PyErr_SetString(PyExc_Exception,str.c_str());
00643         return NULL;
00644     }
00645     catch(...)  // catch the rest!
00646     {
00647         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00648         return NULL;
00649     }
00650 #endif
00651 }
00652 
00653 // isInside() callback and implementer
00654 // PyObject*  BoundBoxPy::isInside(PyObject *args){};
00655 // has to be implemented in BoundBoxPyImp.cpp
00656 PyObject * BoundBoxPy::staticCallback_isInside (PyObject *self, PyObject *args)
00657 {
00658     // test if twin object not allready deleted
00659     if (!((PyObjectBase*) self)->isValid()){
00660         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00661         return NULL;
00662     }
00663 
00664     // test if object is set Const
00665     if (((PyObjectBase*) self)->isConst()){
00666         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00667         return NULL;
00668     }
00669 
00670     try { // catches all exceptions coming up from c++ and generate a python exception
00671         PyObject* ret = ((BoundBoxPy*)self)->isInside(args);
00672         if (ret != 0)
00673             ((BoundBoxPy*)self)->startNotify();
00674         return ret;
00675     }
00676     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00677     {
00678         std::string str;
00679         str += "FreeCAD exception thrown (";
00680         str += e.what();
00681         str += ")";
00682         e.ReportException();
00683         PyErr_SetString(PyExc_Exception,str.c_str());
00684         return NULL;
00685     }
00686     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00687     {
00688         std::string str;
00689         str += "File system exception thrown (";
00690         //str += e.who();
00691         //str += ", ";
00692         str += e.what();
00693         str += ")\n";
00694         Base::Console().Error(str.c_str());
00695         PyErr_SetString(PyExc_Exception,str.c_str());
00696         return NULL;
00697     }
00698     catch(const Py::Exception&)
00699     {
00700         // The exception text is already set
00701         return NULL;
00702     }
00703     catch(const char* e) // catch simple string exceptions
00704     {
00705         Base::Console().Error(e);
00706         PyErr_SetString(PyExc_Exception,e);
00707         return NULL;
00708     }
00709     // in debug not all exceptions will be catched to get the attention of the developer!
00710 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00711     catch(const std::exception& e) // catch other c++ exceptions
00712     {
00713         std::string str;
00714         str += "FC++ exception thrown (";
00715         str += e.what();
00716         str += ")";
00717         Base::Console().Error(str.c_str());
00718         PyErr_SetString(PyExc_Exception,str.c_str());
00719         return NULL;
00720     }
00721     catch(...)  // catch the rest!
00722     {
00723         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00724         return NULL;
00725     }
00726 #endif
00727 }
00728 
00729 // Center() callback and implementer
00730 // PyObject*  BoundBoxPy::Center(PyObject *args){};
00731 // has to be implemented in BoundBoxPyImp.cpp
00732 PyObject * BoundBoxPy::staticCallback_getCenter (PyObject *self, void * /*closure*/)
00733 {
00734     if (!((PyObjectBase*) self)->isValid()){
00735         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00736         return NULL;
00737     }
00738 
00739     try {
00740         return Py::new_reference_to(((BoundBoxPy*)self)->getCenter());
00741     } catch (const Py::Exception&) {
00742         // The exception text is already set
00743         return NULL;
00744     } catch (...) {
00745         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'Center' of object 'BoundBox'");
00746         return NULL;
00747     }
00748 }
00749 
00750 int BoundBoxPy::staticCallback_setCenter (PyObject *self, PyObject * /*value*/, void * /*closure*/)
00751 {
00752     if (!((PyObjectBase*) self)->isValid()){
00753         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00754         return -1;
00755     }
00756 
00757     PyErr_SetString(PyExc_AttributeError, "Attribute 'Center' of object 'BoundBox' is read-only");
00758     return -1;
00759 }
00760 
00761 // XMax() callback and implementer
00762 // PyObject*  BoundBoxPy::XMax(PyObject *args){};
00763 // has to be implemented in BoundBoxPyImp.cpp
00764 PyObject * BoundBoxPy::staticCallback_getXMax (PyObject *self, void * /*closure*/)
00765 {
00766     if (!((PyObjectBase*) self)->isValid()){
00767         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00768         return NULL;
00769     }
00770 
00771     try {
00772         return Py::new_reference_to(((BoundBoxPy*)self)->getXMax());
00773     } catch (const Py::Exception&) {
00774         // The exception text is already set
00775         return NULL;
00776     } catch (...) {
00777         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'XMax' of object 'BoundBox'");
00778         return NULL;
00779     }
00780 }
00781 
00782 int BoundBoxPy::staticCallback_setXMax (PyObject *self, PyObject *value, void * /*closure*/)
00783 {    
00784     if (!((PyObjectBase*) self)->isValid()){
00785         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00786         return -1;
00787     }
00788     if (((PyObjectBase*) self)->isConst()){
00789         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
00790         return -1;
00791     }
00792 
00793     try {
00794         ((BoundBoxPy*)self)->setXMax(Py::Float(value,false));
00795         return 0;
00796     } catch (const Py::Exception&) {
00797         // The exception text is already set
00798         return -1;
00799     } catch (...) {
00800         PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'XMax' of object 'BoundBox'");
00801         return -1;
00802     }
00803 }
00804 
00805 // YMax() callback and implementer
00806 // PyObject*  BoundBoxPy::YMax(PyObject *args){};
00807 // has to be implemented in BoundBoxPyImp.cpp
00808 PyObject * BoundBoxPy::staticCallback_getYMax (PyObject *self, void * /*closure*/)
00809 {
00810     if (!((PyObjectBase*) self)->isValid()){
00811         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00812         return NULL;
00813     }
00814 
00815     try {
00816         return Py::new_reference_to(((BoundBoxPy*)self)->getYMax());
00817     } catch (const Py::Exception&) {
00818         // The exception text is already set
00819         return NULL;
00820     } catch (...) {
00821         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'YMax' of object 'BoundBox'");
00822         return NULL;
00823     }
00824 }
00825 
00826 int BoundBoxPy::staticCallback_setYMax (PyObject *self, PyObject *value, void * /*closure*/)
00827 {    
00828     if (!((PyObjectBase*) self)->isValid()){
00829         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00830         return -1;
00831     }
00832     if (((PyObjectBase*) self)->isConst()){
00833         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
00834         return -1;
00835     }
00836 
00837     try {
00838         ((BoundBoxPy*)self)->setYMax(Py::Float(value,false));
00839         return 0;
00840     } catch (const Py::Exception&) {
00841         // The exception text is already set
00842         return -1;
00843     } catch (...) {
00844         PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'YMax' of object 'BoundBox'");
00845         return -1;
00846     }
00847 }
00848 
00849 // ZMax() callback and implementer
00850 // PyObject*  BoundBoxPy::ZMax(PyObject *args){};
00851 // has to be implemented in BoundBoxPyImp.cpp
00852 PyObject * BoundBoxPy::staticCallback_getZMax (PyObject *self, void * /*closure*/)
00853 {
00854     if (!((PyObjectBase*) self)->isValid()){
00855         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00856         return NULL;
00857     }
00858 
00859     try {
00860         return Py::new_reference_to(((BoundBoxPy*)self)->getZMax());
00861     } catch (const Py::Exception&) {
00862         // The exception text is already set
00863         return NULL;
00864     } catch (...) {
00865         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'ZMax' of object 'BoundBox'");
00866         return NULL;
00867     }
00868 }
00869 
00870 int BoundBoxPy::staticCallback_setZMax (PyObject *self, PyObject *value, void * /*closure*/)
00871 {    
00872     if (!((PyObjectBase*) self)->isValid()){
00873         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00874         return -1;
00875     }
00876     if (((PyObjectBase*) self)->isConst()){
00877         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
00878         return -1;
00879     }
00880 
00881     try {
00882         ((BoundBoxPy*)self)->setZMax(Py::Float(value,false));
00883         return 0;
00884     } catch (const Py::Exception&) {
00885         // The exception text is already set
00886         return -1;
00887     } catch (...) {
00888         PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'ZMax' of object 'BoundBox'");
00889         return -1;
00890     }
00891 }
00892 
00893 // XMin() callback and implementer
00894 // PyObject*  BoundBoxPy::XMin(PyObject *args){};
00895 // has to be implemented in BoundBoxPyImp.cpp
00896 PyObject * BoundBoxPy::staticCallback_getXMin (PyObject *self, void * /*closure*/)
00897 {
00898     if (!((PyObjectBase*) self)->isValid()){
00899         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00900         return NULL;
00901     }
00902 
00903     try {
00904         return Py::new_reference_to(((BoundBoxPy*)self)->getXMin());
00905     } catch (const Py::Exception&) {
00906         // The exception text is already set
00907         return NULL;
00908     } catch (...) {
00909         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'XMin' of object 'BoundBox'");
00910         return NULL;
00911     }
00912 }
00913 
00914 int BoundBoxPy::staticCallback_setXMin (PyObject *self, PyObject *value, void * /*closure*/)
00915 {    
00916     if (!((PyObjectBase*) self)->isValid()){
00917         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00918         return -1;
00919     }
00920     if (((PyObjectBase*) self)->isConst()){
00921         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
00922         return -1;
00923     }
00924 
00925     try {
00926         ((BoundBoxPy*)self)->setXMin(Py::Float(value,false));
00927         return 0;
00928     } catch (const Py::Exception&) {
00929         // The exception text is already set
00930         return -1;
00931     } catch (...) {
00932         PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'XMin' of object 'BoundBox'");
00933         return -1;
00934     }
00935 }
00936 
00937 // YMin() callback and implementer
00938 // PyObject*  BoundBoxPy::YMin(PyObject *args){};
00939 // has to be implemented in BoundBoxPyImp.cpp
00940 PyObject * BoundBoxPy::staticCallback_getYMin (PyObject *self, void * /*closure*/)
00941 {
00942     if (!((PyObjectBase*) self)->isValid()){
00943         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00944         return NULL;
00945     }
00946 
00947     try {
00948         return Py::new_reference_to(((BoundBoxPy*)self)->getYMin());
00949     } catch (const Py::Exception&) {
00950         // The exception text is already set
00951         return NULL;
00952     } catch (...) {
00953         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'YMin' of object 'BoundBox'");
00954         return NULL;
00955     }
00956 }
00957 
00958 int BoundBoxPy::staticCallback_setYMin (PyObject *self, PyObject *value, void * /*closure*/)
00959 {    
00960     if (!((PyObjectBase*) self)->isValid()){
00961         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00962         return -1;
00963     }
00964     if (((PyObjectBase*) self)->isConst()){
00965         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
00966         return -1;
00967     }
00968 
00969     try {
00970         ((BoundBoxPy*)self)->setYMin(Py::Float(value,false));
00971         return 0;
00972     } catch (const Py::Exception&) {
00973         // The exception text is already set
00974         return -1;
00975     } catch (...) {
00976         PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'YMin' of object 'BoundBox'");
00977         return -1;
00978     }
00979 }
00980 
00981 // ZMin() callback and implementer
00982 // PyObject*  BoundBoxPy::ZMin(PyObject *args){};
00983 // has to be implemented in BoundBoxPyImp.cpp
00984 PyObject * BoundBoxPy::staticCallback_getZMin (PyObject *self, void * /*closure*/)
00985 {
00986     if (!((PyObjectBase*) self)->isValid()){
00987         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00988         return NULL;
00989     }
00990 
00991     try {
00992         return Py::new_reference_to(((BoundBoxPy*)self)->getZMin());
00993     } catch (const Py::Exception&) {
00994         // The exception text is already set
00995         return NULL;
00996     } catch (...) {
00997         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'ZMin' of object 'BoundBox'");
00998         return NULL;
00999     }
01000 }
01001 
01002 int BoundBoxPy::staticCallback_setZMin (PyObject *self, PyObject *value, void * /*closure*/)
01003 {    
01004     if (!((PyObjectBase*) self)->isValid()){
01005         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01006         return -1;
01007     }
01008     if (((PyObjectBase*) self)->isConst()){
01009         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
01010         return -1;
01011     }
01012 
01013     try {
01014         ((BoundBoxPy*)self)->setZMin(Py::Float(value,false));
01015         return 0;
01016     } catch (const Py::Exception&) {
01017         // The exception text is already set
01018         return -1;
01019     } catch (...) {
01020         PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'ZMin' of object 'BoundBox'");
01021         return -1;
01022     }
01023 }
01024 
01025 // XLength() callback and implementer
01026 // PyObject*  BoundBoxPy::XLength(PyObject *args){};
01027 // has to be implemented in BoundBoxPyImp.cpp
01028 PyObject * BoundBoxPy::staticCallback_getXLength (PyObject *self, void * /*closure*/)
01029 {
01030     if (!((PyObjectBase*) self)->isValid()){
01031         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01032         return NULL;
01033     }
01034 
01035     try {
01036         return Py::new_reference_to(((BoundBoxPy*)self)->getXLength());
01037     } catch (const Py::Exception&) {
01038         // The exception text is already set
01039         return NULL;
01040     } catch (...) {
01041         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'XLength' of object 'BoundBox'");
01042         return NULL;
01043     }
01044 }
01045 
01046 int BoundBoxPy::staticCallback_setXLength (PyObject *self, PyObject * /*value*/, void * /*closure*/)
01047 {
01048     if (!((PyObjectBase*) self)->isValid()){
01049         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01050         return -1;
01051     }
01052 
01053     PyErr_SetString(PyExc_AttributeError, "Attribute 'XLength' of object 'BoundBox' is read-only");
01054     return -1;
01055 }
01056 
01057 // YLength() callback and implementer
01058 // PyObject*  BoundBoxPy::YLength(PyObject *args){};
01059 // has to be implemented in BoundBoxPyImp.cpp
01060 PyObject * BoundBoxPy::staticCallback_getYLength (PyObject *self, void * /*closure*/)
01061 {
01062     if (!((PyObjectBase*) self)->isValid()){
01063         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01064         return NULL;
01065     }
01066 
01067     try {
01068         return Py::new_reference_to(((BoundBoxPy*)self)->getYLength());
01069     } catch (const Py::Exception&) {
01070         // The exception text is already set
01071         return NULL;
01072     } catch (...) {
01073         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'YLength' of object 'BoundBox'");
01074         return NULL;
01075     }
01076 }
01077 
01078 int BoundBoxPy::staticCallback_setYLength (PyObject *self, PyObject * /*value*/, void * /*closure*/)
01079 {
01080     if (!((PyObjectBase*) self)->isValid()){
01081         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01082         return -1;
01083     }
01084 
01085     PyErr_SetString(PyExc_AttributeError, "Attribute 'YLength' of object 'BoundBox' is read-only");
01086     return -1;
01087 }
01088 
01089 // ZLength() callback and implementer
01090 // PyObject*  BoundBoxPy::ZLength(PyObject *args){};
01091 // has to be implemented in BoundBoxPyImp.cpp
01092 PyObject * BoundBoxPy::staticCallback_getZLength (PyObject *self, void * /*closure*/)
01093 {
01094     if (!((PyObjectBase*) self)->isValid()){
01095         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01096         return NULL;
01097     }
01098 
01099     try {
01100         return Py::new_reference_to(((BoundBoxPy*)self)->getZLength());
01101     } catch (const Py::Exception&) {
01102         // The exception text is already set
01103         return NULL;
01104     } catch (...) {
01105         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'ZLength' of object 'BoundBox'");
01106         return NULL;
01107     }
01108 }
01109 
01110 int BoundBoxPy::staticCallback_setZLength (PyObject *self, PyObject * /*value*/, void * /*closure*/)
01111 {
01112     if (!((PyObjectBase*) self)->isValid()){
01113         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01114         return -1;
01115     }
01116 
01117     PyErr_SetString(PyExc_AttributeError, "Attribute 'ZLength' of object 'BoundBox' is read-only");
01118     return -1;
01119 }
01120 
01121 // DiagonalLength() callback and implementer
01122 // PyObject*  BoundBoxPy::DiagonalLength(PyObject *args){};
01123 // has to be implemented in BoundBoxPyImp.cpp
01124 PyObject * BoundBoxPy::staticCallback_getDiagonalLength (PyObject *self, void * /*closure*/)
01125 {
01126     if (!((PyObjectBase*) self)->isValid()){
01127         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01128         return NULL;
01129     }
01130 
01131     try {
01132         return Py::new_reference_to(((BoundBoxPy*)self)->getDiagonalLength());
01133     } catch (const Py::Exception&) {
01134         // The exception text is already set
01135         return NULL;
01136     } catch (...) {
01137         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'DiagonalLength' of object 'BoundBox'");
01138         return NULL;
01139     }
01140 }
01141 
01142 int BoundBoxPy::staticCallback_setDiagonalLength (PyObject *self, PyObject * /*value*/, void * /*closure*/)
01143 {
01144     if (!((PyObjectBase*) self)->isValid()){
01145         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01146         return -1;
01147     }
01148 
01149     PyErr_SetString(PyExc_AttributeError, "Attribute 'DiagonalLength' of object 'BoundBox' is read-only");
01150     return -1;
01151 }
01152 
01153 
01154 
01155 //--------------------------------------------------------------------------
01156 // Parents structure
01157 //--------------------------------------------------------------------------
01158 PyParentObject BoundBoxPy::Parents[] = { PARENTSBaseBoundBoxPy };
01159 
01160 //--------------------------------------------------------------------------
01161 // Constructor
01162 //--------------------------------------------------------------------------
01163 BoundBoxPy::BoundBoxPy(BoundBox3d *pcObject, PyTypeObject *T)
01164     : PyObjectBase(reinterpret_cast<PyObjectBase::PointerType>(pcObject), T)
01165 {
01166 }
01167 
01168 
01169 //--------------------------------------------------------------------------
01170 // destructor
01171 //--------------------------------------------------------------------------
01172 BoundBoxPy::~BoundBoxPy()                                // Everything handled in parent
01173 {
01174     // delete the handled object when the PyObject dies
01175     BoundBoxPy::PointerType ptr = reinterpret_cast<BoundBoxPy::PointerType>(_pcTwinPointer);
01176     delete ptr;
01177 }
01178 
01179 //--------------------------------------------------------------------------
01180 // BoundBoxPy representation
01181 //--------------------------------------------------------------------------
01182 PyObject *BoundBoxPy::_repr(void)
01183 {
01184     return Py_BuildValue("s", representation().c_str());
01185 }
01186 
01187 //--------------------------------------------------------------------------
01188 // BoundBoxPy Attributes
01189 //--------------------------------------------------------------------------
01190 PyObject *BoundBoxPy::_getattr(char *attr)                              // __getattr__ function: note only need to handle new state
01191 {
01192     try {
01193         // getter method for special Attributes (e.g. dynamic ones)
01194         PyObject *r = getCustomAttributes(attr);
01195         if(r) return r;
01196     }
01197 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01198     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01199     {
01200         std::string str;
01201         str += "FreeCAD exception thrown (";
01202         str += e.what();
01203         str += ")";
01204         e.ReportException();
01205         PyErr_SetString(PyExc_Exception,str.c_str());
01206         return NULL;
01207     }
01208     catch(const std::exception& e) // catch other c++ exceptions
01209     {
01210         std::string str;
01211         str += "FC++ exception thrown (";
01212         str += e.what();
01213         str += ")";
01214         Base::Console().Error(str.c_str());
01215         PyErr_SetString(PyExc_Exception,str.c_str());
01216         return NULL;
01217     }
01218     catch(const Py::Exception&)
01219     {
01220         // The exception text is already set
01221         return NULL;
01222     }
01223     catch(...)  // catch the rest!
01224     {
01225         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01226         return NULL;
01227     }
01228 #else  // DONT_CATCH_CXX_EXCEPTIONS  
01229     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01230     {
01231         std::string str;
01232         str += "FreeCAD exception thrown (";
01233         str += e.what();
01234         str += ")";
01235         e.ReportException();
01236         PyErr_SetString(PyExc_Exception,str.c_str());
01237         return NULL;
01238     }
01239     catch(const Py::Exception&)
01240     {
01241         // The exception text is already set
01242         return NULL;
01243     }
01244 #endif  // DONT_CATCH_CXX_EXCEPTIONS
01245 
01246     PyObject *rvalue = Py_FindMethod(Methods, this, attr);
01247     if (rvalue == NULL)
01248     {
01249         PyErr_Clear();
01250         return PyObjectBase::_getattr(attr);
01251     }
01252     else
01253     {
01254         return rvalue;
01255     }
01256 }
01257 
01258 int BoundBoxPy::_setattr(char *attr, PyObject *value)   // __setattr__ function: note only need to handle new state
01259 {
01260     try {
01261         // setter for  special Attributes (e.g. dynamic ones)
01262         int r = setCustomAttributes(attr, value);
01263         if(r==1) return 0;
01264     }
01265 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01266     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01267     {
01268         std::string str;
01269         str += "FreeCAD exception thrown (";
01270         str += e.what();
01271         str += ")";
01272         e.ReportException();
01273         PyErr_SetString(PyExc_Exception,str.c_str());
01274         return -1;
01275     }
01276     catch(const std::exception& e) // catch other c++ exceptions
01277     {
01278         std::string str;
01279         str += "FC++ exception thrown (";
01280         str += e.what();
01281         str += ")";
01282         Base::Console().Error(str.c_str());
01283         PyErr_SetString(PyExc_Exception,str.c_str());
01284         return -1;
01285     }
01286     catch(const Py::Exception&)
01287     {
01288         // The exception text is already set
01289         return -1;
01290     }
01291     catch(...)  // catch the rest!
01292     {
01293         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01294         return -1;
01295     }
01296 #else  // DONT_CATCH_CXX_EXCEPTIONS  
01297     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01298     {
01299         std::string str;
01300         str += "FreeCAD exception thrown (";
01301         str += e.what();
01302         str += ")";
01303         e.ReportException();
01304         PyErr_SetString(PyExc_Exception,str.c_str());
01305         return -1;
01306     }
01307     catch(const Py::Exception&)
01308     {
01309         // The exception text is already set
01310         return -1;
01311     }
01312 #endif  // DONT_CATCH_CXX_EXCEPTIONS
01313 
01314     return PyObjectBase::_setattr(attr, value);
01315 }
01316 
01317 BoundBox3d *BoundBoxPy::getBoundBoxPtr(void) const
01318 {
01319     return static_cast<BoundBox3d *>(_pcTwinPointer);
01320 }
01321 
01322 #if 0
01323 /* From here on come the methods you have to implement, but NOT in this module. Implement in BoundBoxPyImp.cpp! This prototypes 
01324  * are just for convenience when you add a new method.
01325  */
01326 
01327 PyObject *BoundBoxPy::PyMake(struct _typeobject *, PyObject *, PyObject *)  // Python wrapper
01328 {
01329     // create a new instance of BoundBoxPy and the Twin object 
01330     return new BoundBoxPy(new BoundBox3d);
01331 }
01332 
01333 // constructor method
01334 int BoundBoxPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
01335 {
01336     return 0;
01337 }
01338 
01339 // returns a string which represents the object e.g. when printed in python
01340 std::string BoundBoxPy::representation(void) const
01341 {
01342     return std::string("<BoundBox object>");
01343 }
01344 
01345 PyObject* BoundBoxPy::add(PyObject *args)
01346 {
01347     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01348     return 0;
01349 }
01350 
01351 PyObject* BoundBoxPy::isIntersection(PyObject *args)
01352 {
01353     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01354     return 0;
01355 }
01356 
01357 PyObject* BoundBoxPy::enlarge(PyObject *args)
01358 {
01359     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01360     return 0;
01361 }
01362 
01363 PyObject* BoundBoxPy::getIntersectionPoint(PyObject *args)
01364 {
01365     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01366     return 0;
01367 }
01368 
01369 PyObject* BoundBoxPy::move(PyObject *args)
01370 {
01371     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01372     return 0;
01373 }
01374 
01375 PyObject* BoundBoxPy::isCutPlane(PyObject *args)
01376 {
01377     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01378     return 0;
01379 }
01380 
01381 PyObject* BoundBoxPy::isInside(PyObject *args)
01382 {
01383     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01384     return 0;
01385 }
01386 
01387 
01388 
01389 Py::Object BoundBoxPy::getCenter(void) const
01390 {
01391     //return Py::Object();
01392     throw Py::AttributeError("Not yet implemented");
01393 }
01394 
01395 Py::Float BoundBoxPy::getXMax(void) const
01396 {
01397     //return Py::Float();
01398     throw Py::AttributeError("Not yet implemented");
01399 }
01400 
01401 void  BoundBoxPy::setXMax(Py::Float arg)
01402 {
01403     throw Py::AttributeError("Not yet implemented");
01404 }
01405 
01406 Py::Float BoundBoxPy::getYMax(void) const
01407 {
01408     //return Py::Float();
01409     throw Py::AttributeError("Not yet implemented");
01410 }
01411 
01412 void  BoundBoxPy::setYMax(Py::Float arg)
01413 {
01414     throw Py::AttributeError("Not yet implemented");
01415 }
01416 
01417 Py::Float BoundBoxPy::getZMax(void) const
01418 {
01419     //return Py::Float();
01420     throw Py::AttributeError("Not yet implemented");
01421 }
01422 
01423 void  BoundBoxPy::setZMax(Py::Float arg)
01424 {
01425     throw Py::AttributeError("Not yet implemented");
01426 }
01427 
01428 Py::Float BoundBoxPy::getXMin(void) const
01429 {
01430     //return Py::Float();
01431     throw Py::AttributeError("Not yet implemented");
01432 }
01433 
01434 void  BoundBoxPy::setXMin(Py::Float arg)
01435 {
01436     throw Py::AttributeError("Not yet implemented");
01437 }
01438 
01439 Py::Float BoundBoxPy::getYMin(void) const
01440 {
01441     //return Py::Float();
01442     throw Py::AttributeError("Not yet implemented");
01443 }
01444 
01445 void  BoundBoxPy::setYMin(Py::Float arg)
01446 {
01447     throw Py::AttributeError("Not yet implemented");
01448 }
01449 
01450 Py::Float BoundBoxPy::getZMin(void) const
01451 {
01452     //return Py::Float();
01453     throw Py::AttributeError("Not yet implemented");
01454 }
01455 
01456 void  BoundBoxPy::setZMin(Py::Float arg)
01457 {
01458     throw Py::AttributeError("Not yet implemented");
01459 }
01460 
01461 Py::Float BoundBoxPy::getXLength(void) const
01462 {
01463     //return Py::Float();
01464     throw Py::AttributeError("Not yet implemented");
01465 }
01466 
01467 Py::Float BoundBoxPy::getYLength(void) const
01468 {
01469     //return Py::Float();
01470     throw Py::AttributeError("Not yet implemented");
01471 }
01472 
01473 Py::Float BoundBoxPy::getZLength(void) const
01474 {
01475     //return Py::Float();
01476     throw Py::AttributeError("Not yet implemented");
01477 }
01478 
01479 Py::Float BoundBoxPy::getDiagonalLength(void) const
01480 {
01481     //return Py::Float();
01482     throw Py::AttributeError("Not yet implemented");
01483 }
01484 
01485 PyObject *BoundBoxPy::getCustomAttributes(const char* attr) const
01486 {
01487     return 0;
01488 }
01489 
01490 int BoundBoxPy::setCustomAttributes(const char* attr, PyObject *obj)
01491 {
01492     return 0; 
01493 }
01494 #endif
01495 
01496 
01497 

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