fixes #0001422: Subclass Exception

inherit Base.FreeCADError form RuntimeError
inherit Part.OCCError from Base.FreeCADError
inherit OCCDomainError from Part.OCCError
inherit OCCRangeError from Part.OCCError
inherit OCCConstructionError from OCCDomainError
inherit OCCDimensionError from OCCDomainError
Added PY_CATCH_OCC macro
replace PyExc_Exception
use FreeCADError in makeWireString
catch exception in BSplineCurve.increasedegree
This commit is contained in:
Sebastian Hoogen
2014-08-19 11:18:19 +02:00
committed by wmayer
parent 6cd1feb44f
commit af50cbf964
69 changed files with 749 additions and 501 deletions

View File

@@ -150,6 +150,7 @@ Base::ConsoleObserverStd *Application::_pConsoleObserverStd =0;
Base::ConsoleObserverFile *Application::_pConsoleObserverFile =0;
AppExport std::map<std::string,std::string> Application::mConfig;
BaseExport extern PyObject* Base::BaseExceptionFreeCADError;
//**************************************************************************
@@ -223,6 +224,11 @@ Application::Application(ParameterManager * /*pcSysParamMngr*/,
PyObject* pBaseModule = Py_InitModule3("__FreeCADBase__", NULL,
"The Base module contains the classes for the geometric basics\n"
"like vector, matrix, bounding box, placement, rotation, axis, ...");
Base::BaseExceptionFreeCADError = PyErr_NewException(
"Base.FreeCADError", PyExc_RuntimeError, NULL);
Py_INCREF(Base::BaseExceptionFreeCADError);
PyModule_AddObject(pBaseModule, "FreeCADError",
Base::BaseExceptionFreeCADError);
Base::Interpreter().addType(&Base::VectorPy ::Type,pBaseModule,"Vector");
Base::Interpreter().addType(&Base::MatrixPy ::Type,pBaseModule,"Matrix");
Base::Interpreter().addType(&Base::BoundBoxPy ::Type,pBaseModule,"BoundBox");

View File

@@ -220,7 +220,7 @@ PyObject* Application::sSetActiveDocument(PyObject * /*self*/, PyObject *args,Py
GetApplication().setActiveDocument(pstr);
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return NULL;
}

View File

@@ -63,21 +63,21 @@ PyObject* DocumentObjectGroupPy::addObject(PyObject *args)
DocumentObjectPy* docObj = static_cast<DocumentObjectPy*>(object);
if (!docObj->getDocumentObjectPtr() || !docObj->getDocumentObjectPtr()->getNameInDocument()) {
PyErr_SetString(PyExc_Exception, "Cannot add an invalid object");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot add an invalid object");
return NULL;
}
if (docObj->getDocumentObjectPtr()->getDocument() != getDocumentObjectGroupPtr()->getDocument()) {
PyErr_SetString(PyExc_Exception, "Cannot add an object from another document to this group");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot add an object from another document to this group");
return NULL;
}
if (docObj->getDocumentObjectPtr() == this->getDocumentObjectGroupPtr()) {
PyErr_SetString(PyExc_Exception, "Cannot add a group object to itself");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot add a group object to itself");
return NULL;
}
if (docObj->getDocumentObjectPtr()->getTypeId().isDerivedFrom(DocumentObjectGroup::getClassTypeId())) {
App::DocumentObjectGroup* docGrp = static_cast<DocumentObjectGroup*>(docObj->getDocumentObjectPtr());
if (this->getDocumentObjectGroupPtr()->isChildOf(docGrp)) {
PyErr_SetString(PyExc_Exception, "Cannot add a group object to a child group");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot add a group object to a child group");
return NULL;
}
}
@@ -111,11 +111,11 @@ PyObject* DocumentObjectGroupPy::removeObject(PyObject *args)
DocumentObjectPy* docObj = static_cast<DocumentObjectPy*>(object);
if (!docObj->getDocumentObjectPtr() || !docObj->getDocumentObjectPtr()->getNameInDocument()) {
PyErr_SetString(PyExc_Exception, "Cannot remove an invalid object");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot remove an invalid object");
return NULL;
}
if (docObj->getDocumentObjectPtr()->getDocument() != getDocumentObjectGroupPtr()->getDocument()) {
PyErr_SetString(PyExc_Exception, "Cannot remove an object from another document from this group");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot remove an object from another document from this group");
return NULL;
}
@@ -171,11 +171,11 @@ PyObject* DocumentObjectGroupPy::hasObject(PyObject *args)
DocumentObjectPy* docObj = static_cast<DocumentObjectPy*>(object);
if (!docObj->getDocumentObjectPtr() || !docObj->getDocumentObjectPtr()->getNameInDocument()) {
PyErr_SetString(PyExc_Exception, "Cannot check an invalid object");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check an invalid object");
return NULL;
}
if (docObj->getDocumentObjectPtr()->getDocument() != getDocumentObjectGroupPtr()->getDocument()) {
PyErr_SetString(PyExc_Exception, "Cannot check an object from another document with this group");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check an object from another document with this group");
return NULL;
}

View File

@@ -127,7 +127,7 @@ PyObject * FeaturePythonPyT<FeaturePyT>::staticCallback_addProperty (PyObject *s
str += e.what();
str += ")";
e.ReportException();
PyErr_SetString(PyExc_Exception,str.c_str());
PyErr_SetString(Base::BaseExceptionFreeCADError,str.c_str());
return NULL;
}
catch(const Py::Exception&) {
@@ -163,7 +163,7 @@ PyObject * FeaturePythonPyT<FeaturePyT>::staticCallback_removeProperty (PyObject
str += e.what();
str += ")";
e.ReportException();
PyErr_SetString(PyExc_Exception,str.c_str());
PyErr_SetString(Base::BaseExceptionFreeCADError,str.c_str());
return NULL;
}
catch(const Py::Exception&) {
@@ -199,7 +199,7 @@ PyObject * FeaturePythonPyT<FeaturePyT>::staticCallback_supportedProperties (PyO
str += e.what();
str += ")";
e.ReportException();
PyErr_SetString(PyExc_Exception,str.c_str());
PyErr_SetString(Base::BaseExceptionFreeCADError,str.c_str());
return NULL;
}
catch(const Py::Exception&) {
@@ -248,7 +248,7 @@ PyObject *FeaturePythonPyT<FeaturePyT>::_getattr(char *attr)
str += e.what();
str += ")";
e.ReportException();
PyErr_SetString(PyExc_Exception,str.c_str());
PyErr_SetString(Base::BaseExceptionFreeCADError,str.c_str());
return NULL;
}
catch(const Py::Exception&) {
@@ -288,7 +288,7 @@ int FeaturePythonPyT<FeaturePyT>::_setattr(char *attr, PyObject *value)
str += e.what();
str += ")";
e.ReportException();
PyErr_SetString(PyExc_Exception,str.c_str());
PyErr_SetString(Base::BaseExceptionFreeCADError,str.c_str());
return -1;
}
catch(const Py::Exception&) {

View File

@@ -78,7 +78,7 @@ int AxisPy::PyInit(PyObject* args, PyObject* /*kwd*/)
return 0;
}
PyErr_SetString(PyExc_Exception, "empty parameter list, axis or base and direction expected");
PyErr_SetString(Base::BaseExceptionFreeCADError, "empty parameter list, axis or base and direction expected");
return -1;
}

View File

@@ -196,7 +196,7 @@ PyObject* BoundBoxPy::getIntersectionPoint(PyObject *args)
return new VectorPy(point);
}
else {
PyErr_SetString(PyExc_Exception, "No intersection");
PyErr_SetString(Base::BaseExceptionFreeCADError, "No intersection");
return 0;
}
}

View File

@@ -85,7 +85,7 @@ int MatrixPy::PyInit(PyObject* args, PyObject* /*kwd*/)
return 0;
}
PyErr_SetString(PyExc_Exception, "matrix or up to 16 floats expected");
PyErr_SetString(Base::BaseExceptionFreeCADError, "matrix or up to 16 floats expected");
return -1;
}
@@ -331,7 +331,7 @@ PyObject* MatrixPy::multiply(PyObject * args)
return new VectorPy(new Vector3d(vec));
}
PyErr_SetString(PyExc_Exception, "either vector or matrix expected");
PyErr_SetString(Base::BaseExceptionFreeCADError, "either vector or matrix expected");
return 0;
}
@@ -344,7 +344,7 @@ PyObject* MatrixPy::invert(PyObject * args)
if (fabs(getMatrixPtr()->determinant()) > DBL_EPSILON)
getMatrixPtr()->inverseGauss();
else {
PyErr_SetString(PyExc_Exception, "Cannot invert singular matrix");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot invert singular matrix");
return 0;
}
}
@@ -365,7 +365,7 @@ PyObject* MatrixPy::inverse(PyObject * args)
return new MatrixPy(m);
}
else {
PyErr_SetString(PyExc_Exception, "Cannot invert singular matrix");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot invert singular matrix");
return 0;
}
}

View File

@@ -114,7 +114,7 @@ int PlacementPy::PyInit(PyObject* args, PyObject* /*kwd*/)
return 0;
}
PyErr_SetString(PyExc_Exception, "empty parameter list, matrix or placement expected");
PyErr_SetString(Base::BaseExceptionFreeCADError, "empty parameter list, matrix or placement expected");
return -1;
}

View File

@@ -33,6 +33,8 @@
using namespace Base;
PyObject* Base::BaseExceptionFreeCADError = 0;
// Constructor
PyObjectBase::PyObjectBase(void* p,PyTypeObject *T)
: _pcTwinPointer(p), parent(0), attribute(0)

View File

@@ -377,6 +377,9 @@ static PyObject * s##DFUNC (PyObject *self, PyObject *args, PyObject * /*kwd*/){
*/
#define PYMETHODEDEF(FUNC) {"" #FUNC "",(PyCFunction) s##FUNC,Py_NEWARGS},
BaseExport extern PyObject* BaseExceptionFreeCADError;
#define PY_FCERROR (Base::BaseExceptionFreeCADError ? \
BaseExceptionFreeCADError : PyExc_RuntimeError)
/** Exception handling for python callback functions
@@ -427,7 +430,7 @@ static PyObject * s##DFUNC (PyObject *self, PyObject *args, PyObject * /*kwd*/){
str += e.what(); \
str += ")"; \
e.ReportException(); \
Py_Error(PyExc_Exception,str.c_str()); \
Py_Error(Base::BaseExceptionFreeCADError,str.c_str()); \
} \
catch(std::exception &e) \
{ \
@@ -436,7 +439,7 @@ static PyObject * s##DFUNC (PyObject *self, PyObject *args, PyObject * /*kwd*/){
str += e.what(); \
str += ")"; \
Base::Console().Error(str.c_str()); \
Py_Error(PyExc_Exception,str.c_str()); \
Py_Error(Base::BaseExceptionFreeCADError,str.c_str()); \
} \
catch(const Py::Exception&) \
{ \
@@ -444,11 +447,11 @@ static PyObject * s##DFUNC (PyObject *self, PyObject *args, PyObject * /*kwd*/){
} \
catch(const char *e) \
{ \
Py_Error(PyExc_Exception,e); \
Py_Error(Base::BaseExceptionFreeCADError,e); \
} \
catch(...) \
{ \
Py_Error(PyExc_Exception,"Unknown C++ exception"); \
Py_Error(Base::BaseExceptionFreeCADError,"Unknown C++ exception"); \
}
#else
@@ -460,7 +463,7 @@ static PyObject * s##DFUNC (PyObject *self, PyObject *args, PyObject * /*kwd*/){
str += e.what(); \
str += ")"; \
e.ReportException(); \
Py_Error(PyExc_Exception,str.c_str()); \
Py_Error(Base::BaseExceptionFreeCADError,str.c_str()); \
} \
catch(std::exception &e) \
{ \
@@ -469,7 +472,7 @@ static PyObject * s##DFUNC (PyObject *self, PyObject *args, PyObject * /*kwd*/){
str += e.what(); \
str += ")"; \
Base::Console().Error(str.c_str()); \
Py_Error(PyExc_Exception,str.c_str()); \
Py_Error(Base::BaseExceptionFreeCADError,str.c_str()); \
} \
catch(const Py::Exception&) \
{ \
@@ -477,7 +480,7 @@ static PyObject * s##DFUNC (PyObject *self, PyObject *args, PyObject * /*kwd*/){
} \
catch(const char *e) \
{ \
Py_Error(PyExc_Exception,e); \
Py_Error(Base::BaseExceptionFreeCADError,e); \
}
#endif // DONT_CATCH_CXX_EXCEPTIONS

View File

@@ -334,7 +334,7 @@ PyObject* VectorPy::normalize(PyObject *args)
return 0;
VectorPy::PointerType ptr = reinterpret_cast<VectorPy::PointerType>(_pcTwinPointer);
if (ptr->Length() < 1.0e-6) {
PyErr_SetString(PyExc_Exception, "Cannot normalize null vector");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot normalize null vector");
return 0;
}

View File

@@ -380,7 +380,7 @@ PyObject* Application::sExport(PyObject * /*self*/, PyObject *args,PyObject * /*
Gui::Document* gui_doc = Application::Instance->getDocument(doc);
std::list<MDIView*> view3d = gui_doc->getMDIViewsOfType(View3DInventor::getClassTypeId());
if (view3d.empty()) {
PyErr_SetString(PyExc_Exception, "Cannot export to SVG because document doesn't have a 3d view");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot export to SVG because document doesn't have a 3d view");
return 0;
}
else {
@@ -535,7 +535,7 @@ PyObject* Application::sActivateWorkbenchHandler(PyObject * /*self*/, PyObject *
Instance->activateWorkbench(psKey);
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
catch (const XERCES_CPP_NAMESPACE_QUALIFIER TranscodingException& e) {
@@ -551,7 +551,7 @@ PyObject* Application::sActivateWorkbenchHandler(PyObject * /*self*/, PyObject *
return 0;
}
catch (...) {
PyErr_SetString(PyExc_Exception, "Unknown C++ exception raised in activateWorkbench");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Unknown C++ exception raised in activateWorkbench");
return 0;
}
@@ -763,7 +763,7 @@ PyObject* Application::sAddIcon(PyObject * /*self*/, PyObject *args,PyObject * /
}
if (icon.isNull()) {
PyErr_SetString(PyExc_Exception, "Invalid icon added to application");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Invalid icon added to application");
return NULL;
}
@@ -813,11 +813,11 @@ PyObject* Application::sAddCommand(PyObject * /*self*/, PyObject *args,PyObject
Application::Instance->commandManager().addCommand(new PythonCommand(pName,pcCmdObj,pSource));
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
catch (...) {
PyErr_SetString(PyExc_Exception, "Unknown C++ exception raised in Application::sAddCommand()");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Unknown C++ exception raised in Application::sAddCommand()");
return 0;
}
#endif

View File

@@ -1048,7 +1048,7 @@ PyObject *SelectionSingleton::sAddSelection(PyObject * /*self*/, PyObject *args,
App::DocumentObjectPy* docObjPy = static_cast<App::DocumentObjectPy*>(object);
App::DocumentObject* docObj = docObjPy->getDocumentObjectPtr();
if (!docObj || !docObj->getNameInDocument()) {
PyErr_SetString(PyExc_Exception, "Cannot check invalid object");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check invalid object");
return NULL;
}
@@ -1069,7 +1069,7 @@ PyObject *SelectionSingleton::sRemoveSelection(PyObject * /*self*/, PyObject *ar
App::DocumentObjectPy* docObjPy = static_cast<App::DocumentObjectPy*>(object);
App::DocumentObject* docObj = docObjPy->getDocumentObjectPtr();
if (!docObj || !docObj->getNameInDocument()) {
PyErr_SetString(PyExc_Exception, "Cannot check invalid object");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check invalid object");
return NULL;
}
@@ -1187,7 +1187,7 @@ PyObject *SelectionSingleton::sGetSelectionObject(PyObject * /*self*/, PyObject
return 0;
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
}

View File

@@ -150,7 +150,7 @@ PyObject* ViewProviderPy::setTransformation(PyObject *args)
Py_Return;
}
PyErr_SetString(PyExc_Exception, "Either set matrix or placement to set transformation");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Either set matrix or placement to set transformation");
return 0;
}

View File

@@ -182,7 +182,7 @@ FreeCADGui_embedToWindow(PyObject * /*self*/, PyObject *args)
QWidget* widget = Gui::getMainWindow();
if (!widget) {
PyErr_SetString(PyExc_Exception, "No main window");
PyErr_SetString(Base::BaseExceptionFreeCADError, "No main window");
return 0;
}

View File

@@ -32,6 +32,7 @@
#include <Base/VectorPy.h>
#include <boost/regex.hpp>
#include <Mod/Part/App/OCCError.h>
using namespace Drawing;
using namespace Part;
@@ -62,7 +63,7 @@ project(PyObject *self, PyObject *args)
return Py::new_reference_to(list);
} PY_CATCH;
} PY_CATCH_OCC;
}
@@ -97,7 +98,7 @@ projectEx(PyObject *self, PyObject *args)
return Py::new_reference_to(list);
} PY_CATCH;
} PY_CATCH_OCC;
}
static PyObject *
@@ -127,7 +128,7 @@ projectToSVG(PyObject *self, PyObject *args)
Py::String result(Alg.getSVG(hidden?ProjectionAlgos::WithHidden:ProjectionAlgos::Plain, scale, tol));
return Py::new_reference_to(result);
} PY_CATCH;
} PY_CATCH_OCC;
}
static PyObject *
@@ -157,7 +158,7 @@ projectToDXF(PyObject *self, PyObject *args)
Py::String result(Alg.getDXF(hidden?ProjectionAlgos::WithHidden:ProjectionAlgos::Plain, scale, tol));
return Py::new_reference_to(result);
} PY_CATCH;
} PY_CATCH_OCC;
}
static PyObject *
@@ -195,7 +196,7 @@ removeSvgTags(PyObject *self, PyObject *args)
svg = boost::regex_replace(svg, e7, linebreak);
Py::String result(svg);
return Py::new_reference_to(result);
} PY_CATCH;
} PY_CATCH_OCC;
}

View File

@@ -68,7 +68,7 @@ open(PyObject *self, PyObject *args)
Gui::getMainWindow()->addWindow(view);
}
else {
PyErr_SetString(PyExc_Exception, "unknown filetype");
PyErr_SetString(Base::BaseExceptionFreeCADError, "unknown filetype");
return NULL;
}
} PY_CATCH;
@@ -98,7 +98,7 @@ importer(PyObject *self, PyObject *args)
view->resize( 400, 300 );
Gui::getMainWindow()->addWindow(view);
} else {
PyErr_SetString(PyExc_Exception, "unknown filetype");
PyErr_SetString(Base::BaseExceptionFreeCADError, "unknown filetype");
return NULL;
}
} PY_CATCH;
@@ -153,7 +153,7 @@ exporter(PyObject *self, PyObject *args)
std::string viewName = view->Label.getValue();
App::DocumentObject* link = view->Source.getValue();
if (!link) {
PyErr_SetString(PyExc_Exception, "No object linked");
PyErr_SetString(Base::BaseExceptionFreeCADError, "No object linked");
return 0;
}
if (!link->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {

View File

@@ -85,7 +85,7 @@ static PyObject * read(PyObject *self, PyObject *args)
return new FemMeshPy(mesh.release());
}
catch(...) {
PyErr_SetString(PyExc_Exception, "Loading of mesh was aborted");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Loading of mesh was aborted");
return NULL;
}
} PY_CATCH;

View File

@@ -84,11 +84,11 @@ int FemMeshPy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
}
catch (const Base::Exception &e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError,e.what());
return -1;
}
catch (const std::exception &e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError,e.what());
return -1;
}
catch (const Py::Exception&) {
@@ -112,7 +112,7 @@ PyObject* FemMeshPy::setShape(PyObject *args)
getFemMeshPtr()->getSMesh()->ShapeToMesh(shape);
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
Py_Return;
@@ -143,7 +143,7 @@ PyObject* FemMeshPy::addHypothesis(PyObject *args)
return 0;
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
Py_Return;
@@ -158,7 +158,7 @@ PyObject* FemMeshPy::setStanardHypotheses(PyObject *args)
getFemMeshPtr()->setStanardHypotheses();
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
Py_Return;
@@ -173,7 +173,7 @@ PyObject* FemMeshPy::compute(PyObject *args)
getFemMeshPtr()->compute();
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
Py_Return;
@@ -193,7 +193,7 @@ PyObject* FemMeshPy::addNode(PyObject *args)
return Py::new_reference_to(Py::Int(node->GetID()));
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
}
@@ -209,7 +209,7 @@ PyObject* FemMeshPy::addNode(PyObject *args)
return Py::new_reference_to(Py::Int(node->GetID()));
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
}
@@ -239,7 +239,7 @@ PyObject* FemMeshPy::addEdge(PyObject *args)
return Py::new_reference_to(Py::Int(edge->GetID()));
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
}
@@ -265,7 +265,7 @@ PyObject* FemMeshPy::addFace(PyObject *args)
return Py::new_reference_to(Py::Int(face->GetID()));
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
}
@@ -330,7 +330,7 @@ PyObject* FemMeshPy::addQuad(PyObject *args)
return Py::new_reference_to(Py::Int(face->GetID()));
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
}
@@ -356,7 +356,7 @@ PyObject* FemMeshPy::addVolume(PyObject *args)
return Py::new_reference_to(Py::Int(vol->GetID()));
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
}
@@ -452,7 +452,7 @@ PyObject* FemMeshPy::read(PyObject *args)
getFemMeshPtr()->read(filename);
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
Py_Return;
@@ -468,7 +468,7 @@ PyObject* FemMeshPy::write(PyObject *args)
getFemMeshPtr()->write(filename);
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
Py_Return;
@@ -484,7 +484,7 @@ PyObject* FemMeshPy::writeABAQUS(PyObject *args)
getFemMeshPtr()->writeABAQUS(filename);
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
Py_Return;
@@ -502,7 +502,7 @@ PyObject* FemMeshPy::setTransform(PyObject *args)
getFemMeshPtr()->transformGeometry(mat);
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
Py_Return;
@@ -522,7 +522,7 @@ PyObject* FemMeshPy::getNodeById(PyObject *args)
vec = Mtrx * vec;
return new Base::VectorPy( vec );
}else{
PyErr_SetString(PyExc_Exception, "No valid ID");
PyErr_SetString(Base::BaseExceptionFreeCADError, "No valid ID");
return 0;
}
}
@@ -537,7 +537,7 @@ PyObject* FemMeshPy::getNodesByFace(PyObject *args)
const TopoDS_Shape& sh = static_cast<Part::TopoShapeFacePy*>(pW)->getTopoShapePtr()->_Shape;
const TopoDS_Face& fc = TopoDS::Face(sh);
if (sh.IsNull()) {
PyErr_SetString(PyExc_Exception, "Face is empty");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Face is empty");
return 0;
}
Py::List ret;
@@ -550,7 +550,7 @@ PyObject* FemMeshPy::getNodesByFace(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
return 0;
}

View File

@@ -47,7 +47,7 @@ static PyObject * setActiveAnalysis(PyObject *self, PyObject *args)
if (PyArg_ParseTuple(args,"|O!",&(App::DocumentObjectPy::Type), &object)&& object) {
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(object)->getDocumentObjectPtr();
if (!obj || !obj->getTypeId().isDerivedFrom(Fem::FemAnalysis::getClassTypeId())){
PyErr_SetString(PyExc_Exception, "Active Analysis object have to be of type Fem::FemAnalysis!");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Active Analysis object have to be of type Fem::FemAnalysis!");
return 0;
}

View File

@@ -138,7 +138,7 @@ PyObject* ViewProviderFemMeshPy::setNodeColorByResult(PyObject *args)
}else{
PyErr_SetString(PyExc_Exception, "Argument has to be a ResultValue or ResultVector!");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Argument has to be a ResultValue or ResultVector!");
return 0;
}
}
@@ -166,7 +166,7 @@ PyObject* ViewProviderFemMeshPy::setNodeDisplacementByResult(PyObject *args)
}else{
PyErr_SetString(PyExc_Exception, "Argument has to be a ResultVector!");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Argument has to be a ResultVector!");
return 0;
}
}

View File

@@ -91,7 +91,7 @@ static PyObject * importer(PyObject *self, PyObject *args)
aReader.SetNameMode(true);
aReader.SetLayerMode(true);
if (aReader.ReadFile((Standard_CString)Name) != IFSelect_RetDone) {
PyErr_SetString(PyExc_Exception, "cannot read STEP file");
PyErr_SetString(Base::BaseExceptionFreeCADError, "cannot read STEP file");
return 0;
}
@@ -120,7 +120,7 @@ static PyObject * importer(PyObject *self, PyObject *args)
aReader.SetNameMode(true);
aReader.SetLayerMode(true);
if (aReader.ReadFile((Standard_CString)Name) != IFSelect_RetDone) {
PyErr_SetString(PyExc_Exception, "cannot read IGES file");
PyErr_SetString(Base::BaseExceptionFreeCADError, "cannot read IGES file");
return 0;
}
@@ -141,7 +141,7 @@ static PyObject * importer(PyObject *self, PyObject *args)
}
}
else {
PyErr_SetString(PyExc_Exception, "no supported file format");
PyErr_SetString(Base::BaseExceptionFreeCADError, "no supported file format");
return 0;
}
@@ -157,7 +157,7 @@ static PyObject * importer(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
return 0;
}
PY_CATCH
@@ -252,7 +252,7 @@ static PyObject * exporter(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
return 0;
}
PY_CATCH

View File

@@ -133,7 +133,7 @@ static PyObject * importer(PyObject *self, PyObject *args)
aReader.SetLayerMode(true);
QString fn = QString::fromUtf8(Name);
if (aReader.ReadFile((const char*)fn.toLocal8Bit()) != IFSelect_RetDone) {
PyErr_SetString(PyExc_Exception, "cannot read STEP file");
PyErr_SetString(Base::BaseExceptionFreeCADError, "cannot read STEP file");
return 0;
}
@@ -163,7 +163,7 @@ static PyObject * importer(PyObject *self, PyObject *args)
aReader.SetLayerMode(true);
QString fn = QString::fromUtf8(Name);
if (aReader.ReadFile((const char*)fn.toLocal8Bit()) != IFSelect_RetDone) {
PyErr_SetString(PyExc_Exception, "cannot read IGES file");
PyErr_SetString(Base::BaseExceptionFreeCADError, "cannot read IGES file");
return 0;
}
@@ -184,7 +184,7 @@ static PyObject * importer(PyObject *self, PyObject *args)
}
}
else {
PyErr_SetString(PyExc_Exception, "no supported file format");
PyErr_SetString(Base::BaseExceptionFreeCADError, "no supported file format");
return 0;
}
@@ -194,7 +194,7 @@ static PyObject * importer(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
return 0;
}
PY_CATCH
@@ -280,7 +280,7 @@ static PyObject * exporter(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
return 0;
}
PY_CATCH
@@ -486,7 +486,7 @@ static PyObject * ocaf(PyObject *self, PyObject *args)
aReader.SetNameMode(true);
aReader.SetLayerMode(true);
if (aReader.ReadFile((Standard_CString)Name) != IFSelect_RetDone) {
PyErr_SetString(PyExc_Exception, "cannot read STEP file");
PyErr_SetString(Base::BaseExceptionFreeCADError, "cannot read STEP file");
return 0;
}
@@ -505,7 +505,7 @@ static PyObject * ocaf(PyObject *self, PyObject *args)
aReader.SetNameMode(true);
aReader.SetLayerMode(true);
if (aReader.ReadFile((Standard_CString)Name) != IFSelect_RetDone) {
PyErr_SetString(PyExc_Exception, "cannot read IGES file");
PyErr_SetString(Base::BaseExceptionFreeCADError, "cannot read IGES file");
return 0;
}
@@ -517,7 +517,7 @@ static PyObject * ocaf(PyObject *self, PyObject *args)
pi->EndScope();
}
else {
PyErr_SetString(PyExc_Exception, "no supported file format");
PyErr_SetString(Base::BaseExceptionFreeCADError, "no supported file format");
return 0;
}
@@ -548,7 +548,7 @@ static PyObject * ocaf(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
return 0;
}
PY_CATCH

View File

@@ -62,7 +62,7 @@ static PyObject * read(PyObject *self, PyObject *args)
return new MeshPy(mesh.release());
}
else {
PyErr_SetString(PyExc_Exception, "Loading of mesh was aborted");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Loading of mesh was aborted");
return NULL;
}
} PY_CATCH;
@@ -267,7 +267,7 @@ createSphere(PyObject *self, PyObject *args)
PY_TRY {
MeshObject* mesh = MeshObject::createSphere(radius, sampling);
if (!mesh) {
PyErr_SetString(PyExc_Exception, "Creation of sphere failed");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Creation of sphere failed");
return NULL;
}
return new MeshPy(mesh);
@@ -286,7 +286,7 @@ createEllipsoid(PyObject *self, PyObject *args)
PY_TRY {
MeshObject* mesh = MeshObject::createEllipsoid(radius1, radius2, sampling);
if (!mesh) {
PyErr_SetString(PyExc_Exception, "Creation of ellipsoid failed");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Creation of ellipsoid failed");
return NULL;
}
return new MeshPy(mesh);
@@ -307,7 +307,7 @@ createCylinder(PyObject *self, PyObject *args)
PY_TRY {
MeshObject* mesh = MeshObject::createCylinder(radius, length, closed, edgelen, sampling);
if (!mesh) {
PyErr_SetString(PyExc_Exception, "Creation of cylinder failed");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Creation of cylinder failed");
return NULL;
}
return new MeshPy(mesh);
@@ -329,7 +329,7 @@ createCone(PyObject *self, PyObject *args)
PY_TRY {
MeshObject* mesh = MeshObject::createCone(radius1, radius2, len, closed, edgelen, sampling);
if (!mesh) {
PyErr_SetString(PyExc_Exception, "Creation of cone failed");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Creation of cone failed");
return NULL;
}
return new MeshPy(mesh);
@@ -348,7 +348,7 @@ createTorus(PyObject *self, PyObject *args)
PY_TRY {
MeshObject* mesh = MeshObject::createTorus(radius1, radius2, sampling);
if (!mesh) {
PyErr_SetString(PyExc_Exception, "Creation of torus failed");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Creation of torus failed");
return NULL;
}
return new MeshPy(mesh);
@@ -373,7 +373,7 @@ createBox(PyObject *self, PyObject *args)
mesh = MeshObject::createCube(length, width, height, edgelen);
if (!mesh) {
PyErr_SetString(PyExc_Exception, "Creation of box failed");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Creation of box failed");
return NULL;
}
return new MeshPy(mesh);
@@ -389,7 +389,7 @@ calculateEigenTransform(PyObject *self, PyObject *args)
return NULL;
if(! PySequence_Check(input) ){
PyErr_SetString(PyExc_Exception, "Input have to be a sequence of Base.Vector()");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Input have to be a sequence of Base.Vector()");
return NULL;
}

View File

@@ -168,7 +168,7 @@ PyObject* MeshFeaturePy::fixSelfIntersections(PyObject *args)
obj->Mesh.finishEditing();
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return NULL;
}
Py_Return;
@@ -185,7 +185,7 @@ PyObject* MeshFeaturePy::removeFoldsOnSurface(PyObject *args)
obj->Mesh.finishEditing();
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return NULL;
}
Py_Return;

View File

@@ -77,7 +77,7 @@ PyObject* MeshPointPy::unbound(PyObject *args)
PyObject* MeshPointPy::move(PyObject *args)
{
if (!getMeshPointPtr()->isBound())
PyErr_SetString(PyExc_Exception, "This object is not bounded to a mesh, so no topological operation is possible!");
PyErr_SetString(Base::BaseExceptionFreeCADError, "This object is not bounded to a mesh, so no topological operation is possible!");
double x=0.0,y=0.0,z=0.0;
PyObject *object;
@@ -111,7 +111,7 @@ Py::Boolean MeshPointPy::getBound(void) const
Py::Object MeshPointPy::getNormal(void) const
{
if (!getMeshPointPtr()->isBound())
PyErr_SetString(PyExc_Exception, "This object is not bounded to a mesh, so no topological operation is possible!");
PyErr_SetString(Base::BaseExceptionFreeCADError, "This object is not bounded to a mesh, so no topological operation is possible!");
Base::Vector3d* v = new Base::Vector3d(getMeshPointPtr()->Mesh->getPointNormal(getMeshPointPtr()->Index));
Base::VectorPy* normal = new Base::VectorPy(v);

View File

@@ -91,11 +91,11 @@ int MeshPy::PyInit(PyObject* args, PyObject*)
}
}
catch (const Base::Exception &e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError,e.what());
return -1;
}
catch (const std::exception &e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError,e.what());
return -1;
}
catch (const Py::Exception&) {
@@ -491,7 +491,7 @@ PyObject* MeshPy::addFacet(PyObject *args)
Py_Return;
}
PyErr_SetString(PyExc_Exception, "set 9 floats or three vectors");
PyErr_SetString(Base::BaseExceptionFreeCADError, "set 9 floats or three vectors");
return 0;
}
@@ -538,7 +538,7 @@ PyObject* MeshPy::addFacets(PyObject *args)
}
}
else {
PyErr_SetString(PyExc_Exception, "expect a sequence of floats or Vector");
PyErr_SetString(Base::BaseExceptionFreeCADError, "expect a sequence of floats or Vector");
return NULL;
}
@@ -593,7 +593,7 @@ PyObject* MeshPy::addFacets(PyObject *args)
Py_Return;
}
PyErr_SetString(PyExc_Exception, "either expect\n"
PyErr_SetString(Base::BaseExceptionFreeCADError, "either expect\n"
"-- [Vector] (3 of them define a facet)\n"
"-- ([Vector],[(int,int,int)])");
return NULL;
@@ -813,7 +813,7 @@ PyObject* MeshPy::fixSelfIntersections(PyObject *args)
getMeshObjectPtr()->removeSelfIntersections();
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return NULL;
}
Py_Return;
@@ -827,7 +827,7 @@ PyObject* MeshPy::removeFoldsOnSurface(PyObject *args)
getMeshObjectPtr()->removeFoldsOnSurface();
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return NULL;
}
Py_Return;
@@ -921,7 +921,7 @@ PyObject* MeshPy::fillupHoles(PyObject *args)
getMeshObjectPtr()->fillupHoles(len, level, *tria);
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return NULL;
}

View File

@@ -127,7 +127,7 @@ wireFromSegment(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
return 0;
}
@@ -248,11 +248,11 @@ meshFromShape(PyObject *self, PyObject *args, PyObject* kwds)
}
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
PyErr_SetString(PyExc_Exception,"Wrong arguments");
PyErr_SetString(Base::BaseExceptionFreeCADError,"Wrong arguments");
return 0;
}

View File

@@ -25,6 +25,7 @@
#include <App/Application.h>
#include "OCCError.h"
#include "TopoShape.h"
#include "FeaturePartBox.h"
#include "FeaturePartBoolean.h"
@@ -86,6 +87,12 @@
#include "PropertyGeometryList.h"
extern struct PyMethodDef Part_methods[];
using namespace Part;
PyObject* Part::PartExceptionOCCError;
PyObject* Part::PartExceptionOCCDomainError;
PyObject* Part::PartExceptionOCCRangeError;
PyObject* Part::PartExceptionOCCConstructionError;
PyObject* Part::PartExceptionOCCDimensionError;
PyDoc_STRVAR(module_part_doc,
"This is a module working with shapes.");
@@ -112,6 +119,39 @@ void PartExport initPart()
PyObject* partModule = Py_InitModule3("Part", Part_methods, module_part_doc); /* mod name, table ptr */
Base::Console().Log("Loading Part module... done\n");
PyObject* OCCError = 0;
if (PyObject_IsSubclass(Base::BaseExceptionFreeCADError,
PyExc_RuntimeError)) {
OCCError = PyErr_NewException("Part.OCCError",
Base::BaseExceptionFreeCADError, NULL);
}
else {
Base::Console().Error("Can not inherit Part.OCCError form BaseFreeCADError.\n");
PyObject* OCCError = PyErr_NewException("Part.OCCError",
PyExc_RuntimeError, NULL);
}
Py_INCREF(OCCError);
PyModule_AddObject(partModule, "OCCError", OCCError);
PartExceptionOCCError = OCCError; //set global variable ;(
PartExceptionOCCDomainError = PyErr_NewException("Part.OCCDomainError",
PartExceptionOCCError, NULL);
Py_INCREF(PartExceptionOCCDomainError);
PyModule_AddObject(partModule, "OCCDomainError",
PartExceptionOCCDomainError);
PartExceptionOCCRangeError = PyErr_NewException("Part.OCCRangeError",
PartExceptionOCCDomainError, NULL);
Py_INCREF(PartExceptionOCCRangeError);
PyModule_AddObject(partModule, "OCCRangeError", PartExceptionOCCRangeError);
PartExceptionOCCConstructionError = PyErr_NewException(
"Part.OCCConstructionError", PartExceptionOCCDomainError, NULL);
Py_INCREF(PartExceptionOCCConstructionError);
PyModule_AddObject(partModule, "OCCConstructionError",
PartExceptionOCCConstructionError);
PartExceptionOCCDimensionError = PyErr_NewException(
"Part.OCCDimensionError", PartExceptionOCCDomainError, NULL);
Py_INCREF(PartExceptionOCCConstructionError);
PyModule_AddObject(partModule, "OCCDimensionError",
PartExceptionOCCDimensionError);
// Add Types to module
Base::Interpreter().addType(&Part::TopoShapePy ::Type,partModule,"Shape");

View File

@@ -99,6 +99,7 @@
#include <App/Document.h>
#include <App/DocumentObjectPy.h>
#include "OCCError.h"
#include "TopoShape.h"
#include "TopoShapePy.h"
#include "TopoShapeEdgePy.h"
@@ -188,7 +189,7 @@ static PyObject * open(PyObject *self, PyObject *args)
Py_Error(PyExc_Exception, e.what());
}
}
} PY_CATCH;
} PY_CATCH_OCC;
Py_Return;
}
@@ -243,7 +244,7 @@ static PyObject * insert(PyObject *self, PyObject *args)
Py_Error(PyExc_Exception, e.what());
}
}
} PY_CATCH;
} PY_CATCH_OCC;
Py_Return;
}
@@ -281,7 +282,7 @@ static PyObject * exporter(PyObject *self, PyObject *args)
TopoShape shape(comp);
shape.write(filename);
} PY_CATCH;
} PY_CATCH_OCC;
Py_Return;
}
@@ -296,7 +297,7 @@ static PyObject * read(PyObject *self, PyObject *args)
TopoShape* shape = new TopoShape();
shape->read(Name);
return new TopoShapePy(shape);
} PY_CATCH;
} PY_CATCH_OCC;
}
static PyObject *
@@ -316,7 +317,7 @@ show(PyObject *self, PyObject *args)
//TopoShape* shape = new MeshObject(*pShape->getTopoShapeObjectPtr());
pcFeature->Shape.setValue(pShape->getTopoShapePtr()->_Shape);
pcDoc->recompute();
} PY_CATCH;
} PY_CATCH_OCC;
Py_Return;
}
@@ -382,11 +383,11 @@ static PyObject * makeWireString(PyObject *self, PyObject *args)
CharList = FT2FC(unichars,pysize,dir,fontfile,height,track); }
}
catch (Standard_DomainError) { // Standard_DomainError is OCC error.
PyErr_SetString(PyExc_Exception, "makeWireString failed - Standard_DomainError");
PyErr_SetString(PartExceptionOCCDomainError, "makeWireString failed - Standard_DomainError");
return NULL;
}
catch (std::runtime_error& e) { // FT2 or FT2FC errors
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return NULL;
}
@@ -396,7 +397,7 @@ static PyObject * makeWireString(PyObject *self, PyObject *args)
static PyObject * makeWireString(PyObject *self, PyObject *args)
{
PyErr_SetString(PyExc_Exception, "FreeCAD compiled without FreeType support! This method is disabled...");
PyErr_SetString(Base::BaseExceptionFreeCADError, "FreeCAD compiled without FreeType support! This method is disabled...");
return NULL;
}
@@ -426,12 +427,12 @@ makeCompound(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
return new TopoShapeCompoundPy(new TopoShape(Comp));
} PY_CATCH;
} PY_CATCH_OCC;
}
static PyObject * makeFilledFace(PyObject *self, PyObject *args)
@@ -482,7 +483,7 @@ static PyObject * makeFilledFace(PyObject *self, PyObject *args)
}
if (numConstraints == 0) {
PyErr_SetString(PyExc_Exception, "Failed to created face with no constraints");
PyErr_SetString(PartExceptionOCCError, "Failed to created face with no constraints");
return 0;
}
@@ -491,16 +492,16 @@ static PyObject * makeFilledFace(PyObject *self, PyObject *args)
return new TopoShapeFacePy(new TopoShape(builder.Face()));
}
else {
PyErr_SetString(PyExc_Exception, "Failed to created face by filling edges");
PyErr_SetString(PartExceptionOCCError, "Failed to created face by filling edges");
return 0;
}
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
} PY_CATCH;
} PY_CATCH_OCC;
}
static PyObject * makeShell(PyObject *self, PyObject *args)
@@ -536,12 +537,12 @@ static PyObject * makeShell(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
return new TopoShapeShellPy(new TopoShape(shape));
} PY_CATCH;
} PY_CATCH_OCC;
}
static PyObject * makeSolid(PyObject *self, PyObject *args)
@@ -569,7 +570,7 @@ static PyObject * makeSolid(PyObject *self, PyObject *args)
return new TopoShapeSolidPy(new TopoShape(solid));
}
catch (Standard_Failure) {
PyErr_SetString(PyExc_Exception, "creation of solid failed");
PyErr_SetString(PartExceptionOCCError, "creation of solid failed");
return NULL;
}
}
@@ -585,11 +586,11 @@ static PyObject * makePlane(PyObject *self, PyObject *args)
return NULL;
if (length < Precision::Confusion()) {
PyErr_SetString(PyExc_Exception, "length of plane too small");
PyErr_SetString(PartExceptionOCCError, "length of plane too small");
return NULL;
}
if (width < Precision::Confusion()) {
PyErr_SetString(PyExc_Exception, "width of plane too small");
PyErr_SetString(PartExceptionOCCError, "width of plane too small");
return NULL;
}
@@ -623,11 +624,11 @@ static PyObject * makePlane(PyObject *self, PyObject *args)
return new TopoShapeFacePy(new TopoShape((Face.Face())));
}
catch (Standard_DomainError) {
PyErr_SetString(PyExc_Exception, "creation of plane failed");
PyErr_SetString(PartExceptionOCCDomainError, "creation of plane failed");
return NULL;
}
catch (Standard_Failure) {
PyErr_SetString(PyExc_Exception, "creation of plane failed");
PyErr_SetString(PartExceptionOCCError, "creation of plane failed");
return NULL;
}
}
@@ -642,15 +643,15 @@ static PyObject * makeBox(PyObject *self, PyObject *args)
return NULL;
if (length < Precision::Confusion()) {
PyErr_SetString(PyExc_Exception, "length of box too small");
PyErr_SetString(PartExceptionOCCError, "length of box too small");
return NULL;
}
if (width < Precision::Confusion()) {
PyErr_SetString(PyExc_Exception, "width of box too small");
PyErr_SetString(PartExceptionOCCError, "width of box too small");
return NULL;
}
if (height < Precision::Confusion()) {
PyErr_SetString(PyExc_Exception, "height of box too small");
PyErr_SetString(PartExceptionOCCError, "height of box too small");
return NULL;
}
@@ -670,7 +671,7 @@ static PyObject * makeBox(PyObject *self, PyObject *args)
return new TopoShapeSolidPy(new TopoShape(ResultShape));
}
catch (Standard_DomainError) {
PyErr_SetString(PyExc_Exception, "creation of box failed");
PyErr_SetString(PartExceptionOCCDomainError, "creation of box failed");
return NULL;
}
}
@@ -690,23 +691,23 @@ static PyObject * makeWedge(PyObject *self, PyObject *args)
double dz2 = z2max-z2min;
double dx2 = x2max-x2min;
if (dx < Precision::Confusion()) {
PyErr_SetString(PyExc_Exception, "delta x of wedge too small");
PyErr_SetString(PartExceptionOCCError, "delta x of wedge too small");
return NULL;
}
if (dy < Precision::Confusion()) {
PyErr_SetString(PyExc_Exception, "delta y of wedge too small");
PyErr_SetString(PartExceptionOCCError, "delta y of wedge too small");
return NULL;
}
if (dz < Precision::Confusion()) {
PyErr_SetString(PyExc_Exception, "delta z of wedge too small");
PyErr_SetString(PartExceptionOCCError, "delta z of wedge too small");
return NULL;
}
if (dz2 < 0) {
PyErr_SetString(PyExc_Exception, "delta z2 of wedge is negative");
PyErr_SetString(PartExceptionOCCError, "delta z2 of wedge is negative");
return NULL;
}
if (dx2 < 0) {
PyErr_SetString(PyExc_Exception, "delta x2 of wedge is negative");
PyErr_SetString(PartExceptionOCCError, "delta x2 of wedge is negative");
return NULL;
}
@@ -727,7 +728,7 @@ static PyObject * makeWedge(PyObject *self, PyObject *args)
return new TopoShapeSolidPy(new TopoShape(mkSolid.Solid()));
}
catch (Standard_DomainError) {
PyErr_SetString(PyExc_Exception, "creation of wedge failed");
PyErr_SetString(PartExceptionOCCDomainError, "creation of wedge failed");
return NULL;
}
}
@@ -764,7 +765,7 @@ static PyObject * makeCircle(PyObject *self, PyObject *args)
return new TopoShapeEdgePy(new TopoShape(edge));
}
catch (Standard_Failure) {
PyErr_SetString(PyExc_Exception, "creation of circle failed");
PyErr_SetString(PartExceptionOCCError, "creation of circle failed");
return NULL;
}
}
@@ -795,7 +796,7 @@ static PyObject * makeSphere(PyObject *self, PyObject *args)
return new TopoShapeSolidPy(new TopoShape(shape));
}
catch (Standard_DomainError) {
PyErr_SetString(PyExc_Exception, "creation of sphere failed");
PyErr_SetString(PartExceptionOCCDomainError, "creation of sphere failed");
return NULL;
}
}
@@ -826,7 +827,7 @@ static PyObject * makeCylinder(PyObject *self, PyObject *args)
return new TopoShapeSolidPy(new TopoShape(shape));
}
catch (Standard_DomainError) {
PyErr_SetString(PyExc_Exception, "creation of cylinder failed");
PyErr_SetString(PartExceptionOCCDomainError, "creation of cylinder failed");
return NULL;
}
}
@@ -857,7 +858,7 @@ static PyObject * makeCone(PyObject *self, PyObject *args)
return new TopoShapeSolidPy(new TopoShape(shape));
}
catch (Standard_DomainError) {
PyErr_SetString(PyExc_Exception, "creation of cone failed");
PyErr_SetString(PartExceptionOCCDomainError, "creation of cone failed");
return NULL;
}
}
@@ -888,7 +889,7 @@ static PyObject * makeTorus(PyObject *self, PyObject *args)
return new TopoShapeSolidPy(new TopoShape(shape));
}
catch (Standard_DomainError) {
PyErr_SetString(PyExc_Exception, "creation of torus failed");
PyErr_SetString(PartExceptionOCCDomainError, "creation of torus failed");
return NULL;
}
}
@@ -913,7 +914,7 @@ static PyObject * makeHelix(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -936,7 +937,7 @@ static PyObject * makeLongHelix(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -954,7 +955,7 @@ static PyObject * makeThread(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1027,7 +1028,7 @@ static PyObject * makeLine(PyObject *self, PyObject *args)
}
// Error
if (error) {
PyErr_SetString(PyExc_RuntimeError, error);
PyErr_SetString(PartExceptionOCCError, error);
return NULL;
}
@@ -1076,10 +1077,10 @@ static PyObject * makePolygon(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
} PY_CATCH;
} PY_CATCH_OCC;
}
static PyObject * makeRevolution(PyObject *self, PyObject *args)
@@ -1117,12 +1118,12 @@ static PyObject * makeRevolution(PyObject *self, PyObject *args)
}
const TopoDS_Shape& shape = static_cast<TopoShapePy*>(pCrv)->getTopoShapePtr()->_Shape;
if (shape.IsNull()) {
PyErr_SetString(PyExc_Exception, "shape is empty");
PyErr_SetString(PartExceptionOCCError, "shape is empty");
return 0;
}
if (shape.ShapeType() != TopAbs_EDGE) {
PyErr_SetString(PyExc_Exception, "shape is not an edge");
PyErr_SetString(PartExceptionOCCError, "shape is not an edge");
return 0;
}
@@ -1134,7 +1135,7 @@ static PyObject * makeRevolution(PyObject *self, PyObject *args)
TopLoc_Location loc = edge.Location();
curve = Handle_Geom_Curve::DownCast(hCurve->Transformed(loc.Transformation()));
if (curve.IsNull()) {
PyErr_SetString(PyExc_Exception, "invalid curve in edge");
PyErr_SetString(PartExceptionOCCError, "invalid curve in edge");
return 0;
}
@@ -1178,7 +1179,7 @@ static PyObject * makeRevolution(PyObject *self, PyObject *args)
}
}
catch (Standard_DomainError) {
PyErr_SetString(PyExc_Exception, "creation of revolved shape failed");
PyErr_SetString(PartExceptionOCCDomainError, "creation of revolved shape failed");
return NULL;
}
}
@@ -1204,12 +1205,12 @@ static PyObject * makeRuledSurface(PyObject *self, PyObject *args)
return new TopoShapeShellPy(new TopoShape(shell));
}
else {
PyErr_SetString(PyExc_Exception, "curves must either be edges or wires");
PyErr_SetString(PartExceptionOCCError, "curves must either be edges or wires");
return 0;
}
}
catch (Standard_Failure) {
PyErr_SetString(PyExc_Exception, "creation of ruled surface failed");
PyErr_SetString(PartExceptionOCCError, "creation of ruled surface failed");
return 0;
}
}
@@ -1236,7 +1237,7 @@ static PyObject * makeSweepSurface(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1280,7 +1281,7 @@ static PyObject * makeTube(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1321,7 +1322,7 @@ static PyObject * makeLoft(PyObject *self, PyObject *args)
anAlgo.Perform (aLine, aSecGenerator);
if (!anAlgo.IsDone()) {
PyErr_SetString(PyExc_Exception, "Failed to create loft surface");
PyErr_SetString(PartExceptionOCCError, "Failed to create loft surface");
return 0;
}
@@ -1365,7 +1366,7 @@ static PyObject * makeLoft(PyObject *self, PyObject *args)
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Base::Console().Message("debug: Part.makeLoft catching 'Standard_Failure' msg: '%s'\n", e->GetMessageString());
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
#endif
@@ -1449,7 +1450,7 @@ static PyObject * toPythonOCC(PyObject *self, PyObject *args)
return proxy;
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return NULL;
}
}
@@ -1469,7 +1470,7 @@ static PyObject * fromPythonOCC(PyObject *self, PyObject *args)
return new TopoShapePy(shape);
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return NULL;
}
}
@@ -1550,7 +1551,7 @@ static PyObject * getSortedClusters(PyObject *self, PyObject *args)
{
PyObject *obj;
if (!PyArg_ParseTuple(args, "O", &obj)) {
PyErr_SetString(PyExc_Exception, "list of edges expected");
PyErr_SetString(PartExceptionOCCError, "list of edges expected");
return 0;
}
@@ -1593,7 +1594,7 @@ static PyObject * sortEdges(PyObject *self, PyObject *args)
{
PyObject *obj;
if (!PyArg_ParseTuple(args, "O", &obj)) {
PyErr_SetString(PyExc_Exception, "list of edges expected");
PyErr_SetString(PartExceptionOCCError, "list of edges expected");
return 0;
}
@@ -1629,7 +1630,7 @@ static PyObject * sortEdges(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1667,7 +1668,7 @@ static PyObject * cast_to_shape(PyObject *self, PyObject *args)
}
}
else {
PyErr_SetString(PyExc_Exception, "empty shape");
PyErr_SetString(PartExceptionOCCError, "empty shape");
}
}

View File

@@ -34,6 +34,7 @@
#include "ArcOfCirclePy.h"
#include "ArcOfCirclePy.cpp"
#include "CirclePy.h"
#include "OCCError.h"
#include <Base/GeometryPyCXX.h>
#include <Base/VectorPy.h>
@@ -85,7 +86,7 @@ int ArcOfCirclePy::PyInit(PyObject* args, PyObject* kwds)
(static_cast<CirclePy*>(o)->getGeomCirclePtr()->handle());
GC_MakeArcOfCircle arc(circle->Circ(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False);
if (!arc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(arc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status()));
return -1;
}
@@ -94,11 +95,11 @@ int ArcOfCirclePy::PyInit(PyObject* args, PyObject* kwds)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
catch (...) {
PyErr_SetString(PyExc_Exception, "creation of arc failed");
PyErr_SetString(PartExceptionOCCError, "creation of arc failed");
return -1;
}
}
@@ -116,7 +117,7 @@ int ArcOfCirclePy::PyInit(PyObject* args, PyObject* kwds)
gp_Pnt(v2.x,v2.y,v2.z),
gp_Pnt(v3.x,v3.y,v3.z));
if (!arc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(arc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status()));
return -1;
}

View File

@@ -36,6 +36,7 @@
#include "ArcPy.cpp"
#include "CirclePy.h"
#include "EllipsePy.h"
#include "OCCError.h"
#include <Base/VectorPy.h>
#include <Base/GeometryPyCXX.h>
@@ -68,7 +69,7 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/)
(static_cast<CirclePy*>(o)->getGeomCirclePtr()->handle());
GC_MakeArcOfCircle arc(circle->Circ(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False);
if (!arc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(arc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status()));
return -1;
}
@@ -77,11 +78,11 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
catch (...) {
PyErr_SetString(PyExc_Exception, "creation of arc failed");
PyErr_SetString(PartExceptionOCCError, "creation of arc failed");
return -1;
}
}
@@ -99,7 +100,7 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/)
gp_Pnt(v2.x,v2.y,v2.z),
gp_Pnt(v3.x,v3.y,v3.z));
if (!arc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(arc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status()));
return -1;
}
@@ -114,7 +115,7 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/)
(static_cast<EllipsePy*>(o)->getGeomEllipsePtr()->handle());
GC_MakeArcOfEllipse arc(ellipse->Elips(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False);
if (!arc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(arc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status()));
return -1;
}
@@ -123,11 +124,11 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
catch (...) {
PyErr_SetString(PyExc_Exception, "creation of arc failed");
PyErr_SetString(PartExceptionOCCError, "creation of arc failed");
return -1;
}
}

View File

@@ -37,6 +37,7 @@
#include "BRepOffsetAPI_MakePipeShellPy.h"
#include "BRepOffsetAPI_MakePipeShellPy.cpp"
#include "Tools.h"
#include "OCCError.h"
#include <Base/VectorPy.h>
#include <Base/GeometryPyCXX.h>
@@ -53,7 +54,7 @@ PyObject *BRepOffsetAPI_MakePipeShellPy::PyMake(struct _typeobject *, PyObject *
return new BRepOffsetAPI_MakePipeShellPy(new BRepOffsetAPI_MakePipeShell(TopoDS::Wire(wire)));
}
PyErr_SetString(PyExc_Exception, "A valid wire is needed as argument");
PyErr_SetString(PartExceptionOCCError, "A valid wire is needed as argument");
return 0;
}

View File

@@ -39,6 +39,7 @@
#include <Base/VectorPy.h>
#include <Base/GeometryPyCXX.h>
#include "OCCError.h"
#include "Geometry.h"
#include "BSplineCurvePy.h"
#include "BSplineCurvePy.cpp"
@@ -126,10 +127,12 @@ PyObject* BSplineCurvePy::increaseDegree(PyObject * args)
int degree;
if (!PyArg_ParseTuple(args, "i", &degree))
return 0;
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
curve->IncreaseDegree(degree);
Py_Return;
PY_TRY {
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
curve->IncreaseDegree(degree);
Py_Return;
} PY_CATCH_OCC ;
}
PyObject* BSplineCurvePy::increaseMultiplicity(PyObject * args)
@@ -165,7 +168,7 @@ PyObject* BSplineCurvePy::incrementMultiplicity(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -187,7 +190,7 @@ PyObject* BSplineCurvePy::insertKnot(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -228,7 +231,7 @@ PyObject* BSplineCurvePy::insertKnots(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -257,7 +260,7 @@ PyObject* BSplineCurvePy::removeKnot(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -275,7 +278,7 @@ PyObject* BSplineCurvePy::segment(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -333,7 +336,7 @@ PyObject* BSplineCurvePy::setKnots(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -355,7 +358,7 @@ PyObject* BSplineCurvePy::getKnots(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -380,7 +383,7 @@ PyObject* BSplineCurvePy::setPole(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -402,7 +405,7 @@ PyObject* BSplineCurvePy::getPole(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -427,7 +430,7 @@ PyObject* BSplineCurvePy::getPoles(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -446,7 +449,7 @@ PyObject* BSplineCurvePy::setWeight(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -466,7 +469,7 @@ PyObject* BSplineCurvePy::getWeight(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -488,7 +491,7 @@ PyObject* BSplineCurvePy::getWeights(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -507,7 +510,7 @@ PyObject* BSplineCurvePy::getResolution(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -529,7 +532,7 @@ PyObject* BSplineCurvePy::movePoint(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -546,7 +549,7 @@ PyObject* BSplineCurvePy::setNotPeriodic(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -563,7 +566,7 @@ PyObject* BSplineCurvePy::setPeriodic(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -581,7 +584,7 @@ PyObject* BSplineCurvePy::setOrigin(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -599,7 +602,7 @@ PyObject* BSplineCurvePy::getMultiplicity(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -621,7 +624,7 @@ PyObject* BSplineCurvePy::getMultiplicities(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -735,7 +738,7 @@ PyObject* BSplineCurvePy::approximate(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -786,7 +789,7 @@ PyObject* BSplineCurvePy::interpolate(PyObject *args)
Handle_Standard_Failure e = Standard_Failure::Caught();
std::string err = e->GetMessageString();
if (err.empty()) err = e->DynamicType()->Name();
PyErr_SetString(PyExc_Exception, err.c_str());
PyErr_SetString(PartExceptionOCCError, err.c_str());
return 0;
}
}
@@ -865,7 +868,7 @@ PyObject* BSplineCurvePy::buildFromPoles(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1008,7 +1011,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key
catch (const Standard_Failure & ) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Standard_CString msg = e->GetMessageString();
PyErr_SetString(PyExc_Exception, msg ? msg : "");
PyErr_SetString(PartExceptionOCCError, msg ? msg : "");
return 0;
}
}
@@ -1072,7 +1075,7 @@ PyObject* BSplineCurvePy::makeC1Continuous(PyObject *args)
Handle_Standard_Failure e = Standard_Failure::Caught();
std::string err = e->GetMessageString();
if (err.empty()) err = e->DynamicType()->Name();
PyErr_SetString(PyExc_Exception, err.c_str());
PyErr_SetString(PartExceptionOCCError, err.c_str());
return 0;
}
}

View File

@@ -39,6 +39,7 @@
#include <Base/GeometryPyCXX.h>
#include <Base/VectorPy.h>
#include "OCCError.h"
#include "Geometry.h"
#include "BSplineCurvePy.h"
#include "BSplineSurfacePy.h"
@@ -255,7 +256,7 @@ PyObject* BSplineSurfacePy::incrementUMultiplicity(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -275,7 +276,7 @@ PyObject* BSplineSurfacePy::incrementVMultiplicity(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -297,7 +298,7 @@ PyObject* BSplineSurfacePy::insertUKnot(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -338,7 +339,7 @@ PyObject* BSplineSurfacePy::insertUKnots(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -360,7 +361,7 @@ PyObject* BSplineSurfacePy::insertVKnot(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -401,7 +402,7 @@ PyObject* BSplineSurfacePy::insertVKnots(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -430,7 +431,7 @@ PyObject* BSplineSurfacePy::removeUKnot(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -457,7 +458,7 @@ PyObject* BSplineSurfacePy::removeVKnot(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -475,7 +476,7 @@ PyObject* BSplineSurfacePy::segment(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -565,7 +566,7 @@ PyObject* BSplineSurfacePy::setUKnots(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -591,7 +592,7 @@ PyObject* BSplineSurfacePy::setVKnots(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -613,7 +614,7 @@ PyObject* BSplineSurfacePy::getUKnots(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -635,7 +636,7 @@ PyObject* BSplineSurfacePy::getVKnots(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -660,7 +661,7 @@ PyObject* BSplineSurfacePy::setPole(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -701,7 +702,7 @@ PyObject* BSplineSurfacePy::setPoleCol(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -742,7 +743,7 @@ PyObject* BSplineSurfacePy::setPoleRow(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -765,7 +766,7 @@ PyObject* BSplineSurfacePy::getPole(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -793,7 +794,7 @@ PyObject* BSplineSurfacePy::getPoles(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -812,7 +813,7 @@ PyObject* BSplineSurfacePy::setWeight(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -838,7 +839,7 @@ PyObject* BSplineSurfacePy::setWeightCol(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -864,7 +865,7 @@ PyObject* BSplineSurfacePy::setWeightRow(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -885,7 +886,7 @@ PyObject* BSplineSurfacePy::getWeight(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -911,7 +912,7 @@ PyObject* BSplineSurfacePy::getWeights(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -930,7 +931,7 @@ PyObject* BSplineSurfacePy::getResolution(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -955,7 +956,7 @@ PyObject* BSplineSurfacePy::movePoint(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -972,7 +973,7 @@ PyObject* BSplineSurfacePy::setUNotPeriodic(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -989,7 +990,7 @@ PyObject* BSplineSurfacePy::setVNotPeriodic(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1006,7 +1007,7 @@ PyObject* BSplineSurfacePy::setUPeriodic(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1023,7 +1024,7 @@ PyObject* BSplineSurfacePy::setVPeriodic(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1041,7 +1042,7 @@ PyObject* BSplineSurfacePy::setUOrigin(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1059,7 +1060,7 @@ PyObject* BSplineSurfacePy::setVOrigin(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1077,7 +1078,7 @@ PyObject* BSplineSurfacePy::getUMultiplicity(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1095,7 +1096,7 @@ PyObject* BSplineSurfacePy::getVMultiplicity(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1117,7 +1118,7 @@ PyObject* BSplineSurfacePy::getUMultiplicities(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1139,7 +1140,7 @@ PyObject* BSplineSurfacePy::getVMultiplicities(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1169,7 +1170,7 @@ PyObject* BSplineSurfacePy::uIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1188,7 +1189,7 @@ PyObject* BSplineSurfacePy::vIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1241,7 +1242,7 @@ PyObject* BSplineSurfacePy::reparametrize(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1331,7 +1332,7 @@ PyObject* BSplineSurfacePy::approximate(PyObject *args)
Handle_Standard_Failure e = Standard_Failure::Caught();
std::string err = e->GetMessageString();
if (err.empty()) err = e->DynamicType()->Name();
PyErr_SetString(PyExc_Exception, err.c_str());
PyErr_SetString(PartExceptionOCCError, err.c_str());
return 0;
}
}
@@ -1396,7 +1397,7 @@ PyObject* BSplineSurfacePy::interpolate(PyObject *args)
Handle_Standard_Failure e = Standard_Failure::Caught();
std::string err = e->GetMessageString();
if (err.empty()) err = e->DynamicType()->Name();
PyErr_SetString(PyExc_Exception, err.c_str());
PyErr_SetString(PartExceptionOCCError, err.c_str());
return 0;
}
}
@@ -1551,7 +1552,7 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k
catch (const Standard_Failure & ) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Standard_CString msg = e->GetMessageString();
PyErr_SetString(PyExc_Exception, msg ? msg : "");
PyErr_SetString(PartExceptionOCCError, msg ? msg : "");
return 0;
}
}

View File

@@ -32,6 +32,7 @@
#include <Base/VectorPy.h>
#include <Base/GeometryPyCXX.h>
#include "OCCError.h"
#include "Geometry.h"
#include "BezierCurvePy.h"
#include "BezierCurvePy.cpp"
@@ -135,7 +136,7 @@ PyObject* BezierCurvePy::insertPoleAfter(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -157,7 +158,7 @@ PyObject* BezierCurvePy::insertPoleBefore(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -175,7 +176,7 @@ PyObject* BezierCurvePy::removePole(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -193,7 +194,7 @@ PyObject* BezierCurvePy::segment(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -218,7 +219,7 @@ PyObject* BezierCurvePy::setPole(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -240,7 +241,7 @@ PyObject* BezierCurvePy::getPole(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -265,7 +266,7 @@ PyObject* BezierCurvePy::getPoles(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -291,7 +292,7 @@ PyObject* BezierCurvePy::setPoles(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -310,7 +311,7 @@ PyObject* BezierCurvePy::setWeight(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -330,7 +331,7 @@ PyObject* BezierCurvePy::getWeight(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -352,7 +353,7 @@ PyObject* BezierCurvePy::getWeights(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -371,7 +372,7 @@ PyObject* BezierCurvePy::getResolution(PyObject* args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}

View File

@@ -35,6 +35,7 @@
#include <Base/VectorPy.h>
#include <Base/GeometryPyCXX.h>
#include "OCCError.h"
#include "Geometry.h"
#include "BezierCurvePy.h"
#include "BezierSurfacePy.h"
@@ -198,7 +199,7 @@ PyObject* BezierSurfacePy::increase(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -239,7 +240,7 @@ PyObject* BezierSurfacePy::insertPoleColAfter(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -280,7 +281,7 @@ PyObject* BezierSurfacePy::insertPoleRowAfter(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -321,7 +322,7 @@ PyObject* BezierSurfacePy::insertPoleColBefore(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -362,7 +363,7 @@ PyObject* BezierSurfacePy::insertPoleRowBefore(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -380,7 +381,7 @@ PyObject* BezierSurfacePy::removePoleCol(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -398,7 +399,7 @@ PyObject* BezierSurfacePy::removePoleRow(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -416,7 +417,7 @@ PyObject* BezierSurfacePy::segment(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -440,7 +441,7 @@ PyObject* BezierSurfacePy::setPole(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -481,7 +482,7 @@ PyObject* BezierSurfacePy::setPoleCol(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -522,7 +523,7 @@ PyObject* BezierSurfacePy::setPoleRow(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -543,7 +544,7 @@ PyObject* BezierSurfacePy::getPole(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -571,7 +572,7 @@ PyObject* BezierSurfacePy::getPoles(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -590,7 +591,7 @@ PyObject* BezierSurfacePy::setWeight(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -616,7 +617,7 @@ PyObject* BezierSurfacePy::setWeightCol(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -642,7 +643,7 @@ PyObject* BezierSurfacePy::setWeightRow(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -663,7 +664,7 @@ PyObject* BezierSurfacePy::getWeight(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -689,7 +690,7 @@ PyObject* BezierSurfacePy::getWeights(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -708,7 +709,7 @@ PyObject* BezierSurfacePy::getResolution(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -727,7 +728,7 @@ PyObject* BezierSurfacePy::exchangeUV(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -746,7 +747,7 @@ PyObject* BezierSurfacePy::uIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -765,7 +766,7 @@ PyObject* BezierSurfacePy::vIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}

View File

@@ -244,6 +244,7 @@ SET(Part_SRCS
modelRefine.cpp
modelRefine.h
Tools.h
OCCError.h
FT2FC.cpp
FT2FC.h
)

View File

@@ -28,6 +28,7 @@
# include <GC_MakeCircle.hxx>
#endif
#include "OCCError.h"
#include "CirclePy.h"
#include "CirclePy.cpp"
@@ -77,7 +78,7 @@ int CirclePy::PyInit(PyObject* args, PyObject* kwds)
(pcCircle->getGeomCirclePtr()->handle());
GC_MakeCircle mc(circle->Circ(), dist);
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}
@@ -100,7 +101,7 @@ int CirclePy::PyInit(PyObject* args, PyObject* kwds)
gp_Dir(v2.x,v2.y,v2.z),
dist);
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}
@@ -134,7 +135,7 @@ int CirclePy::PyInit(PyObject* args, PyObject* kwds)
gp_Pnt(v2.x,v2.y,v2.z),
gp_Pnt(v3.x,v3.y,v3.z));
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}

View File

@@ -37,6 +37,7 @@
#include <Base/GeometryPyCXX.h>
#include <Base/VectorPy.h>
#include "OCCError.h"
#include "Geometry.h"
#include "LinePy.h"
#include "CirclePy.h"
@@ -84,7 +85,7 @@ int ConePy::PyInit(PyObject* args, PyObject* kwds)
gp_Pnt(v2.x,v2.y,v2.z),
radius1, radius2);
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}
@@ -111,7 +112,7 @@ int ConePy::PyInit(PyObject* args, PyObject* kwds)
gp_Pnt(v3.x,v3.y,v3.z),
gp_Pnt(v4.x,v4.y,v4.z));
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}
@@ -132,7 +133,7 @@ int ConePy::PyInit(PyObject* args, PyObject* kwds)
(pcCone->getGeometryPtr()->handle());
GC_MakeConicalSurface mc(pcone->Cone(), dist);
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}
@@ -151,7 +152,7 @@ int ConePy::PyInit(PyObject* args, PyObject* kwds)
(pcCone->getGeometryPtr()->handle());
GC_MakeConicalSurface mc(pcone->Cone());
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}
@@ -190,7 +191,7 @@ PyObject* ConePy::uIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -209,7 +210,7 @@ PyObject* ConePy::vIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}

View File

@@ -36,6 +36,7 @@
#include <Base/GeometryPyCXX.h>
#include <Base/VectorPy.h>
#include "OCCError.h"
#include "Geometry.h"
#include "CirclePy.h"
#include "EllipsePy.h"
@@ -72,7 +73,7 @@ int CylinderPy::PyInit(PyObject* args, PyObject* kwds)
(pcCylinder->getGeomCylinderPtr()->handle());
GC_MakeCylindricalSurface mc(cylinder->Cylinder(), dist);
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}
@@ -108,7 +109,7 @@ int CylinderPy::PyInit(PyObject* args, PyObject* kwds)
gp_Pnt(v2.x,v2.y,v2.z),
gp_Pnt(v3.x,v3.y,v3.z));
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}
@@ -127,7 +128,7 @@ int CylinderPy::PyInit(PyObject* args, PyObject* kwds)
(pcCircle->getGeomCirclePtr()->handle());
GC_MakeCylindricalSurface mc(circ->Circ());
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}
@@ -181,7 +182,7 @@ PyObject* CylinderPy::uIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -208,7 +209,7 @@ PyObject* CylinderPy::vIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}

View File

@@ -31,6 +31,7 @@
#include <Base/GeometryPyCXX.h>
#include <Base/VectorPy.h>
#include "OCCError.h"
#include "Geometry.h"
#include "EllipsePy.h"
#include "EllipsePy.cpp"
@@ -89,7 +90,7 @@ int EllipsePy::PyInit(PyObject* args, PyObject* kwds)
gp_Pnt(v2.x,v2.y,v2.z),
gp_Pnt(v3.x,v3.y,v3.z));
if (!me.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(me.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(me.Status()));
return -1;
}
@@ -109,7 +110,7 @@ int EllipsePy::PyInit(PyObject* args, PyObject* kwds)
GC_MakeEllipse me(gp_Ax2(gp_Pnt(c.x,c.y,c.z), gp_Dir(0.0,0.0,1.0)),
major, minor);
if (!me.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(me.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(me.Status()));
return -1;
}

View File

@@ -64,6 +64,7 @@
#include "PlanePy.h"
#include "BSplineCurvePy.h"
#include "OCCError.h"
#include "TopoShape.h"
#include "TopoShapePy.h"
#include "TopoShapeEdgePy.h"
@@ -108,11 +109,11 @@ PyObject* GeometryCurvePy::toShape(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a curve");
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}
@@ -122,7 +123,7 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds)
Handle_Geom_Geometry g = getGeometryPtr()->handle();
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(g);
if (c.IsNull()) {
PyErr_SetString(PyExc_Exception, "Geometry is not a curve");
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}
@@ -185,7 +186,7 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of curve failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed");
return 0;
}
}
@@ -207,7 +208,7 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of curve failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed");
return 0;
}
}
@@ -231,7 +232,7 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of curve failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed");
return 0;
}
}
@@ -253,7 +254,7 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of curve failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed");
return 0;
}
}
@@ -275,17 +276,17 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of curve failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed");
return 0;
}
}
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return 0;
}
PyErr_SetString(PyExc_Exception,"Wrong arguments");
PyErr_SetString(PartExceptionOCCError,"Wrong arguments");
return 0;
}
@@ -307,11 +308,11 @@ PyObject* GeometryCurvePy::length(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a curve");
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}
@@ -330,11 +331,11 @@ PyObject* GeometryCurvePy::value(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a curve");
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}
@@ -360,11 +361,11 @@ PyObject* GeometryCurvePy::tangent(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a curve");
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}
@@ -386,11 +387,11 @@ PyObject* GeometryCurvePy::parameter(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a curve");
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}
@@ -406,7 +407,7 @@ PyObject* GeometryCurvePy::makeRuledSurface(PyObject *args)
Handle_Geom_Curve aCrv2 = Handle_Geom_Curve::DownCast(c->getGeometryPtr()->handle());
Handle_Geom_Surface aSurf = GeomFill::Surface (aCrv1, aCrv2);
if (aSurf.IsNull()) {
PyErr_SetString(PyExc_Exception, "Failed to create ruled surface");
PyErr_SetString(PartExceptionOCCError, "Failed to create ruled surface");
return 0;
}
// check the result surface type
@@ -428,11 +429,11 @@ PyObject* GeometryCurvePy::makeRuledSurface(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a curve");
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}
@@ -466,7 +467,7 @@ PyObject* GeometryCurvePy::intersect2d(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -491,11 +492,11 @@ PyObject* GeometryCurvePy::toBSpline(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a curve");
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}
@@ -545,7 +546,7 @@ PyObject* GeometryCurvePy::approximateBSpline(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}

View File

@@ -44,6 +44,7 @@
#include <Base/Placement.h>
#include <Base/PlacementPy.h>
#include "OCCError.h"
#include "Geometry.h"
#include "GeometryPy.h"
#include "GeometryPy.cpp"
@@ -94,7 +95,7 @@ PyObject* GeometryPy::mirror(PyObject *args)
Py_Return;
}
PyErr_SetString(PyExc_Exception, "either a point (vector) or axis (vector, vector) must be given");
PyErr_SetString(PartExceptionOCCError, "either a point (vector) or axis (vector, vector) must be given");
return 0;
}
@@ -137,7 +138,7 @@ PyObject* GeometryPy::scale(PyObject *args)
Py_Return;
}
PyErr_SetString(PyExc_Exception, "either vector or tuple and float expected");
PyErr_SetString(PartExceptionOCCError, "either vector or tuple and float expected");
return 0;
}
@@ -175,7 +176,7 @@ PyObject* GeometryPy::translate(PyObject *args)
Py_Return;
}
PyErr_SetString(PyExc_Exception, "either vector or tuple expected");
PyErr_SetString(PartExceptionOCCError, "either vector or tuple expected");
return 0;
}

View File

@@ -39,6 +39,7 @@
#include <Base/GeometryPyCXX.h>
#include <Base/VectorPy.h>
#include "OCCError.h"
#include "Geometry.h"
#include "GeometrySurfacePy.h"
#include "GeometrySurfacePy.cpp"
@@ -91,11 +92,11 @@ PyObject* GeometrySurfacePy::toShape(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a surface");
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
return 0;
}
@@ -114,11 +115,11 @@ PyObject* GeometrySurfacePy::value(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a surface");
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
return 0;
}
@@ -148,11 +149,11 @@ PyObject* GeometrySurfacePy::tangent(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a surface");
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
return 0;
}
@@ -178,11 +179,11 @@ PyObject* GeometrySurfacePy::parameter(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a surface");
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
return 0;
}
@@ -288,7 +289,7 @@ PyObject* GeometrySurfacePy::UPeriod(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -306,7 +307,7 @@ PyObject* GeometrySurfacePy::VPeriod(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -400,7 +401,7 @@ PyObject* GeometrySurfacePy::toBSpline(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
}
return 0;

View File

@@ -31,6 +31,7 @@
#include <Base/VectorPy.h>
#include <Base/GeometryPyCXX.h>
#include "OCCError.h"
#include "Geometry.h"
#include "HyperbolaPy.h"
#include "HyperbolaPy.cpp"
@@ -89,7 +90,7 @@ int HyperbolaPy::PyInit(PyObject* args, PyObject* kwds)
gp_Pnt(v2.x,v2.y,v2.z),
gp_Pnt(v3.x,v3.y,v3.z));
if (!mh.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mh.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mh.Status()));
return -1;
}
@@ -109,7 +110,7 @@ int HyperbolaPy::PyInit(PyObject* args, PyObject* kwds)
GC_MakeHyperbola mh(gp_Ax2(gp_Pnt(c.x,c.y,c.z), gp_Dir(0.0,0.0,1.0)),
major, minor);
if (!mh.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mh.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mh.Status()));
return -1;
}

View File

@@ -35,6 +35,7 @@
#include <Base/VectorPy.h>
#include <Base/GeometryPyCXX.h>
#include "OCCError.h"
#include "Geometry.h"
#include "LinePy.h"
#include "LinePy.cpp"
@@ -114,7 +115,7 @@ int LinePy::PyInit(PyObject* args, PyObject* /*kwd*/)
GC_MakeSegment ms(gp_Pnt(v1.x,v1.y,v1.z),
gp_Pnt(v2.x,v2.y,v2.z));
if (!ms.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(ms.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(ms.Status()));
return -1;
}
@@ -133,11 +134,11 @@ int LinePy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
catch (...) {
PyErr_SetString(PyExc_Exception, "creation of line failed");
PyErr_SetString(PartExceptionOCCError, "creation of line failed");
return -1;
}
}
@@ -162,7 +163,7 @@ PyObject* LinePy::setParameterRange(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}

158
src/Mod/Part/App/OCCError.h Normal file
View File

@@ -0,0 +1,158 @@
/***************************************************************************
* Copyright (c) Sebastian Hoogen (github@sebastianhoogen.de) 2014 *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef _OCCError_h_
#define _OCCError_h_
# include <Standard_Version.hxx>
# include <Standard_Failure.hxx>
# include <Standard_AbortiveTransaction.hxx>
# include <Standard_ConstructionError.hxx>
# include <Standard_DefineException.hxx>
# include <Standard_DimensionError.hxx>
# include <Standard_DimensionMismatch.hxx>
# include <Standard_DivideByZero.hxx>
# include <Standard_DomainError.hxx>
# include <Standard_ImmutableObject.hxx>
# include <Standard_LicenseError.hxx>
# include <Standard_LicenseNotFound.hxx>
# include <Standard_MultiplyDefined.hxx>
# include <Standard_NegativeValue.hxx>
# include <Standard_NoMoreObject.hxx>
# include <Standard_NoSuchObject.hxx>
# include <Standard_NotImplemented.hxx>
# include <Standard_NullObject.hxx>
# include <Standard_NullValue.hxx>
# include <Standard_NumericError.hxx>
# include <Standard_OutOfMemory.hxx>
# include <Standard_OutOfRange.hxx>
# include <Standard_Overflow.hxx>
# include <Standard_ProgramError.hxx>
# include <Standard_RangeError.hxx>
# include <Standard_TooManyUsers.hxx>
# include <Standard_TypeMismatch.hxx>
# include <Standard_Underflow.hxx>
#include <Base/Console.h>
#include <Base/PyObjectBase.h>
#include <Base/Interpreter.h>
#include <Base/Exception.h>
#include <App/Application.h>
namespace Part {
PartExport extern PyObject* PartExceptionOCCError;
PartExport extern PyObject* PartExceptionOCCDomainError;
PartExport extern PyObject* PartExceptionOCCRangeError;
PartExport extern PyObject* PartExceptionOCCConstructionError;
PartExport extern PyObject* PartExceptionOCCDimensionError;
#define PY_TRY try
#ifndef DONT_CATCH_CXX_EXCEPTIONS
/// see docu of PY_TRY
# define PY_CATCH_OCC catch (Standard_Failure &e) \
{ \
std::string str; \
Standard_CString msg = e.GetMessageString(); \
str += typeid(e).name(); \
str += " "; \
if (msg) {str += msg;} \
else {str += "No OCCT Exception Message";} \
Base::Console().Error(str.c_str()); \
Py_Error(Part::PartExceptionOCCError,str.c_str()); \
} \
catch(Base::Exception &e) \
{ \
std::string str; \
str += "FreeCAD exception thrown ("; \
str += e.what(); \
str += ")"; \
e.ReportException(); \
Py_Error(Base::BaseExceptionFreeCADError,str.c_str()); \
} \
catch(std::exception &e) \
{ \
std::string str; \
str += "STL exception thrown ("; \
str += e.what(); \
str += ")"; \
Base::Console().Error(str.c_str()); \
Py_Error(Base::BaseExceptionFreeCADError,str.c_str()); \
} \
catch(const Py::Exception&) \
{ \
return NULL; \
} \
catch(const char *e) \
{ \
Py_Error(Base::BaseExceptionFreeCADError,e); \
} \
catch(...) \
{ \
Py_Error(Base::BaseExceptionFreeCADError,"Unknown C++ exception"); \
}
#else
/// see docu of PY_TRY
# define PY_CATCH_OCC catch (Standard_Failure &e) \
{ \
std::string str; \
Standard_CString msg = e.GetMessageString(); \
str += typeid(e).name(); \
str += " "; \
if (msg) {str += msg;} \
else {str += "No OCCT Exception Message";} \
Base::Console().Error(str.c_str()); \
Py_Error(Part::PartExceptionOCCError,str.c_str()); \
} \
catch(Base::Exception &e) \
{ \
std::string str; \
str += "FreeCAD exception thrown ("; \
str += e.what(); \
str += ")"; \
e.ReportException(); \
Py_Error(Base::BaseExceptionFreeCADError,str.c_str()); \
} \
catch(std::exception &e) \
{ \
std::string str; \
str += "STL exception thrown ("; \
str += e.what(); \
str += ")"; \
Base::Console().Error(str.c_str()); \
Py_Error(Base::BaseExceptionFreeCADError,str.c_str()); \
} \
catch(const Py::Exception&) \
{ \
return NULL; \
} \
catch(const char *e) \
{ \
Py_Error(Base::BaseExceptionFreeCADError,e); \
}
#endif // DONT_CATCH_CXX_EXCEPTIONS
} //namespace Part
#endif // _OCCError_h_

View File

@@ -26,6 +26,7 @@
# include <Geom_OffsetCurve.hxx>
#endif
#include "OCCError.h"
#include "Geometry.h"
#include "OffsetCurvePy.h"
#include "OffsetCurvePy.cpp"
@@ -76,7 +77,7 @@ int OffsetCurvePy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
}

View File

@@ -29,6 +29,7 @@
#include <Base/VectorPy.h>
#include <Base/Vector3D.h>
#include "OCCError.h"
#include "Geometry.h"
#include "OffsetSurfacePy.h"
#include "OffsetSurfacePy.cpp"
@@ -72,7 +73,7 @@ int OffsetSurfacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
}

View File

@@ -29,6 +29,7 @@
#include <Base/VectorPy.h>
#include <Base/GeometryPyCXX.h>
#include "OCCError.h"
#include "Geometry.h"
#include "ParabolaPy.h"
#include "ParabolaPy.cpp"
@@ -74,7 +75,7 @@ PyObject* ParabolaPy::compute(PyObject *args)
Base::Vector3d c = (v1-v2) % (v3-v2);
double zValue = v1.z;
if (fabs(c.Length()) < 0.0001) {
PyErr_SetString(PyExc_Exception, "Points are collinear");
PyErr_SetString(PartExceptionOCCError, "Points are collinear");
return 0;
}

View File

@@ -38,6 +38,7 @@
#include <Base/VectorPy.h>
#include <Base/GeometryPyCXX.h>
#include "OCCError.h"
#include "Geometry.h"
#include "LinePy.h"
#include "PlanePy.h"
@@ -72,7 +73,7 @@ int PlanePy::PyInit(PyObject* args, PyObject* kwds)
(pcPlane->getGeometryPtr()->handle());
GC_MakePlane mc(plane->Pln(), dist);
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}
@@ -89,7 +90,7 @@ int PlanePy::PyInit(PyObject* args, PyObject* kwds)
&a,&b,&c,&d)) {
GC_MakePlane mc(a,b,c,d);
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}
@@ -112,7 +113,7 @@ int PlanePy::PyInit(PyObject* args, PyObject* kwds)
gp_Pnt(v2.x,v2.y,v2.z),
gp_Pnt(v3.x,v3.y,v3.z));
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}
@@ -132,7 +133,7 @@ int PlanePy::PyInit(PyObject* args, PyObject* kwds)
GC_MakePlane mc(gp_Pnt(v1.x,v1.y,v1.z),
gp_Dir(v2.x,v2.y,v2.z));
if (!mc.IsDone()) {
PyErr_SetString(PyExc_Exception, gce_ErrorStatusText(mc.Status()));
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
return -1;
}
@@ -275,7 +276,7 @@ PyObject* PlanePy::uIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -300,7 +301,7 @@ PyObject* PlanePy::vIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}

View File

@@ -28,6 +28,7 @@
#endif
#include "Mod/Part/App/Geometry.h"
#include "OCCError.h"
// inclusion of the generated files (generated out of RectangularTrimmedSurfacePy.xml)
#include "RectangularTrimmedSurfacePy.h"
@@ -81,7 +82,7 @@ int RectangularTrimmedSurfacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
return 0;
}
PyErr_SetString(PyExc_Exception, "A surface and the trim parameters must be given");
PyErr_SetString(PartExceptionOCCError, "A surface and the trim parameters must be given");
return -1;
}
@@ -106,7 +107,7 @@ PyObject* RectangularTrimmedSurfacePy::uIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -132,7 +133,7 @@ PyObject* RectangularTrimmedSurfacePy::vIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}

View File

@@ -37,6 +37,7 @@
#include "CirclePy.h"
#include "SpherePy.h"
#include "SpherePy.cpp"
#include "OCCError.h"
using namespace Part;
@@ -194,7 +195,7 @@ PyObject *SpherePy::uIso(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -213,7 +214,7 @@ PyObject *SpherePy::vIso(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}

View File

@@ -32,6 +32,7 @@
#include <Base/GeometryPyCXX.h>
#include <Base/VectorPy.h>
#include "OCCError.h"
using namespace Part;
@@ -74,7 +75,7 @@ int SurfaceOfExtrusionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
}

View File

@@ -32,6 +32,7 @@
#include <Base/GeometryPyCXX.h>
#include <Base/VectorPy.h>
#include "OCCError.h"
using namespace Part;
@@ -78,7 +79,7 @@ int SurfaceOfRevolutionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
}

View File

@@ -26,6 +26,7 @@
#include <Standard_Failure.hxx>
#include <TopoDS_CompSolid.hxx>
#include "OCCError.h"
#include "TopoShape.h"
// inclusion of the generated files (generated out of TopoShapeCompSolidPy.xml)
@@ -72,7 +73,7 @@ int TopoShapeCompSolidPy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
@@ -99,7 +100,7 @@ PyObject* TopoShapeCompSolidPy::add(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}

View File

@@ -32,6 +32,8 @@
#include <Precision.hxx>
#include <TopExp_Explorer.hxx>
#include "OCCError.h"
// inclusion of the generated files (generated out of TopoShapeCompoundPy.xml)
#include "TopoShapeCompoundPy.h"
#include "TopoShapeCompoundPy.cpp"
@@ -75,7 +77,7 @@ int TopoShapeCompoundPy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
@@ -100,7 +102,7 @@ PyObject* TopoShapeCompoundPy::add(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -138,7 +140,7 @@ PyObject* TopoShapeCompoundPy::connectEdgesToWires(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}

View File

@@ -67,6 +67,7 @@
#include <Base/VectorPy.h>
#include <Base/GeometryPyCXX.h>
#include "OCCError.h"
#include "TopoShape.h"
#include "TopoShapeFacePy.h"
#include "TopoShapeVertexPy.h"
@@ -110,7 +111,7 @@ int TopoShapeEdgePy::PyInit(PyObject* args, PyObject* /*kwd*/)
Geometry* geom = static_cast<GeometryPy*>(pcObj)->getGeometryPtr();
Handle_Geom_Curve curve = Handle_Geom_Curve::DownCast(geom->handle());
if (curve.IsNull()) {
PyErr_SetString(PyExc_Exception, "geometry is not a curve type");
PyErr_SetString(PartExceptionOCCError, "geometry is not a curve type");
return -1;
}
@@ -126,7 +127,7 @@ int TopoShapeEdgePy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
}
@@ -159,12 +160,12 @@ int TopoShapeEdgePy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
}
PyErr_SetString(PyExc_Exception, "Curve or shape expected");
PyErr_SetString(PartExceptionOCCError, "Curve or shape expected");
return -1;
}
@@ -237,7 +238,7 @@ PyObject* TopoShapeEdgePy::parameterAt(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -280,7 +281,7 @@ PyObject* TopoShapeEdgePy::normalAt(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -301,7 +302,7 @@ PyObject* TopoShapeEdgePy::curvatureAt(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -323,7 +324,7 @@ PyObject* TopoShapeEdgePy::centerOfCurvatureAt(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -344,7 +345,7 @@ PyObject* TopoShapeEdgePy::derivative1At(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -365,7 +366,7 @@ PyObject* TopoShapeEdgePy::derivative2At(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -386,7 +387,7 @@ PyObject* TopoShapeEdgePy::derivative3At(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -453,7 +454,7 @@ PyObject* TopoShapeEdgePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of edge failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of edge failed");
return 0;
}
}
@@ -475,7 +476,7 @@ PyObject* TopoShapeEdgePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of edge failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of edge failed");
return 0;
}
}
@@ -499,7 +500,7 @@ PyObject* TopoShapeEdgePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of edge failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of edge failed");
return 0;
}
}
@@ -521,7 +522,7 @@ PyObject* TopoShapeEdgePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of edge failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of edge failed");
return 0;
}
}
@@ -543,17 +544,17 @@ PyObject* TopoShapeEdgePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of edge failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of edge failed");
return 0;
}
}
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return 0;
}
PyErr_SetString(PyExc_Exception,"Wrong arguments");
PyErr_SetString(PartExceptionOCCError,"Wrong arguments");
return 0;
}
@@ -617,11 +618,11 @@ PyObject* TopoShapeEdgePy::split(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a curve");
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}

View File

@@ -84,6 +84,7 @@
#include "SurfaceOfRevolutionPy.h"
#include "SurfaceOfExtrusionPy.h"
#include "ToroidPy.h"
#include "OCCError.h"
using namespace Part;
@@ -110,14 +111,14 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
try {
const TopoDS_Shape& sh = static_cast<Part::TopoShapePy*>(pW)->getTopoShapePtr()->_Shape;
if (sh.IsNull()) {
PyErr_SetString(PyExc_Exception, "cannot create face out of empty wire");
PyErr_SetString(PartExceptionOCCError, "cannot create face out of empty wire");
return -1;
}
if (sh.ShapeType() == TopAbs_WIRE) {
BRepBuilderAPI_MakeFace mkFace(TopoDS::Wire(sh));
if (!mkFace.IsDone()) {
PyErr_SetString(PyExc_Exception, "Failed to create face from wire");
PyErr_SetString(PartExceptionOCCError, "Failed to create face from wire");
return -1;
}
getTopoShapePtr()->_Shape = mkFace.Face();
@@ -130,7 +131,7 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
}
@@ -176,7 +177,7 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
}
@@ -236,12 +237,12 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
}
PyErr_SetString(PyExc_Exception, "wire or list of wires expected");
PyErr_SetString(PartExceptionOCCError, "wire or list of wires expected");
return -1;
}
@@ -289,7 +290,7 @@ PyObject* TopoShapeFacePy::normalAt(PyObject *args)
return new Base::VectorPy(new Base::Vector3d(vec.X(),vec.Y(),vec.Z()));
}
else {
PyErr_SetString(PyExc_Exception, "normal not defined");
PyErr_SetString(PartExceptionOCCError, "normal not defined");
return 0;
}
}
@@ -311,7 +312,7 @@ PyObject* TopoShapeFacePy::tangentAt(PyObject *args)
tuple.setItem(0, Py::Vector(Base::Vector3d(dir.X(),dir.Y(),dir.Z())));
}
else {
PyErr_SetString(PyExc_Exception, "tangent in u not defined");
PyErr_SetString(PartExceptionOCCError, "tangent in u not defined");
return 0;
}
if (prop.IsTangentVDefined()) {
@@ -319,7 +320,7 @@ PyObject* TopoShapeFacePy::tangentAt(PyObject *args)
tuple.setItem(1, Py::Vector(Base::Vector3d(dir.X(),dir.Y(),dir.Z())));
}
else {
PyErr_SetString(PyExc_Exception, "tangent in v not defined");
PyErr_SetString(PartExceptionOCCError, "tangent in v not defined");
return 0;
}
@@ -342,7 +343,7 @@ PyObject* TopoShapeFacePy::curvatureAt(PyObject *args)
tuple.setItem(1, Py::Float(prop.MaxCurvature()));
}
else {
PyErr_SetString(PyExc_Exception, "curvature not defined");
PyErr_SetString(PartExceptionOCCError, "curvature not defined");
return 0;
}
@@ -369,7 +370,7 @@ PyObject* TopoShapeFacePy::derivative1At(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -394,7 +395,7 @@ PyObject* TopoShapeFacePy::derivative2At(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -428,7 +429,7 @@ PyObject* TopoShapeFacePy::isPartOfDomain(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -446,7 +447,7 @@ PyObject* TopoShapeFacePy::makeHalfSpace(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -499,7 +500,7 @@ PyObject* TopoShapeFacePy::validate(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}

View File

@@ -68,6 +68,7 @@
#include "TopoShapePy.h"
#include "TopoShapePy.cpp"
#include "OCCError.h"
#include "GeometryPy.h"
#include "TopoShapeFacePy.h"
#include "TopoShapeEdgePy.h"
@@ -139,7 +140,7 @@ int TopoShapePy::PyInit(PyObject* args, PyObject*)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
@@ -225,7 +226,7 @@ PyObject* TopoShapePy::replaceShape(PyObject *args)
return 0;
}
catch (...) {
PyErr_SetString(PyExc_Exception, "failed to replace shape");
PyErr_SetString(PartExceptionOCCError, "failed to replace shape");
return 0;
}
}
@@ -252,7 +253,7 @@ PyObject* TopoShapePy::removeShape(PyObject *args)
return inst;
}
catch (...) {
PyErr_SetString(PyExc_Exception, "failed to remove shape");
PyErr_SetString(PartExceptionOCCError, "failed to remove shape");
return 0;
}
}
@@ -300,7 +301,7 @@ PyObject* TopoShapePy::exportIges(PyObject *args)
getTopoShapePtr()->exportIges(filename);
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(PartExceptionOCCError,e.what());
return NULL;
}
@@ -318,7 +319,7 @@ PyObject* TopoShapePy::exportStep(PyObject *args)
getTopoShapePtr()->exportStep(filename);
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(PartExceptionOCCError,e.what());
return NULL;
}
@@ -336,7 +337,7 @@ PyObject* TopoShapePy::exportBrep(PyObject *args)
getTopoShapePtr()->exportBrep(filename);
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(PartExceptionOCCError,e.what());
return NULL;
}
@@ -354,16 +355,16 @@ PyObject* TopoShapePy::dumpToString(PyObject *args)
return Py::new_reference_to(Py::String(str.str()));
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(PartExceptionOCCError,e.what());
return NULL;
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(PartExceptionOCCError,e.what());
return NULL;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -380,16 +381,16 @@ PyObject* TopoShapePy::exportBrepToString(PyObject *args)
return Py::new_reference_to(Py::String(str.str()));
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(PartExceptionOCCError,e.what());
return NULL;
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(PartExceptionOCCError,e.what());
return NULL;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -411,7 +412,7 @@ PyObject* TopoShapePy::importBrep(PyObject *args)
getTopoShapePtr()->importBrep(str);
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(PartExceptionOCCError,e.what());
return NULL;
}
@@ -430,16 +431,16 @@ PyObject* TopoShapePy::importBrepFromString(PyObject *args)
getTopoShapePtr()->importBrep(str);
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(PartExceptionOCCError,e.what());
return NULL;
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(PartExceptionOCCError,e.what());
return NULL;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -458,12 +459,12 @@ PyObject* TopoShapePy::exportStl(PyObject *args)
getTopoShapePtr()->exportStl(filename, deflection);
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception,e.what());
PyErr_SetString(PartExceptionOCCError,e.what());
return 0;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -502,12 +503,12 @@ PyObject* TopoShapePy::extrude(PyObject *args)
break;
}
PyErr_SetString(PyExc_Exception, "extrusion for this shape type not supported");
PyErr_SetString(PartExceptionOCCError, "extrusion for this shape type not supported");
return 0;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -523,19 +524,19 @@ PyObject* TopoShapePy::revolve(PyObject *args)
try {
const TopoDS_Shape& input = this->getTopoShapePtr()->_Shape;
if (input.IsNull()) {
PyErr_SetString(PyExc_Exception, "empty shape cannot be revolved");
PyErr_SetString(PartExceptionOCCError, "empty shape cannot be revolved");
return 0;
}
TopExp_Explorer xp;
xp.Init(input,TopAbs_SOLID);
if (xp.More()) {
PyErr_SetString(PyExc_Exception, "shape must not contain solids");
PyErr_SetString(PartExceptionOCCError, "shape must not contain solids");
return 0;
}
xp.Init(input,TopAbs_COMPSOLID);
if (xp.More()) {
PyErr_SetString(PyExc_Exception, "shape must not contain compound solids");
PyErr_SetString(PartExceptionOCCError, "shape must not contain compound solids");
return 0;
}
@@ -568,12 +569,12 @@ PyObject* TopoShapePy::revolve(PyObject *args)
break;
}
PyErr_SetString(PyExc_Exception, "revolution for this shape type not supported");
PyErr_SetString(PartExceptionOCCError, "revolution for this shape type not supported");
return 0;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -610,11 +611,11 @@ PyObject* TopoShapePy::fuse(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return NULL;
}
}
@@ -633,11 +634,11 @@ PyObject* TopoShapePy::oldFuse(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return NULL;
}
}
@@ -656,11 +657,11 @@ PyObject* TopoShapePy::common(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return NULL;
}
}
@@ -679,11 +680,11 @@ PyObject* TopoShapePy::section(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return NULL;
}
}
@@ -707,11 +708,11 @@ PyObject* TopoShapePy::slice(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return NULL;
}
}
@@ -734,11 +735,11 @@ PyObject* TopoShapePy::slices(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return NULL;
}
}
@@ -757,11 +758,11 @@ PyObject* TopoShapePy::cut(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return NULL;
}
}
@@ -777,7 +778,7 @@ PyObject* TopoShapePy::sewShape(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -841,7 +842,7 @@ PyObject* TopoShapePy::childShapes(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -860,7 +861,7 @@ PyObject* TopoShapePy::removeInternalWires(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -882,7 +883,7 @@ PyObject* TopoShapePy::mirror(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -900,7 +901,7 @@ PyObject* TopoShapePy::transformGeometry(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -919,7 +920,7 @@ PyObject* TopoShapePy::transformShape(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -994,7 +995,7 @@ PyObject* TopoShapePy::scale(PyObject *args)
pos.SetZ(pnt.z);
}
if (fabs(factor) < Precision::Confusion()) {
PyErr_SetString(PyExc_Exception, "scale factor too small");
PyErr_SetString(PartExceptionOCCError, "scale factor too small");
return NULL;
}
@@ -1009,7 +1010,7 @@ PyObject* TopoShapePy::scale(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -1037,7 +1038,7 @@ PyObject* TopoShapePy::makeFillet(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -1063,7 +1064,7 @@ PyObject* TopoShapePy::makeFillet(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -1102,7 +1103,7 @@ PyObject* TopoShapePy::makeChamfer(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -1133,7 +1134,7 @@ PyObject* TopoShapePy::makeChamfer(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -1175,7 +1176,7 @@ PyObject* TopoShapePy::makeThickness(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -1205,7 +1206,7 @@ PyObject* TopoShapePy::makeOffsetShape(PyObject *args, PyObject *keywds)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -1361,7 +1362,7 @@ PyObject* TopoShapePy::tessellate(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -1390,7 +1391,7 @@ PyObject* TopoShapePy::project(PyObject *args)
return new TopoShapePy(new TopoShape(algo.Projection()));
}
catch (Standard_Failure) {
PyErr_SetString(PyExc_Exception, "Failed to project shape");
PyErr_SetString(PartExceptionOCCError, "Failed to project shape");
return NULL;
}
}
@@ -1412,7 +1413,7 @@ PyObject* TopoShapePy::makeParallelProjection(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1434,7 +1435,7 @@ PyObject* TopoShapePy::makePerspectiveProjection(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -1489,7 +1490,7 @@ PyObject* TopoShapePy::toNurbs(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -1515,11 +1516,11 @@ PyObject* TopoShapePy::isInside(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return NULL;
}
}
@@ -1536,7 +1537,7 @@ PyObject* TopoShapePy::removeSplitter(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -1570,7 +1571,7 @@ PyObject* TopoShapePy::getElement(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
return 0;
@@ -2075,7 +2076,7 @@ PyObject *TopoShapePy::getCustomAttributes(const char* attr) const
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
return 0;

View File

@@ -37,6 +37,7 @@
#include <Base/VectorPy.h>
#include <Base/GeometryPyCXX.h>
#include "OCCError.h"
#include "TopoShape.h"
#include "TopoShapeCompoundPy.h"
#include "TopoShapeCompSolidPy.h"
@@ -108,7 +109,7 @@ int TopoShapeShellPy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
@@ -142,7 +143,7 @@ PyObject* TopoShapeShellPy::add(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
@@ -192,7 +193,7 @@ PyObject* TopoShapeShellPy::makeHalfSpace(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}

View File

@@ -49,6 +49,7 @@
#include "TopoShape.h"
#include "Tools.h"
#include "OCCError.h"
// inclusion of the generated files (generated out of TopoShapeSolidPy.xml)
#include "TopoShapeShellPy.h"
@@ -98,7 +99,7 @@ int TopoShapeSolidPy::PyInit(PyObject* args, PyObject* /*kwd*/)
getTopoShapePtr()->_Shape = solid;
}
catch (Standard_Failure) {
PyErr_SetString(PyExc_Exception, "creation of solid failed");
PyErr_SetString(PartExceptionOCCError, "creation of solid failed");
return -1;
}
@@ -212,7 +213,7 @@ PyObject* TopoShapeSolidPy::getMomentOfInertia(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -235,7 +236,7 @@ PyObject* TopoShapeSolidPy::getRadiusOfGyration(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -295,7 +296,7 @@ PyObject* TopoShapeSolidPy::offsetFaces(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}

View File

@@ -53,6 +53,7 @@
#include "TopoShapeEdgePy.h"
#include "TopoShapeWirePy.h"
#include "TopoShapeWirePy.cpp"
#include "OCCError.h"
using namespace Part;
@@ -97,7 +98,7 @@ int TopoShapeWirePy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
}
@@ -135,12 +136,12 @@ int TopoShapeWirePy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return -1;
}
}
PyErr_SetString(PyExc_Exception, "edge or wire or list of edges and wires expected");
PyErr_SetString(PartExceptionOCCError, "edge or wire or list of edges and wires expected");
return -1;
}
@@ -172,7 +173,7 @@ PyObject* TopoShapeWirePy::add(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -206,7 +207,7 @@ PyObject* TopoShapeWirePy::fixWire(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -235,7 +236,7 @@ PyObject* TopoShapeWirePy::makePipe(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -271,7 +272,7 @@ PyObject* TopoShapeWirePy::makePipeShell(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
}
}
@@ -300,7 +301,7 @@ PyObject* TopoShapeWirePy::makeHomogenousWires(PyObject *args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -322,12 +323,12 @@ PyObject* TopoShapeWirePy::approximate(PyObject *args)
return new BSplineCurvePy(new GeomBSplineCurve(approx.Curve()));
}
else {
PyErr_SetString(PyExc_Exception, "failed to approximate wire");
PyErr_SetString(PartExceptionOCCError, "failed to approximate wire");
return 0;
}
}
catch (Standard_Failure) {
PyErr_SetString(PyExc_Exception, "failed to approximate wire");
PyErr_SetString(PartExceptionOCCError, "failed to approximate wire");
return 0;
}
}
@@ -394,7 +395,7 @@ PyObject* TopoShapeWirePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of wire failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of wire failed");
return 0;
}
}
@@ -416,7 +417,7 @@ PyObject* TopoShapeWirePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of wire failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of wire failed");
return 0;
}
}
@@ -440,7 +441,7 @@ PyObject* TopoShapeWirePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of wire failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of wire failed");
return 0;
}
}
@@ -462,7 +463,7 @@ PyObject* TopoShapeWirePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of wire failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of wire failed");
return 0;
}
}
@@ -484,17 +485,17 @@ PyObject* TopoShapeWirePy::discretize(PyObject *args, PyObject *kwds)
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Discretization of wire failed");
PyErr_SetString(PartExceptionOCCError, "Discretization of wire failed");
return 0;
}
}
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(PartExceptionOCCError, e.what());
return 0;
}
PyErr_SetString(PyExc_Exception,"Wrong arguments");
PyErr_SetString(PartExceptionOCCError,"Wrong arguments");
return 0;
}

View File

@@ -460,7 +460,7 @@ PyObject *TopoShapePyOld::importIGES(PyObject *args)
// checking for the file
Base::FileInfo File(filename);
if(!File.isReadable()) {
PyErr_SetString(PyExc_Exception,"File to read does not exist or is not readable");
PyErr_SetString(PartExceptionOCCError,"File to read does not exist or is not readable");
return NULL;
}
@@ -468,7 +468,7 @@ PyObject *TopoShapePyOld::importIGES(PyObject *args)
IGESControl_Reader aReader;
if (aReader.ReadFile((const Standard_CString)filename) != IFSelect_RetDone) {
PyErr_SetString(PyExc_Exception,"Reading IGES failed");
PyErr_SetString(PartExceptionOCCError,"Reading IGES failed");
return NULL;
}
@@ -551,7 +551,7 @@ PyObject *TopoShapePyOld::exportIGES(PyObject *args)
#endif
if (aWriter.Write((const Standard_CString)filename) != IFSelect_RetDone) {
PyErr_SetString(PyExc_Exception,"Writing IGES failed");
PyErr_SetString(PartExceptionOCCError,"Writing IGES failed");
return NULL;
}
@@ -570,14 +570,14 @@ PyObject *TopoShapePyOld::importSTEP(PyObject *args)
// checking for the file
Base::FileInfo File(filename);
if(!File.isReadable()) {
PyErr_SetString(PyExc_Exception,"File to read does not exist or is not readable");
PyErr_SetString(PartExceptionOCCError,"File to read does not exist or is not readable");
return NULL;
}
// read step file
STEPControl_Reader aReader;
if (aReader.ReadFile((const Standard_CString)filename) != IFSelect_RetDone) {
PyErr_SetString(PyExc_Exception,"Reading STEP failed");
PyErr_SetString(PartExceptionOCCError,"Reading STEP failed");
return NULL;
}
@@ -643,12 +643,12 @@ PyObject *TopoShapePyOld::exportSTEP(PyObject *args)
//FIXME: Does not work this way!!!
if (aWriter.Transfer(_cTopoShape, STEPControl_AsIs)) {
PyErr_SetString(PyExc_Exception,"Transferring STEP failed");
PyErr_SetString(PartExceptionOCCError,"Transferring STEP failed");
return NULL;
}
if (aWriter.Write((const Standard_CString)filename) != IFSelect_RetDone) {
PyErr_SetString(PyExc_Exception,"Writing STEP failed");
PyErr_SetString(PartExceptionOCCError,"Writing STEP failed");
return NULL;
}
@@ -667,14 +667,14 @@ PyObject *TopoShapePyOld::importBREP(PyObject *args)
// checking for the file
Base::FileInfo File(filename);
if(!File.isReadable()) {
PyErr_SetString(PyExc_Exception,"File to read does not exist or is not readable");
PyErr_SetString(PartExceptionOCCError,"File to read does not exist or is not readable");
return NULL;
}
// read brep file
BRep_Builder aBuilder;
if (!BRepTools::Read(_cTopoShape,(const Standard_CString)filename,aBuilder)) {
PyErr_SetString(PyExc_Exception,"Reading BREP failed");
PyErr_SetString(PartExceptionOCCError,"Reading BREP failed");
return NULL;
}
} PY_CATCH;
@@ -691,7 +691,7 @@ PyObject *TopoShapePyOld::exportBREP(PyObject *args)
PY_TRY {
// read brep file
if (!BRepTools::Write(_cTopoShape,(const Standard_CString)filename)) {
PyErr_SetString(PyExc_Exception,"Writing BREP failed");
PyErr_SetString(PartExceptionOCCError,"Writing BREP failed");
return NULL;
}
} PY_CATCH;

View File

@@ -36,6 +36,7 @@
#include "CirclePy.h"
#include "ToroidPy.h"
#include "ToroidPy.cpp"
#include "OCCError.h"
using namespace Part;
@@ -79,7 +80,7 @@ PyObject* ToroidPy::uIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
@@ -98,7 +99,7 @@ PyObject* ToroidPy::vIso(PyObject * args)
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}

View File

@@ -70,7 +70,7 @@ static PyObject * makeFilletArc(PyObject *self, PyObject *args)
double cc = 2.0 * r2 * (b * v - r1);
double d = uv * uv - uu * cc;
if (d < 0) {
PyErr_SetString(PyExc_Exception, "Unable to caluclate intersection points");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Unable to caluclate intersection points");
return NULL;
}

View File

@@ -159,7 +159,7 @@ PyObject* PointsPy::addPoints(PyObject * args)
}
}
catch (const Py::Exception&) {
PyErr_SetString(PyExc_Exception, "either expect\n"
PyErr_SetString(Base::BaseExceptionFreeCADError, "either expect\n"
"-- [Vector,...] \n"
"-- [(x,y,z),...]");
return 0;

View File

@@ -74,7 +74,7 @@ static PyObject * approxSurface(PyObject *self, PyObject *args)
return new Part::BSplineSurfacePy(new Part::GeomBSplineSurface(hSurf));
}
PyErr_SetString(PyExc_Exception, "Computation of B-Spline surface failed");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Computation of B-Spline surface failed");
return 0;
} PY_CATCH;
}