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 Part;
00018
00020 PyTypeObject TopoShapeFacePy::Type = {
00021 PyObject_HEAD_INIT(&PyType_Type)
00022 0,
00023 "Part.TopoShape",
00024 sizeof(TopoShapeFacePy),
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 "TopoShapeFace is the OpenCasCade topological face wrapper",
00046 0,
00047 0,
00048 0,
00049 0,
00050 0,
00051 0,
00052 Part::TopoShapeFacePy::Methods,
00053 0,
00054 Part::TopoShapeFacePy::GetterSetter,
00055 &Part::TopoShapePy::Type,
00056 0,
00057 0,
00058 0,
00059 0,
00060 __PyInit,
00061 0,
00062 Part::TopoShapeFacePy::PyMake,
00063 0,
00064 0,
00065 0,
00066 0,
00067 0,
00068 0,
00069 0,
00070 0
00071 };
00072
00074 PyMethodDef TopoShapeFacePy::Methods[] = {
00075 {"makeOffset",
00076 (PyCFunction) staticCallback_makeOffset,
00077 METH_VARARGS,
00078 "Offset the shape by a given ammount"
00079 },
00080 {"tangentAt",
00081 (PyCFunction) staticCallback_tangentAt,
00082 METH_VARARGS,
00083 "Get the tangent in u and v isoparametric at the given point if defined"
00084 },
00085 {"valueAt",
00086 (PyCFunction) staticCallback_valueAt,
00087 METH_VARARGS,
00088 "Vector = valueAt(pos) - Get the point at the given parameter [0|Length] if defined"
00089 },
00090 {"normalAt",
00091 (PyCFunction) staticCallback_normalAt,
00092 METH_VARARGS,
00093 "Vector = normalAt(pos) - Get the normal vector at the given parameter [0|Length] if defined"
00094 },
00095 {"derivative1At",
00096 (PyCFunction) staticCallback_derivative1At,
00097 METH_VARARGS,
00098 "Vector = d1At(pos) - Get the first derivative at the given parameter [0|Length] if defined"
00099 },
00100 {"derivative2At",
00101 (PyCFunction) staticCallback_derivative2At,
00102 METH_VARARGS,
00103 "Vector = d2At(pos) - Get the second derivative at the given parameter [0|Length] if defined"
00104 },
00105 {"curvatureAt",
00106 (PyCFunction) staticCallback_curvatureAt,
00107 METH_VARARGS,
00108 "Float = curvatureAt(pos) - Get the curvature at the given parameter [0|Length] if defined"
00109 },
00110 {"isPartOfDomain",
00111 (PyCFunction) staticCallback_isPartOfDomain,
00112 METH_VARARGS,
00113 "Check if a given (u,v) pair is inside the domain of a face"
00114 },
00115 {"makeHalfSpace",
00116 (PyCFunction) staticCallback_makeHalfSpace,
00117 METH_VARARGS,
00118 "Make a half-space solid by this face and a reference point."
00119 },
00120 {"setTolerance",
00121 (PyCFunction) staticCallback_setTolerance,
00122 METH_VARARGS,
00123 "Set the tolerance for the face."
00124 },
00125 {NULL, NULL, 0, NULL}
00126 };
00127
00128
00129
00131 PyGetSetDef TopoShapeFacePy::GetterSetter[] = {
00132 {"ParameterRange",
00133 (getter) staticCallback_getParameterRange,
00134 (setter) staticCallback_setParameterRange,
00135 "Returns a 4 tuple with the parameter range",
00136 NULL
00137 },
00138 {"Surface",
00139 (getter) staticCallback_getSurface,
00140 (setter) staticCallback_setSurface,
00141 "Returns the geometric surface of the face",
00142 NULL
00143 },
00144 {"Wire",
00145 (getter) staticCallback_getWire,
00146 (setter) staticCallback_setWire,
00147 "The Wire of this face",
00148 NULL
00149 },
00150 {"CenterOfMass",
00151 (getter) staticCallback_getCenterOfMass,
00152 (setter) staticCallback_setCenterOfMass,
00153 "\n Returns the center of mass of the current system.\n If the gravitational field is uniform, it is the center of gravity.\n The coordinates returned for the center of mass are expressed in the\n absolute Cartesian coordinate system.\n ",
00154 NULL
00155 },
00156 {NULL, NULL, NULL, NULL, NULL}
00157 };
00158
00159
00160
00161
00162 PyObject * TopoShapeFacePy::staticCallback_makeOffset (PyObject *self, PyObject *args)
00163 {
00164
00165 if (!((PyObjectBase*) self)->isValid()){
00166 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00167 return NULL;
00168 }
00169
00170
00171 if (((PyObjectBase*) self)->isConst()){
00172 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00173 return NULL;
00174 }
00175
00176 try {
00177 PyObject* ret = ((TopoShapeFacePy*)self)->makeOffset(args);
00178 if (ret != 0)
00179 ((TopoShapeFacePy*)self)->startNotify();
00180 return ret;
00181 }
00182 catch(const Base::Exception& e)
00183 {
00184 std::string str;
00185 str += "FreeCAD exception thrown (";
00186 str += e.what();
00187 str += ")";
00188 e.ReportException();
00189 PyErr_SetString(PyExc_Exception,str.c_str());
00190 return NULL;
00191 }
00192 catch(const boost::filesystem::filesystem_error& e)
00193 {
00194 std::string str;
00195 str += "File system exception thrown (";
00196
00197
00198 str += e.what();
00199 str += ")\n";
00200 Base::Console().Error(str.c_str());
00201 PyErr_SetString(PyExc_Exception,str.c_str());
00202 return NULL;
00203 }
00204 catch(const Py::Exception&)
00205 {
00206
00207 return NULL;
00208 }
00209 catch(const char* e)
00210 {
00211 Base::Console().Error(e);
00212 PyErr_SetString(PyExc_Exception,e);
00213 return NULL;
00214 }
00215
00216 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00217 catch(const std::exception& e)
00218 {
00219 std::string str;
00220 str += "FC++ exception thrown (";
00221 str += e.what();
00222 str += ")";
00223 Base::Console().Error(str.c_str());
00224 PyErr_SetString(PyExc_Exception,str.c_str());
00225 return NULL;
00226 }
00227 catch(...)
00228 {
00229 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00230 return NULL;
00231 }
00232 #endif
00233 }
00234
00235
00236
00237
00238 PyObject * TopoShapeFacePy::staticCallback_tangentAt (PyObject *self, PyObject *args)
00239 {
00240
00241 if (!((PyObjectBase*) self)->isValid()){
00242 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00243 return NULL;
00244 }
00245
00246
00247 if (((PyObjectBase*) self)->isConst()){
00248 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00249 return NULL;
00250 }
00251
00252 try {
00253 PyObject* ret = ((TopoShapeFacePy*)self)->tangentAt(args);
00254 if (ret != 0)
00255 ((TopoShapeFacePy*)self)->startNotify();
00256 return ret;
00257 }
00258 catch(const Base::Exception& e)
00259 {
00260 std::string str;
00261 str += "FreeCAD exception thrown (";
00262 str += e.what();
00263 str += ")";
00264 e.ReportException();
00265 PyErr_SetString(PyExc_Exception,str.c_str());
00266 return NULL;
00267 }
00268 catch(const boost::filesystem::filesystem_error& e)
00269 {
00270 std::string str;
00271 str += "File system exception thrown (";
00272
00273
00274 str += e.what();
00275 str += ")\n";
00276 Base::Console().Error(str.c_str());
00277 PyErr_SetString(PyExc_Exception,str.c_str());
00278 return NULL;
00279 }
00280 catch(const Py::Exception&)
00281 {
00282
00283 return NULL;
00284 }
00285 catch(const char* e)
00286 {
00287 Base::Console().Error(e);
00288 PyErr_SetString(PyExc_Exception,e);
00289 return NULL;
00290 }
00291
00292 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00293 catch(const std::exception& e)
00294 {
00295 std::string str;
00296 str += "FC++ exception thrown (";
00297 str += e.what();
00298 str += ")";
00299 Base::Console().Error(str.c_str());
00300 PyErr_SetString(PyExc_Exception,str.c_str());
00301 return NULL;
00302 }
00303 catch(...)
00304 {
00305 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00306 return NULL;
00307 }
00308 #endif
00309 }
00310
00311
00312
00313
00314 PyObject * TopoShapeFacePy::staticCallback_valueAt (PyObject *self, PyObject *args)
00315 {
00316
00317 if (!((PyObjectBase*) self)->isValid()){
00318 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00319 return NULL;
00320 }
00321
00322
00323 if (((PyObjectBase*) self)->isConst()){
00324 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00325 return NULL;
00326 }
00327
00328 try {
00329 PyObject* ret = ((TopoShapeFacePy*)self)->valueAt(args);
00330 if (ret != 0)
00331 ((TopoShapeFacePy*)self)->startNotify();
00332 return ret;
00333 }
00334 catch(const Base::Exception& e)
00335 {
00336 std::string str;
00337 str += "FreeCAD exception thrown (";
00338 str += e.what();
00339 str += ")";
00340 e.ReportException();
00341 PyErr_SetString(PyExc_Exception,str.c_str());
00342 return NULL;
00343 }
00344 catch(const boost::filesystem::filesystem_error& e)
00345 {
00346 std::string str;
00347 str += "File system exception thrown (";
00348
00349
00350 str += e.what();
00351 str += ")\n";
00352 Base::Console().Error(str.c_str());
00353 PyErr_SetString(PyExc_Exception,str.c_str());
00354 return NULL;
00355 }
00356 catch(const Py::Exception&)
00357 {
00358
00359 return NULL;
00360 }
00361 catch(const char* e)
00362 {
00363 Base::Console().Error(e);
00364 PyErr_SetString(PyExc_Exception,e);
00365 return NULL;
00366 }
00367
00368 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00369 catch(const std::exception& e)
00370 {
00371 std::string str;
00372 str += "FC++ exception thrown (";
00373 str += e.what();
00374 str += ")";
00375 Base::Console().Error(str.c_str());
00376 PyErr_SetString(PyExc_Exception,str.c_str());
00377 return NULL;
00378 }
00379 catch(...)
00380 {
00381 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00382 return NULL;
00383 }
00384 #endif
00385 }
00386
00387
00388
00389
00390 PyObject * TopoShapeFacePy::staticCallback_normalAt (PyObject *self, PyObject *args)
00391 {
00392
00393 if (!((PyObjectBase*) self)->isValid()){
00394 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00395 return NULL;
00396 }
00397
00398
00399 if (((PyObjectBase*) self)->isConst()){
00400 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00401 return NULL;
00402 }
00403
00404 try {
00405 PyObject* ret = ((TopoShapeFacePy*)self)->normalAt(args);
00406 if (ret != 0)
00407 ((TopoShapeFacePy*)self)->startNotify();
00408 return ret;
00409 }
00410 catch(const Base::Exception& e)
00411 {
00412 std::string str;
00413 str += "FreeCAD exception thrown (";
00414 str += e.what();
00415 str += ")";
00416 e.ReportException();
00417 PyErr_SetString(PyExc_Exception,str.c_str());
00418 return NULL;
00419 }
00420 catch(const boost::filesystem::filesystem_error& e)
00421 {
00422 std::string str;
00423 str += "File system exception thrown (";
00424
00425
00426 str += e.what();
00427 str += ")\n";
00428 Base::Console().Error(str.c_str());
00429 PyErr_SetString(PyExc_Exception,str.c_str());
00430 return NULL;
00431 }
00432 catch(const Py::Exception&)
00433 {
00434
00435 return NULL;
00436 }
00437 catch(const char* e)
00438 {
00439 Base::Console().Error(e);
00440 PyErr_SetString(PyExc_Exception,e);
00441 return NULL;
00442 }
00443
00444 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00445 catch(const std::exception& e)
00446 {
00447 std::string str;
00448 str += "FC++ exception thrown (";
00449 str += e.what();
00450 str += ")";
00451 Base::Console().Error(str.c_str());
00452 PyErr_SetString(PyExc_Exception,str.c_str());
00453 return NULL;
00454 }
00455 catch(...)
00456 {
00457 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00458 return NULL;
00459 }
00460 #endif
00461 }
00462
00463
00464
00465
00466 PyObject * TopoShapeFacePy::staticCallback_derivative1At (PyObject *self, PyObject *args)
00467 {
00468
00469 if (!((PyObjectBase*) self)->isValid()){
00470 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00471 return NULL;
00472 }
00473
00474
00475 if (((PyObjectBase*) self)->isConst()){
00476 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00477 return NULL;
00478 }
00479
00480 try {
00481 PyObject* ret = ((TopoShapeFacePy*)self)->derivative1At(args);
00482 if (ret != 0)
00483 ((TopoShapeFacePy*)self)->startNotify();
00484 return ret;
00485 }
00486 catch(const Base::Exception& e)
00487 {
00488 std::string str;
00489 str += "FreeCAD exception thrown (";
00490 str += e.what();
00491 str += ")";
00492 e.ReportException();
00493 PyErr_SetString(PyExc_Exception,str.c_str());
00494 return NULL;
00495 }
00496 catch(const boost::filesystem::filesystem_error& e)
00497 {
00498 std::string str;
00499 str += "File system exception thrown (";
00500
00501
00502 str += e.what();
00503 str += ")\n";
00504 Base::Console().Error(str.c_str());
00505 PyErr_SetString(PyExc_Exception,str.c_str());
00506 return NULL;
00507 }
00508 catch(const Py::Exception&)
00509 {
00510
00511 return NULL;
00512 }
00513 catch(const char* e)
00514 {
00515 Base::Console().Error(e);
00516 PyErr_SetString(PyExc_Exception,e);
00517 return NULL;
00518 }
00519
00520 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00521 catch(const std::exception& e)
00522 {
00523 std::string str;
00524 str += "FC++ exception thrown (";
00525 str += e.what();
00526 str += ")";
00527 Base::Console().Error(str.c_str());
00528 PyErr_SetString(PyExc_Exception,str.c_str());
00529 return NULL;
00530 }
00531 catch(...)
00532 {
00533 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00534 return NULL;
00535 }
00536 #endif
00537 }
00538
00539
00540
00541
00542 PyObject * TopoShapeFacePy::staticCallback_derivative2At (PyObject *self, PyObject *args)
00543 {
00544
00545 if (!((PyObjectBase*) self)->isValid()){
00546 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00547 return NULL;
00548 }
00549
00550
00551 if (((PyObjectBase*) self)->isConst()){
00552 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00553 return NULL;
00554 }
00555
00556 try {
00557 PyObject* ret = ((TopoShapeFacePy*)self)->derivative2At(args);
00558 if (ret != 0)
00559 ((TopoShapeFacePy*)self)->startNotify();
00560 return ret;
00561 }
00562 catch(const Base::Exception& e)
00563 {
00564 std::string str;
00565 str += "FreeCAD exception thrown (";
00566 str += e.what();
00567 str += ")";
00568 e.ReportException();
00569 PyErr_SetString(PyExc_Exception,str.c_str());
00570 return NULL;
00571 }
00572 catch(const boost::filesystem::filesystem_error& e)
00573 {
00574 std::string str;
00575 str += "File system exception thrown (";
00576
00577
00578 str += e.what();
00579 str += ")\n";
00580 Base::Console().Error(str.c_str());
00581 PyErr_SetString(PyExc_Exception,str.c_str());
00582 return NULL;
00583 }
00584 catch(const Py::Exception&)
00585 {
00586
00587 return NULL;
00588 }
00589 catch(const char* e)
00590 {
00591 Base::Console().Error(e);
00592 PyErr_SetString(PyExc_Exception,e);
00593 return NULL;
00594 }
00595
00596 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00597 catch(const std::exception& e)
00598 {
00599 std::string str;
00600 str += "FC++ exception thrown (";
00601 str += e.what();
00602 str += ")";
00603 Base::Console().Error(str.c_str());
00604 PyErr_SetString(PyExc_Exception,str.c_str());
00605 return NULL;
00606 }
00607 catch(...)
00608 {
00609 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00610 return NULL;
00611 }
00612 #endif
00613 }
00614
00615
00616
00617
00618 PyObject * TopoShapeFacePy::staticCallback_curvatureAt (PyObject *self, PyObject *args)
00619 {
00620
00621 if (!((PyObjectBase*) self)->isValid()){
00622 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00623 return NULL;
00624 }
00625
00626
00627 if (((PyObjectBase*) self)->isConst()){
00628 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00629 return NULL;
00630 }
00631
00632 try {
00633 PyObject* ret = ((TopoShapeFacePy*)self)->curvatureAt(args);
00634 if (ret != 0)
00635 ((TopoShapeFacePy*)self)->startNotify();
00636 return ret;
00637 }
00638 catch(const Base::Exception& e)
00639 {
00640 std::string str;
00641 str += "FreeCAD exception thrown (";
00642 str += e.what();
00643 str += ")";
00644 e.ReportException();
00645 PyErr_SetString(PyExc_Exception,str.c_str());
00646 return NULL;
00647 }
00648 catch(const boost::filesystem::filesystem_error& e)
00649 {
00650 std::string str;
00651 str += "File system exception thrown (";
00652
00653
00654 str += e.what();
00655 str += ")\n";
00656 Base::Console().Error(str.c_str());
00657 PyErr_SetString(PyExc_Exception,str.c_str());
00658 return NULL;
00659 }
00660 catch(const Py::Exception&)
00661 {
00662
00663 return NULL;
00664 }
00665 catch(const char* e)
00666 {
00667 Base::Console().Error(e);
00668 PyErr_SetString(PyExc_Exception,e);
00669 return NULL;
00670 }
00671
00672 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00673 catch(const std::exception& e)
00674 {
00675 std::string str;
00676 str += "FC++ exception thrown (";
00677 str += e.what();
00678 str += ")";
00679 Base::Console().Error(str.c_str());
00680 PyErr_SetString(PyExc_Exception,str.c_str());
00681 return NULL;
00682 }
00683 catch(...)
00684 {
00685 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00686 return NULL;
00687 }
00688 #endif
00689 }
00690
00691
00692
00693
00694 PyObject * TopoShapeFacePy::staticCallback_isPartOfDomain (PyObject *self, PyObject *args)
00695 {
00696
00697 if (!((PyObjectBase*) self)->isValid()){
00698 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00699 return NULL;
00700 }
00701
00702
00703 if (((PyObjectBase*) self)->isConst()){
00704 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00705 return NULL;
00706 }
00707
00708 try {
00709 PyObject* ret = ((TopoShapeFacePy*)self)->isPartOfDomain(args);
00710 if (ret != 0)
00711 ((TopoShapeFacePy*)self)->startNotify();
00712 return ret;
00713 }
00714 catch(const Base::Exception& e)
00715 {
00716 std::string str;
00717 str += "FreeCAD exception thrown (";
00718 str += e.what();
00719 str += ")";
00720 e.ReportException();
00721 PyErr_SetString(PyExc_Exception,str.c_str());
00722 return NULL;
00723 }
00724 catch(const boost::filesystem::filesystem_error& e)
00725 {
00726 std::string str;
00727 str += "File system exception thrown (";
00728
00729
00730 str += e.what();
00731 str += ")\n";
00732 Base::Console().Error(str.c_str());
00733 PyErr_SetString(PyExc_Exception,str.c_str());
00734 return NULL;
00735 }
00736 catch(const Py::Exception&)
00737 {
00738
00739 return NULL;
00740 }
00741 catch(const char* e)
00742 {
00743 Base::Console().Error(e);
00744 PyErr_SetString(PyExc_Exception,e);
00745 return NULL;
00746 }
00747
00748 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00749 catch(const std::exception& e)
00750 {
00751 std::string str;
00752 str += "FC++ exception thrown (";
00753 str += e.what();
00754 str += ")";
00755 Base::Console().Error(str.c_str());
00756 PyErr_SetString(PyExc_Exception,str.c_str());
00757 return NULL;
00758 }
00759 catch(...)
00760 {
00761 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00762 return NULL;
00763 }
00764 #endif
00765 }
00766
00767
00768
00769
00770 PyObject * TopoShapeFacePy::staticCallback_makeHalfSpace (PyObject *self, PyObject *args)
00771 {
00772
00773 if (!((PyObjectBase*) self)->isValid()){
00774 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00775 return NULL;
00776 }
00777
00778
00779 if (((PyObjectBase*) self)->isConst()){
00780 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00781 return NULL;
00782 }
00783
00784 try {
00785 PyObject* ret = ((TopoShapeFacePy*)self)->makeHalfSpace(args);
00786 if (ret != 0)
00787 ((TopoShapeFacePy*)self)->startNotify();
00788 return ret;
00789 }
00790 catch(const Base::Exception& e)
00791 {
00792 std::string str;
00793 str += "FreeCAD exception thrown (";
00794 str += e.what();
00795 str += ")";
00796 e.ReportException();
00797 PyErr_SetString(PyExc_Exception,str.c_str());
00798 return NULL;
00799 }
00800 catch(const boost::filesystem::filesystem_error& e)
00801 {
00802 std::string str;
00803 str += "File system exception thrown (";
00804
00805
00806 str += e.what();
00807 str += ")\n";
00808 Base::Console().Error(str.c_str());
00809 PyErr_SetString(PyExc_Exception,str.c_str());
00810 return NULL;
00811 }
00812 catch(const Py::Exception&)
00813 {
00814
00815 return NULL;
00816 }
00817 catch(const char* e)
00818 {
00819 Base::Console().Error(e);
00820 PyErr_SetString(PyExc_Exception,e);
00821 return NULL;
00822 }
00823
00824 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00825 catch(const std::exception& e)
00826 {
00827 std::string str;
00828 str += "FC++ exception thrown (";
00829 str += e.what();
00830 str += ")";
00831 Base::Console().Error(str.c_str());
00832 PyErr_SetString(PyExc_Exception,str.c_str());
00833 return NULL;
00834 }
00835 catch(...)
00836 {
00837 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00838 return NULL;
00839 }
00840 #endif
00841 }
00842
00843
00844
00845
00846 PyObject * TopoShapeFacePy::staticCallback_setTolerance (PyObject *self, PyObject *args)
00847 {
00848
00849 if (!((PyObjectBase*) self)->isValid()){
00850 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00851 return NULL;
00852 }
00853
00854
00855 if (((PyObjectBase*) self)->isConst()){
00856 PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00857 return NULL;
00858 }
00859
00860 try {
00861 PyObject* ret = ((TopoShapeFacePy*)self)->setTolerance(args);
00862 if (ret != 0)
00863 ((TopoShapeFacePy*)self)->startNotify();
00864 return ret;
00865 }
00866 catch(const Base::Exception& e)
00867 {
00868 std::string str;
00869 str += "FreeCAD exception thrown (";
00870 str += e.what();
00871 str += ")";
00872 e.ReportException();
00873 PyErr_SetString(PyExc_Exception,str.c_str());
00874 return NULL;
00875 }
00876 catch(const boost::filesystem::filesystem_error& e)
00877 {
00878 std::string str;
00879 str += "File system exception thrown (";
00880
00881
00882 str += e.what();
00883 str += ")\n";
00884 Base::Console().Error(str.c_str());
00885 PyErr_SetString(PyExc_Exception,str.c_str());
00886 return NULL;
00887 }
00888 catch(const Py::Exception&)
00889 {
00890
00891 return NULL;
00892 }
00893 catch(const char* e)
00894 {
00895 Base::Console().Error(e);
00896 PyErr_SetString(PyExc_Exception,e);
00897 return NULL;
00898 }
00899
00900 #ifndef DONT_CATCH_CXX_EXCEPTIONS
00901 catch(const std::exception& e)
00902 {
00903 std::string str;
00904 str += "FC++ exception thrown (";
00905 str += e.what();
00906 str += ")";
00907 Base::Console().Error(str.c_str());
00908 PyErr_SetString(PyExc_Exception,str.c_str());
00909 return NULL;
00910 }
00911 catch(...)
00912 {
00913 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00914 return NULL;
00915 }
00916 #endif
00917 }
00918
00919
00920
00921
00922 PyObject * TopoShapeFacePy::staticCallback_getParameterRange (PyObject *self, void * )
00923 {
00924 if (!((PyObjectBase*) self)->isValid()){
00925 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00926 return NULL;
00927 }
00928
00929 try {
00930 return Py::new_reference_to(((TopoShapeFacePy*)self)->getParameterRange());
00931 } catch (const Py::Exception&) {
00932
00933 return NULL;
00934 } catch (...) {
00935 PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'ParameterRange' of object 'TopoShape'");
00936 return NULL;
00937 }
00938 }
00939
00940 int TopoShapeFacePy::staticCallback_setParameterRange (PyObject *self, PyObject * , 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 -1;
00945 }
00946
00947 PyErr_SetString(PyExc_AttributeError, "Attribute 'ParameterRange' of object 'TopoShape' is read-only");
00948 return -1;
00949 }
00950
00951
00952
00953
00954 PyObject * TopoShapeFacePy::staticCallback_getSurface (PyObject *self, void * )
00955 {
00956 if (!((PyObjectBase*) self)->isValid()){
00957 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00958 return NULL;
00959 }
00960
00961 try {
00962 return Py::new_reference_to(((TopoShapeFacePy*)self)->getSurface());
00963 } catch (const Py::Exception&) {
00964
00965 return NULL;
00966 } catch (...) {
00967 PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'Surface' of object 'TopoShape'");
00968 return NULL;
00969 }
00970 }
00971
00972 int TopoShapeFacePy::staticCallback_setSurface (PyObject *self, PyObject * , void * )
00973 {
00974 if (!((PyObjectBase*) self)->isValid()){
00975 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00976 return -1;
00977 }
00978
00979 PyErr_SetString(PyExc_AttributeError, "Attribute 'Surface' of object 'TopoShape' is read-only");
00980 return -1;
00981 }
00982
00983
00984
00985
00986 PyObject * TopoShapeFacePy::staticCallback_getWire (PyObject *self, void * )
00987 {
00988 if (!((PyObjectBase*) self)->isValid()){
00989 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00990 return NULL;
00991 }
00992
00993 try {
00994 return Py::new_reference_to(((TopoShapeFacePy*)self)->getWire());
00995 } catch (const Py::Exception&) {
00996
00997 return NULL;
00998 } catch (...) {
00999 PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'Wire' of object 'TopoShape'");
01000 return NULL;
01001 }
01002 }
01003
01004 int TopoShapeFacePy::staticCallback_setWire (PyObject *self, PyObject * , void * )
01005 {
01006 if (!((PyObjectBase*) self)->isValid()){
01007 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01008 return -1;
01009 }
01010
01011 PyErr_SetString(PyExc_AttributeError, "Attribute 'Wire' of object 'TopoShape' is read-only");
01012 return -1;
01013 }
01014
01015
01016
01017
01018 PyObject * TopoShapeFacePy::staticCallback_getCenterOfMass (PyObject *self, void * )
01019 {
01020 if (!((PyObjectBase*) self)->isValid()){
01021 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01022 return NULL;
01023 }
01024
01025 try {
01026 return Py::new_reference_to(((TopoShapeFacePy*)self)->getCenterOfMass());
01027 } catch (const Py::Exception&) {
01028
01029 return NULL;
01030 } catch (...) {
01031 PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'CenterOfMass' of object 'TopoShape'");
01032 return NULL;
01033 }
01034 }
01035
01036 int TopoShapeFacePy::staticCallback_setCenterOfMass (PyObject *self, PyObject * , void * )
01037 {
01038 if (!((PyObjectBase*) self)->isValid()){
01039 PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01040 return -1;
01041 }
01042
01043 PyErr_SetString(PyExc_AttributeError, "Attribute 'CenterOfMass' of object 'TopoShape' is read-only");
01044 return -1;
01045 }
01046
01047
01048
01049
01050
01051
01052 PyParentObject TopoShapeFacePy::Parents[] = { PARENTSPartTopoShapeFacePy };
01053
01054
01055
01056
01057 TopoShapeFacePy::TopoShapeFacePy(TopoShape *pcObject, PyTypeObject *T)
01058 : TopoShapePy(reinterpret_cast<TopoShapePy::PointerType>(pcObject), T)
01059 {
01060 }
01061
01062
01063
01064
01065
01066 TopoShapeFacePy::~TopoShapeFacePy()
01067 {
01068 }
01069
01070
01071
01072
01073 PyObject *TopoShapeFacePy::_repr(void)
01074 {
01075 return Py_BuildValue("s", representation().c_str());
01076 }
01077
01078
01079
01080
01081 PyObject *TopoShapeFacePy::_getattr(char *attr)
01082 {
01083 try {
01084
01085 PyObject *r = getCustomAttributes(attr);
01086 if(r) return r;
01087 }
01088 #ifndef DONT_CATCH_CXX_EXCEPTIONS
01089 catch(const Base::Exception& e)
01090 {
01091 std::string str;
01092 str += "FreeCAD exception thrown (";
01093 str += e.what();
01094 str += ")";
01095 e.ReportException();
01096 PyErr_SetString(PyExc_Exception,str.c_str());
01097 return NULL;
01098 }
01099 catch(const std::exception& e)
01100 {
01101 std::string str;
01102 str += "FC++ exception thrown (";
01103 str += e.what();
01104 str += ")";
01105 Base::Console().Error(str.c_str());
01106 PyErr_SetString(PyExc_Exception,str.c_str());
01107 return NULL;
01108 }
01109 catch(const Py::Exception&)
01110 {
01111
01112 return NULL;
01113 }
01114 catch(...)
01115 {
01116 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01117 return NULL;
01118 }
01119 #else // DONT_CATCH_CXX_EXCEPTIONS
01120 catch(const Base::Exception& e)
01121 {
01122 std::string str;
01123 str += "FreeCAD exception thrown (";
01124 str += e.what();
01125 str += ")";
01126 e.ReportException();
01127 PyErr_SetString(PyExc_Exception,str.c_str());
01128 return NULL;
01129 }
01130 catch(const Py::Exception&)
01131 {
01132
01133 return NULL;
01134 }
01135 #endif // DONT_CATCH_CXX_EXCEPTIONS
01136
01137 PyObject *rvalue = Py_FindMethod(Methods, this, attr);
01138 if (rvalue == NULL)
01139 {
01140 PyErr_Clear();
01141 return TopoShapePy::_getattr(attr);
01142 }
01143 else
01144 {
01145 return rvalue;
01146 }
01147 }
01148
01149 int TopoShapeFacePy::_setattr(char *attr, PyObject *value)
01150 {
01151 try {
01152
01153 int r = setCustomAttributes(attr, value);
01154 if(r==1) return 0;
01155 }
01156 #ifndef DONT_CATCH_CXX_EXCEPTIONS
01157 catch(const Base::Exception& e)
01158 {
01159 std::string str;
01160 str += "FreeCAD exception thrown (";
01161 str += e.what();
01162 str += ")";
01163 e.ReportException();
01164 PyErr_SetString(PyExc_Exception,str.c_str());
01165 return -1;
01166 }
01167 catch(const std::exception& e)
01168 {
01169 std::string str;
01170 str += "FC++ exception thrown (";
01171 str += e.what();
01172 str += ")";
01173 Base::Console().Error(str.c_str());
01174 PyErr_SetString(PyExc_Exception,str.c_str());
01175 return -1;
01176 }
01177 catch(const Py::Exception&)
01178 {
01179
01180 return -1;
01181 }
01182 catch(...)
01183 {
01184 PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01185 return -1;
01186 }
01187 #else // DONT_CATCH_CXX_EXCEPTIONS
01188 catch(const Base::Exception& e)
01189 {
01190 std::string str;
01191 str += "FreeCAD exception thrown (";
01192 str += e.what();
01193 str += ")";
01194 e.ReportException();
01195 PyErr_SetString(PyExc_Exception,str.c_str());
01196 return -1;
01197 }
01198 catch(const Py::Exception&)
01199 {
01200
01201 return -1;
01202 }
01203 #endif // DONT_CATCH_CXX_EXCEPTIONS
01204
01205 return TopoShapePy::_setattr(attr, value);
01206 }
01207
01208 TopoShape *TopoShapeFacePy::getTopoShapePtr(void) const
01209 {
01210 return static_cast<TopoShape *>(_pcTwinPointer);
01211 }
01212
01213 #if 0
01214
01215
01216
01217
01218 PyObject *TopoShapeFacePy::PyMake(struct _typeobject *, PyObject *, PyObject *)
01219 {
01220
01221 return new TopoShapeFacePy(new TopoShape);
01222 }
01223
01224
01225 int TopoShapeFacePy::PyInit(PyObject* , PyObject* )
01226 {
01227 return 0;
01228 }
01229
01230
01231 std::string TopoShapeFacePy::representation(void) const
01232 {
01233 return std::string("<TopoShape object>");
01234 }
01235
01236 PyObject* TopoShapeFacePy::makeOffset(PyObject *args)
01237 {
01238 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01239 return 0;
01240 }
01241
01242 PyObject* TopoShapeFacePy::tangentAt(PyObject *args)
01243 {
01244 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01245 return 0;
01246 }
01247
01248 PyObject* TopoShapeFacePy::valueAt(PyObject *args)
01249 {
01250 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01251 return 0;
01252 }
01253
01254 PyObject* TopoShapeFacePy::normalAt(PyObject *args)
01255 {
01256 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01257 return 0;
01258 }
01259
01260 PyObject* TopoShapeFacePy::derivative1At(PyObject *args)
01261 {
01262 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01263 return 0;
01264 }
01265
01266 PyObject* TopoShapeFacePy::derivative2At(PyObject *args)
01267 {
01268 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01269 return 0;
01270 }
01271
01272 PyObject* TopoShapeFacePy::curvatureAt(PyObject *args)
01273 {
01274 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01275 return 0;
01276 }
01277
01278 PyObject* TopoShapeFacePy::isPartOfDomain(PyObject *args)
01279 {
01280 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01281 return 0;
01282 }
01283
01284 PyObject* TopoShapeFacePy::makeHalfSpace(PyObject *args)
01285 {
01286 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01287 return 0;
01288 }
01289
01290 PyObject* TopoShapeFacePy::setTolerance(PyObject *args)
01291 {
01292 PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
01293 return 0;
01294 }
01295
01296
01297
01298 Py::Tuple TopoShapeFacePy::getParameterRange(void) const
01299 {
01300
01301 throw Py::AttributeError("Not yet implemented");
01302 }
01303
01304 Py::Object TopoShapeFacePy::getSurface(void) const
01305 {
01306
01307 throw Py::AttributeError("Not yet implemented");
01308 }
01309
01310 Py::Object TopoShapeFacePy::getWire(void) const
01311 {
01312
01313 throw Py::AttributeError("Not yet implemented");
01314 }
01315
01316 Py::Object TopoShapeFacePy::getCenterOfMass(void) const
01317 {
01318
01319 throw Py::AttributeError("Not yet implemented");
01320 }
01321
01322 PyObject *TopoShapeFacePy::getCustomAttributes(const char* attr) const
01323 {
01324 return 0;
01325 }
01326
01327 int TopoShapeFacePy::setCustomAttributes(const char* attr, PyObject *obj)
01328 {
01329 return 0;
01330 }
01331 #endif
01332
01333
01334