00001
00002
00003
00004
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,
00023 "Base.BoundBox",
00024 sizeof(BoundBoxPy),
00025 0,
00026
00027 PyDestructor,
00028 0,
00029 __getattr,
00030 __setattr,
00031 0,
00032 __repr,
00033 0,
00034 0,
00035 0,
00036 0,
00037 0,
00038 0,
00039 0,
00040 0,
00041
00042 0,
00043
00044 Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_CLASS,
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 " ",
00057 0,
00058 0,
00059 0,
00060 0,
00061 0,
00062 0,
00063 Base::BoundBoxPy::Methods,
00064 0,
00065 Base::BoundBoxPy::GetterSetter,
00066 &Base::PyObjectBase::Type,
00067 0,
00068 0,
00069 0,
00070 0,
00071 __PyInit,
00072 0,
00073 Base::BoundBoxPy::PyMake,
00074 0,
00075 0,
00076 0,
00077 0,
00078 0,
00079 0,
00080 0,
00081 0
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}
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}
00195 };
00196
00197
00198
00199
00200 PyObject * BoundBoxPy::staticCallback_add (PyObject *self, PyObject *args)
00201 {
00202
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
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 {
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)
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)
00231 {
00232 std::string str;
00233 str += "File system exception thrown (";
00234
00235
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
00245 return NULL;
00246 }
00247 catch(const char* e)
00248 {
00249 Base::Console().Error(e);
00250 PyErr_SetString(PyExc_Exception,e);
00251 return NULL;
00252 }
00253
00254 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00255 catch(const std::exception& e)
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(...)
00266 {
00267 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00268 return NULL;
00269 }
00270 #endif
00271 }
00272
00273
00274
00275
00276 PyObject * BoundBoxPy::staticCallback_isIntersection (PyObject *self, PyObject *args)
00277 {
00278
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
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 {
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)
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)
00307 {
00308 std::string str;
00309 str += "File system exception thrown (";
00310
00311
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
00321 return NULL;
00322 }
00323 catch(const char* e)
00324 {
00325 Base::Console().Error(e);
00326 PyErr_SetString(PyExc_Exception,e);
00327 return NULL;
00328 }
00329
00330 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00331 catch(const std::exception& e)
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(...)
00342 {
00343 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00344 return NULL;
00345 }
00346 #endif
00347 }
00348
00349
00350
00351
00352 PyObject * BoundBoxPy::staticCallback_enlarge (PyObject *self, PyObject *args)
00353 {
00354
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
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 {
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)
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)
00383 {
00384 std::string str;
00385 str += "File system exception thrown (";
00386
00387
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
00397 return NULL;
00398 }
00399 catch(const char* e)
00400 {
00401 Base::Console().Error(e);
00402 PyErr_SetString(PyExc_Exception,e);
00403 return NULL;
00404 }
00405
00406 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00407 catch(const std::exception& e)
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(...)
00418 {
00419 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00420 return NULL;
00421 }
00422 #endif
00423 }
00424
00425
00426
00427
00428 PyObject * BoundBoxPy::staticCallback_getIntersectionPoint (PyObject *self, PyObject *args)
00429 {
00430
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
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 {
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)
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)
00459 {
00460 std::string str;
00461 str += "File system exception thrown (";
00462
00463
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
00473 return NULL;
00474 }
00475 catch(const char* e)
00476 {
00477 Base::Console().Error(e);
00478 PyErr_SetString(PyExc_Exception,e);
00479 return NULL;
00480 }
00481
00482 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00483 catch(const std::exception& e)
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(...)
00494 {
00495 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00496 return NULL;
00497 }
00498 #endif
00499 }
00500
00501
00502
00503
00504 PyObject * BoundBoxPy::staticCallback_move (PyObject *self, PyObject *args)
00505 {
00506
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
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 {
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)
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)
00535 {
00536 std::string str;
00537 str += "File system exception thrown (";
00538
00539
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
00549 return NULL;
00550 }
00551 catch(const char* e)
00552 {
00553 Base::Console().Error(e);
00554 PyErr_SetString(PyExc_Exception,e);
00555 return NULL;
00556 }
00557
00558 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00559 catch(const std::exception& e)
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(...)
00570 {
00571 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00572 return NULL;
00573 }
00574 #endif
00575 }
00576
00577
00578
00579
00580 PyObject * BoundBoxPy::staticCallback_isCutPlane (PyObject *self, PyObject *args)
00581 {
00582
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
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 {
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)
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)
00611 {
00612 std::string str;
00613 str += "File system exception thrown (";
00614
00615
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
00625 return NULL;
00626 }
00627 catch(const char* e)
00628 {
00629 Base::Console().Error(e);
00630 PyErr_SetString(PyExc_Exception,e);
00631 return NULL;
00632 }
00633
00634 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00635 catch(const std::exception& e)
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(...)
00646 {
00647 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00648 return NULL;
00649 }
00650 #endif
00651 }
00652
00653
00654
00655
00656 PyObject * BoundBoxPy::staticCallback_isInside (PyObject *self, PyObject *args)
00657 {
00658
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
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 {
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)
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)
00687 {
00688 std::string str;
00689 str += "File system exception thrown (";
00690
00691
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
00701 return NULL;
00702 }
00703 catch(const char* e)
00704 {
00705 Base::Console().Error(e);
00706 PyErr_SetString(PyExc_Exception,e);
00707 return NULL;
00708 }
00709
00710 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00711 catch(const std::exception& e)
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(...)
00722 {
00723 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00724 return NULL;
00725 }
00726 #endif
00727 }
00728
00729
00730
00731
00732 PyObject * BoundBoxPy::staticCallback_getCenter (PyObject *self, void * )
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
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 * , void * )
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
00762
00763
00764 PyObject * BoundBoxPy::staticCallback_getXMax (PyObject *self, void * )
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
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 * )
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
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
00806
00807
00808 PyObject * BoundBoxPy::staticCallback_getYMax (PyObject *self, void * )
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
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 * )
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
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
00850
00851
00852 PyObject * BoundBoxPy::staticCallback_getZMax (PyObject *self, void * )
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
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 * )
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
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
00894
00895
00896 PyObject * BoundBoxPy::staticCallback_getXMin (PyObject *self, void * )
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
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 * )
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
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
00938
00939
00940 PyObject * BoundBoxPy::staticCallback_getYMin (PyObject *self, void * )
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
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 * )
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
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
00982
00983
00984 PyObject * BoundBoxPy::staticCallback_getZMin (PyObject *self, void * )
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
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 * )
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
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
01026
01027
01028 PyObject * BoundBoxPy::staticCallback_getXLength (PyObject *self, void * )
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
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 * , void * )
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
01058
01059
01060 PyObject * BoundBoxPy::staticCallback_getYLength (PyObject *self, void * )
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
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 * , void * )
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
01090
01091
01092 PyObject * BoundBoxPy::staticCallback_getZLength (PyObject *self, void * )
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
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 * , void * )
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
01122
01123
01124 PyObject * BoundBoxPy::staticCallback_getDiagonalLength (PyObject *self, void * )
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
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 * , void * )
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
01157
01158 PyParentObject BoundBoxPy::Parents[] = { PARENTSBaseBoundBoxPy };
01159
01160
01161
01162
01163 BoundBoxPy::BoundBoxPy(BoundBox3d *pcObject, PyTypeObject *T)
01164 : PyObjectBase(reinterpret_cast<PyObjectBase::PointerType>(pcObject), T)
01165 {
01166 }
01167
01168
01169
01170
01171
01172 BoundBoxPy::~BoundBoxPy()
01173 {
01174
01175 BoundBoxPy::PointerType ptr = reinterpret_cast<BoundBoxPy::PointerType>(_pcTwinPointer);
01176 delete ptr;
01177 }
01178
01179
01180
01181
01182 PyObject *BoundBoxPy::_repr(void)
01183 {
01184 return Py_BuildValue("s", representation().c_str());
01185 }
01186
01187
01188
01189
01190 PyObject *BoundBoxPy::_getattr(char *attr)
01191 {
01192 try {
01193
01194 PyObject *r = getCustomAttributes(attr);
01195 if(r) return r;
01196 }
01197 #ifndef DONT_CATCH_CXX_EXCEPTIONS
01198 catch(const Base::Exception& e)
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)
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
01221 return NULL;
01222 }
01223 catch(...)
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)
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
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)
01259 {
01260 try {
01261
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)
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)
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
01289 return -1;
01290 }
01291 catch(...)
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)
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
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
01324
01325
01326
01327 PyObject *BoundBoxPy::PyMake(struct _typeobject *, PyObject *, PyObject *)
01328 {
01329
01330 return new BoundBoxPy(new BoundBox3d);
01331 }
01332
01333
01334 int BoundBoxPy::PyInit(PyObject* , PyObject* )
01335 {
01336 return 0;
01337 }
01338
01339
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
01392 throw Py::AttributeError("Not yet implemented");
01393 }
01394
01395 Py::Float BoundBoxPy::getXMax(void) const
01396 {
01397
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
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
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
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
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
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
01464 throw Py::AttributeError("Not yet implemented");
01465 }
01466
01467 Py::Float BoundBoxPy::getYLength(void) const
01468 {
01469
01470 throw Py::AttributeError("Not yet implemented");
01471 }
01472
01473 Py::Float BoundBoxPy::getZLength(void) const
01474 {
01475
01476 throw Py::AttributeError("Not yet implemented");
01477 }
01478
01479 Py::Float BoundBoxPy::getDiagonalLength(void) const
01480 {
01481
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