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