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