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 PlacementPy::Type = {
00021 PyObject_HEAD_INIT(&PyType_Type)
00022 0,
00023 "Base.Placement",
00024 sizeof(PlacementPy),
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 "Placement\n"
00046 "A placement defines an orientation (rotation) and a position (base) in 3D space.\n"
00047 "It is used when no scaling or other distortion is needed.\n"
00048 "\n"
00049 "The following constructors are supported:\n"
00050 "Placement() -- empty constructor\n"
00051 "Placement(Placement) -- copy constructor\n"
00052 "Placement(Matrix) -- 4D matrix consisting of rotation and translation\n"
00053 "Placement(Base, Rotation) -- define position and rotation\n"
00054 "Placement(Base, Rotation,Center) -- define position and rotation with center\n"
00055 "Placement(Base, Axis, Angle) -- define position and rotation\n"
00056 " ",
00057 0,
00058 0,
00059 0,
00060 0,
00061 0,
00062 0,
00063 Base::PlacementPy::Methods,
00064 0,
00065 Base::PlacementPy::GetterSetter,
00066 &Base::PyObjectBase::Type,
00067 0,
00068 0,
00069 0,
00070 0,
00071 __PyInit,
00072 0,
00073 Base::PlacementPy::PyMake,
00074 0,
00075 0,
00076 0,
00077 0,
00078 0,
00079 0,
00080 0,
00081 0
00082 };
00083
00085 PyMethodDef PlacementPy::Methods[] = {
00086 {"copy",
00087 (PyCFunction) staticCallback_copy,
00088 METH_VARARGS,
00089 "\n copy()\n Returns a copy of this Placement\n "
00090 },
00091 {"move",
00092 (PyCFunction) staticCallback_move,
00093 METH_VARARGS,
00094 "\n move(Vector) \n Move the placement along the vector\n "
00095 },
00096 {"multiply",
00097 (PyCFunction) staticCallback_multiply,
00098 METH_VARARGS,
00099 "\n multiply(Placement)\n Multiply this placement with another placement\n "
00100 },
00101 {"multVec",
00102 (PyCFunction) staticCallback_multVec,
00103 METH_VARARGS,
00104 "\n multVector(Vector) -> Vector\n Compute the transformed vector using the placement\n "
00105 },
00106 {"toMatrix",
00107 (PyCFunction) staticCallback_toMatrix,
00108 METH_VARARGS,
00109 "\n toMatrix()\n convert the placement to a matrix representation\n "
00110 },
00111 {"inverse",
00112 (PyCFunction) staticCallback_inverse,
00113 METH_VARARGS,
00114 "\n inverse() -> Placement\n compute the inverse placement\n "
00115 },
00116 {NULL, NULL, 0, NULL}
00117 };
00118
00119
00120
00122 PyGetSetDef PlacementPy::GetterSetter[] = {
00123 {"Base",
00124 (getter) staticCallback_getBase,
00125 (setter) staticCallback_setBase,
00126 "Vector to the Base Position of the Placement",
00127 NULL
00128 },
00129 {"Rotation",
00130 (getter) staticCallback_getRotation,
00131 (setter) staticCallback_setRotation,
00132 "Orientation of the placement expressed as rotation",
00133 NULL
00134 },
00135 {NULL, NULL, NULL, NULL, NULL}
00136 };
00137
00138
00139
00140
00141 PyObject * PlacementPy::staticCallback_copy (PyObject *self, PyObject *args)
00142 {
00143
00144 if (!((PyObjectBase*) self)->isValid()){
00145 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00146 return NULL;
00147 }
00148
00149
00150 if (((PyObjectBase*) self)->isConst()){
00151 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00152 return NULL;
00153 }
00154
00155 try {
00156 PyObject* ret = ((PlacementPy*)self)->copy(args);
00157 if (ret != 0)
00158 ((PlacementPy*)self)->startNotify();
00159 return ret;
00160 }
00161 catch(const Base::Exception& e)
00162 {
00163 std::string str;
00164 str += "FreeCAD exception thrown (";
00165 str += e.what();
00166 str += ")";
00167 e.ReportException();
00168 PyErr_SetString(PyExc_Exception,str.c_str());
00169 return NULL;
00170 }
00171 catch(const boost::filesystem::filesystem_error& e)
00172 {
00173 std::string str;
00174 str += "File system exception thrown (";
00175
00176
00177 str += e.what();
00178 str += ")\n";
00179 Base::Console().Error(str.c_str());
00180 PyErr_SetString(PyExc_Exception,str.c_str());
00181 return NULL;
00182 }
00183 catch(const Py::Exception&)
00184 {
00185
00186 return NULL;
00187 }
00188 catch(const char* e)
00189 {
00190 Base::Console().Error(e);
00191 PyErr_SetString(PyExc_Exception,e);
00192 return NULL;
00193 }
00194
00195 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00196 catch(const std::exception& e)
00197 {
00198 std::string str;
00199 str += "FC++ exception thrown (";
00200 str += e.what();
00201 str += ")";
00202 Base::Console().Error(str.c_str());
00203 PyErr_SetString(PyExc_Exception,str.c_str());
00204 return NULL;
00205 }
00206 catch(...)
00207 {
00208 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00209 return NULL;
00210 }
00211 #endif
00212 }
00213
00214
00215
00216
00217 PyObject * PlacementPy::staticCallback_move (PyObject *self, PyObject *args)
00218 {
00219
00220 if (!((PyObjectBase*) self)->isValid()){
00221 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00222 return NULL;
00223 }
00224
00225
00226 if (((PyObjectBase*) self)->isConst()){
00227 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00228 return NULL;
00229 }
00230
00231 try {
00232 PyObject* ret = ((PlacementPy*)self)->move(args);
00233 if (ret != 0)
00234 ((PlacementPy*)self)->startNotify();
00235 return ret;
00236 }
00237 catch(const Base::Exception& e)
00238 {
00239 std::string str;
00240 str += "FreeCAD exception thrown (";
00241 str += e.what();
00242 str += ")";
00243 e.ReportException();
00244 PyErr_SetString(PyExc_Exception,str.c_str());
00245 return NULL;
00246 }
00247 catch(const boost::filesystem::filesystem_error& e)
00248 {
00249 std::string str;
00250 str += "File system exception thrown (";
00251
00252
00253 str += e.what();
00254 str += ")\n";
00255 Base::Console().Error(str.c_str());
00256 PyErr_SetString(PyExc_Exception,str.c_str());
00257 return NULL;
00258 }
00259 catch(const Py::Exception&)
00260 {
00261
00262 return NULL;
00263 }
00264 catch(const char* e)
00265 {
00266 Base::Console().Error(e);
00267 PyErr_SetString(PyExc_Exception,e);
00268 return NULL;
00269 }
00270
00271 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00272 catch(const std::exception& e)
00273 {
00274 std::string str;
00275 str += "FC++ exception thrown (";
00276 str += e.what();
00277 str += ")";
00278 Base::Console().Error(str.c_str());
00279 PyErr_SetString(PyExc_Exception,str.c_str());
00280 return NULL;
00281 }
00282 catch(...)
00283 {
00284 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00285 return NULL;
00286 }
00287 #endif
00288 }
00289
00290
00291
00292
00293 PyObject * PlacementPy::staticCallback_multiply (PyObject *self, PyObject *args)
00294 {
00295
00296 if (!((PyObjectBase*) self)->isValid()){
00297 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00298 return NULL;
00299 }
00300
00301
00302 if (((PyObjectBase*) self)->isConst()){
00303 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00304 return NULL;
00305 }
00306
00307 try {
00308 PyObject* ret = ((PlacementPy*)self)->multiply(args);
00309 if (ret != 0)
00310 ((PlacementPy*)self)->startNotify();
00311 return ret;
00312 }
00313 catch(const Base::Exception& e)
00314 {
00315 std::string str;
00316 str += "FreeCAD exception thrown (";
00317 str += e.what();
00318 str += ")";
00319 e.ReportException();
00320 PyErr_SetString(PyExc_Exception,str.c_str());
00321 return NULL;
00322 }
00323 catch(const boost::filesystem::filesystem_error& e)
00324 {
00325 std::string str;
00326 str += "File system exception thrown (";
00327
00328
00329 str += e.what();
00330 str += ")\n";
00331 Base::Console().Error(str.c_str());
00332 PyErr_SetString(PyExc_Exception,str.c_str());
00333 return NULL;
00334 }
00335 catch(const Py::Exception&)
00336 {
00337
00338 return NULL;
00339 }
00340 catch(const char* e)
00341 {
00342 Base::Console().Error(e);
00343 PyErr_SetString(PyExc_Exception,e);
00344 return NULL;
00345 }
00346
00347 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00348 catch(const std::exception& e)
00349 {
00350 std::string str;
00351 str += "FC++ exception thrown (";
00352 str += e.what();
00353 str += ")";
00354 Base::Console().Error(str.c_str());
00355 PyErr_SetString(PyExc_Exception,str.c_str());
00356 return NULL;
00357 }
00358 catch(...)
00359 {
00360 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00361 return NULL;
00362 }
00363 #endif
00364 }
00365
00366
00367
00368
00369 PyObject * PlacementPy::staticCallback_multVec (PyObject *self, PyObject *args)
00370 {
00371
00372 if (!((PyObjectBase*) self)->isValid()){
00373 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00374 return NULL;
00375 }
00376
00377
00378 if (((PyObjectBase*) self)->isConst()){
00379 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00380 return NULL;
00381 }
00382
00383 try {
00384 PyObject* ret = ((PlacementPy*)self)->multVec(args);
00385 if (ret != 0)
00386 ((PlacementPy*)self)->startNotify();
00387 return ret;
00388 }
00389 catch(const Base::Exception& e)
00390 {
00391 std::string str;
00392 str += "FreeCAD exception thrown (";
00393 str += e.what();
00394 str += ")";
00395 e.ReportException();
00396 PyErr_SetString(PyExc_Exception,str.c_str());
00397 return NULL;
00398 }
00399 catch(const boost::filesystem::filesystem_error& e)
00400 {
00401 std::string str;
00402 str += "File system exception thrown (";
00403
00404
00405 str += e.what();
00406 str += ")\n";
00407 Base::Console().Error(str.c_str());
00408 PyErr_SetString(PyExc_Exception,str.c_str());
00409 return NULL;
00410 }
00411 catch(const Py::Exception&)
00412 {
00413
00414 return NULL;
00415 }
00416 catch(const char* e)
00417 {
00418 Base::Console().Error(e);
00419 PyErr_SetString(PyExc_Exception,e);
00420 return NULL;
00421 }
00422
00423 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00424 catch(const std::exception& e)
00425 {
00426 std::string str;
00427 str += "FC++ exception thrown (";
00428 str += e.what();
00429 str += ")";
00430 Base::Console().Error(str.c_str());
00431 PyErr_SetString(PyExc_Exception,str.c_str());
00432 return NULL;
00433 }
00434 catch(...)
00435 {
00436 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00437 return NULL;
00438 }
00439 #endif
00440 }
00441
00442
00443
00444
00445 PyObject * PlacementPy::staticCallback_toMatrix (PyObject *self, PyObject *args)
00446 {
00447
00448 if (!((PyObjectBase*) self)->isValid()){
00449 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00450 return NULL;
00451 }
00452
00453
00454 if (((PyObjectBase*) self)->isConst()){
00455 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00456 return NULL;
00457 }
00458
00459 try {
00460 PyObject* ret = ((PlacementPy*)self)->toMatrix(args);
00461 if (ret != 0)
00462 ((PlacementPy*)self)->startNotify();
00463 return ret;
00464 }
00465 catch(const Base::Exception& e)
00466 {
00467 std::string str;
00468 str += "FreeCAD exception thrown (";
00469 str += e.what();
00470 str += ")";
00471 e.ReportException();
00472 PyErr_SetString(PyExc_Exception,str.c_str());
00473 return NULL;
00474 }
00475 catch(const boost::filesystem::filesystem_error& e)
00476 {
00477 std::string str;
00478 str += "File system exception thrown (";
00479
00480
00481 str += e.what();
00482 str += ")\n";
00483 Base::Console().Error(str.c_str());
00484 PyErr_SetString(PyExc_Exception,str.c_str());
00485 return NULL;
00486 }
00487 catch(const Py::Exception&)
00488 {
00489
00490 return NULL;
00491 }
00492 catch(const char* e)
00493 {
00494 Base::Console().Error(e);
00495 PyErr_SetString(PyExc_Exception,e);
00496 return NULL;
00497 }
00498
00499 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00500 catch(const std::exception& e)
00501 {
00502 std::string str;
00503 str += "FC++ exception thrown (";
00504 str += e.what();
00505 str += ")";
00506 Base::Console().Error(str.c_str());
00507 PyErr_SetString(PyExc_Exception,str.c_str());
00508 return NULL;
00509 }
00510 catch(...)
00511 {
00512 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00513 return NULL;
00514 }
00515 #endif
00516 }
00517
00518
00519
00520
00521 PyObject * PlacementPy::staticCallback_inverse (PyObject *self, PyObject *args)
00522 {
00523
00524 if (!((PyObjectBase*) self)->isValid()){
00525 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00526 return NULL;
00527 }
00528
00529
00530 if (((PyObjectBase*) self)->isConst()){
00531 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00532 return NULL;
00533 }
00534
00535 try {
00536 PyObject* ret = ((PlacementPy*)self)->inverse(args);
00537 if (ret != 0)
00538 ((PlacementPy*)self)->startNotify();
00539 return ret;
00540 }
00541 catch(const Base::Exception& e)
00542 {
00543 std::string str;
00544 str += "FreeCAD exception thrown (";
00545 str += e.what();
00546 str += ")";
00547 e.ReportException();
00548 PyErr_SetString(PyExc_Exception,str.c_str());
00549 return NULL;
00550 }
00551 catch(const boost::filesystem::filesystem_error& e)
00552 {
00553 std::string str;
00554 str += "File system exception thrown (";
00555
00556
00557 str += e.what();
00558 str += ")\n";
00559 Base::Console().Error(str.c_str());
00560 PyErr_SetString(PyExc_Exception,str.c_str());
00561 return NULL;
00562 }
00563 catch(const Py::Exception&)
00564 {
00565
00566 return NULL;
00567 }
00568 catch(const char* e)
00569 {
00570 Base::Console().Error(e);
00571 PyErr_SetString(PyExc_Exception,e);
00572 return NULL;
00573 }
00574
00575 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00576 catch(const std::exception& e)
00577 {
00578 std::string str;
00579 str += "FC++ exception thrown (";
00580 str += e.what();
00581 str += ")";
00582 Base::Console().Error(str.c_str());
00583 PyErr_SetString(PyExc_Exception,str.c_str());
00584 return NULL;
00585 }
00586 catch(...)
00587 {
00588 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00589 return NULL;
00590 }
00591 #endif
00592 }
00593
00594
00595
00596
00597 PyObject * PlacementPy::staticCallback_getBase (PyObject *self, void * )
00598 {
00599 if (!((PyObjectBase*) self)->isValid()){
00600 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00601 return NULL;
00602 }
00603
00604 try {
00605 return Py::new_reference_to(((PlacementPy*)self)->getBase());
00606 } catch (const Py::Exception&) {
00607
00608 return NULL;
00609 } catch (...) {
00610 PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'Base' of object 'Placement'");
00611 return NULL;
00612 }
00613 }
00614
00615 int PlacementPy::staticCallback_setBase (PyObject *self, PyObject *value, void * )
00616 {
00617 if (!((PyObjectBase*) self)->isValid()){
00618 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00619 return -1;
00620 }
00621 if (((PyObjectBase*) self)->isConst()){
00622 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
00623 return -1;
00624 }
00625
00626 try {
00627 ((PlacementPy*)self)->setBase(Py::Object(value,false));
00628 return 0;
00629 } catch (const Py::Exception&) {
00630
00631 return -1;
00632 } catch (...) {
00633 PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'Base' of object 'Placement'");
00634 return -1;
00635 }
00636 }
00637
00638
00639
00640
00641 PyObject * PlacementPy::staticCallback_getRotation (PyObject *self, void * )
00642 {
00643 if (!((PyObjectBase*) self)->isValid()){
00644 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00645 return NULL;
00646 }
00647
00648 try {
00649 return Py::new_reference_to(((PlacementPy*)self)->getRotation());
00650 } catch (const Py::Exception&) {
00651
00652 return NULL;
00653 } catch (...) {
00654 PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'Rotation' of object 'Placement'");
00655 return NULL;
00656 }
00657 }
00658
00659 int PlacementPy::staticCallback_setRotation (PyObject *self, PyObject *value, void * )
00660 {
00661 if (!((PyObjectBase*) self)->isValid()){
00662 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00663 return -1;
00664 }
00665 if (((PyObjectBase*) self)->isConst()){
00666 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
00667 return -1;
00668 }
00669
00670 try {
00671 ((PlacementPy*)self)->setRotation(Py::Object(value,false));
00672 return 0;
00673 } catch (const Py::Exception&) {
00674
00675 return -1;
00676 } catch (...) {
00677 PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'Rotation' of object 'Placement'");
00678 return -1;
00679 }
00680 }
00681
00682
00683
00684
00685
00686
00687 PyParentObject PlacementPy::Parents[] = { PARENTSBasePlacementPy };
00688
00689
00690
00691
00692 PlacementPy::PlacementPy(Placement *pcObject, PyTypeObject *T)
00693 : PyObjectBase(reinterpret_cast<PyObjectBase::PointerType>(pcObject), T)
00694 {
00695 }
00696
00697
00698
00699
00700
00701 PlacementPy::~PlacementPy()
00702 {
00703
00704 PlacementPy::PointerType ptr = reinterpret_cast<PlacementPy::PointerType>(_pcTwinPointer);
00705 delete ptr;
00706 }
00707
00708
00709
00710
00711 PyObject *PlacementPy::_repr(void)
00712 {
00713 return Py_BuildValue("s", representation().c_str());
00714 }
00715
00716
00717
00718
00719 PyObject *PlacementPy::_getattr(char *attr)
00720 {
00721 try {
00722
00723 PyObject *r = getCustomAttributes(attr);
00724 if(r) return r;
00725 }
00726 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00727 catch(const Base::Exception& e)
00728 {
00729 std::string str;
00730 str += "FreeCAD exception thrown (";
00731 str += e.what();
00732 str += ")";
00733 e.ReportException();
00734 PyErr_SetString(PyExc_Exception,str.c_str());
00735 return NULL;
00736 }
00737 catch(const std::exception& e)
00738 {
00739 std::string str;
00740 str += "FC++ exception thrown (";
00741 str += e.what();
00742 str += ")";
00743 Base::Console().Error(str.c_str());
00744 PyErr_SetString(PyExc_Exception,str.c_str());
00745 return NULL;
00746 }
00747 catch(const Py::Exception&)
00748 {
00749
00750 return NULL;
00751 }
00752 catch(...)
00753 {
00754 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00755 return NULL;
00756 }
00757 #else // DONT_CATCH_CXX_EXCEPTIONS
00758 catch(const Base::Exception& e)
00759 {
00760 std::string str;
00761 str += "FreeCAD exception thrown (";
00762 str += e.what();
00763 str += ")";
00764 e.ReportException();
00765 PyErr_SetString(PyExc_Exception,str.c_str());
00766 return NULL;
00767 }
00768 catch(const Py::Exception&)
00769 {
00770
00771 return NULL;
00772 }
00773 #endif // DONT_CATCH_CXX_EXCEPTIONS
00774
00775 PyObject *rvalue = Py_FindMethod(Methods, this, attr);
00776 if (rvalue == NULL)
00777 {
00778 PyErr_Clear();
00779 return PyObjectBase::_getattr(attr);
00780 }
00781 else
00782 {
00783 return rvalue;
00784 }
00785 }
00786
00787 int PlacementPy::_setattr(char *attr, PyObject *value)
00788 {
00789 try {
00790
00791 int r = setCustomAttributes(attr, value);
00792 if(r==1) return 0;
00793 }
00794 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00795 catch(const Base::Exception& e)
00796 {
00797 std::string str;
00798 str += "FreeCAD exception thrown (";
00799 str += e.what();
00800 str += ")";
00801 e.ReportException();
00802 PyErr_SetString(PyExc_Exception,str.c_str());
00803 return -1;
00804 }
00805 catch(const std::exception& e)
00806 {
00807 std::string str;
00808 str += "FC++ exception thrown (";
00809 str += e.what();
00810 str += ")";
00811 Base::Console().Error(str.c_str());
00812 PyErr_SetString(PyExc_Exception,str.c_str());
00813 return -1;
00814 }
00815 catch(const Py::Exception&)
00816 {
00817
00818 return -1;
00819 }
00820 catch(...)
00821 {
00822 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00823 return -1;
00824 }
00825 #else // DONT_CATCH_CXX_EXCEPTIONS
00826 catch(const Base::Exception& e)
00827 {
00828 std::string str;
00829 str += "FreeCAD exception thrown (";
00830 str += e.what();
00831 str += ")";
00832 e.ReportException();
00833 PyErr_SetString(PyExc_Exception,str.c_str());
00834 return -1;
00835 }
00836 catch(const Py::Exception&)
00837 {
00838
00839 return -1;
00840 }
00841 #endif // DONT_CATCH_CXX_EXCEPTIONS
00842
00843 return PyObjectBase::_setattr(attr, value);
00844 }
00845
00846 Placement *PlacementPy::getPlacementPtr(void) const
00847 {
00848 return static_cast<Placement *>(_pcTwinPointer);
00849 }
00850
00851 #if 0
00852
00853
00854
00855
00856 PyObject *PlacementPy::PyMake(struct _typeobject *, PyObject *, PyObject *)
00857 {
00858
00859 return new PlacementPy(new Placement);
00860 }
00861
00862
00863 int PlacementPy::PyInit(PyObject* , PyObject* )
00864 {
00865 return 0;
00866 }
00867
00868
00869 std::string PlacementPy::representation(void) const
00870 {
00871 return std::string("<Placement object>");
00872 }
00873
00874 PyObject* PlacementPy::copy(PyObject *args)
00875 {
00876 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
00877 return 0;
00878 }
00879
00880 PyObject* PlacementPy::move(PyObject *args)
00881 {
00882 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
00883 return 0;
00884 }
00885
00886 PyObject* PlacementPy::multiply(PyObject *args)
00887 {
00888 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
00889 return 0;
00890 }
00891
00892 PyObject* PlacementPy::multVec(PyObject *args)
00893 {
00894 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
00895 return 0;
00896 }
00897
00898 PyObject* PlacementPy::toMatrix(PyObject *args)
00899 {
00900 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
00901 return 0;
00902 }
00903
00904 PyObject* PlacementPy::inverse(PyObject *args)
00905 {
00906 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
00907 return 0;
00908 }
00909
00910
00911
00912 Py::Object PlacementPy::getBase(void) const
00913 {
00914
00915 throw Py::AttributeError("Not yet implemented");
00916 }
00917
00918 void PlacementPy::setBase(Py::Object arg)
00919 {
00920 throw Py::AttributeError("Not yet implemented");
00921 }
00922
00923 Py::Object PlacementPy::getRotation(void) const
00924 {
00925
00926 throw Py::AttributeError("Not yet implemented");
00927 }
00928
00929 void PlacementPy::setRotation(Py::Object arg)
00930 {
00931 throw Py::AttributeError("Not yet implemented");
00932 }
00933
00934 PyObject *PlacementPy::getCustomAttributes(const char* attr) const
00935 {
00936 return 0;
00937 }
00938
00939 int PlacementPy::setCustomAttributes(const char* attr, PyObject *obj)
00940 {
00941 return 0;
00942 }
00943 #endif
00944
00945
00946