translate netgen-exception to python

This commit is contained in:
Joachim Schöberl 2015-10-22 17:26:43 +02:00
parent 457c2ad96d
commit 7cbdcf29cf

View File

@ -39,6 +39,11 @@ void ExportArray ()
;
}
void TranslateException (const NgException & ex)
{
string err = string("Netgen exception: ")+ex.What();
PyErr_SetString(PyExc_RuntimeError, err.c_str());
}
DLL_HEADER void ExportNetgenMeshing()
@ -46,6 +51,8 @@ DLL_HEADER void ExportNetgenMeshing()
ModuleScope module("meshing");
bp::register_exception_translator<NgException>(&TranslateException);
bp::class_<PointIndex>("PointId", bp::init<int>())
.def("__repr__", &ToString<PointIndex>)
.def("__str__", &ToString<PointIndex>)