mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
Merge branch 'register_occ_exceptions' into 'master'
Register occ exceptions to python See merge request jschoeberl/netgen!409
This commit is contained in:
commit
e05dc43f35
@ -101,9 +101,15 @@ DLL_HEADER void ExportNgOCC(py::module &m)
|
|||||||
ExportNgOCCBasic(m);
|
ExportNgOCCBasic(m);
|
||||||
ExportNgOCCShapes(m);
|
ExportNgOCCShapes(m);
|
||||||
|
|
||||||
|
static py::exception<Standard_Failure> exc(m, "OCCException");
|
||||||
// not working, since occ - exceptions don't derive from std::exception
|
py::register_exception_translator([](std::exception_ptr p)
|
||||||
// py::register_exception<Standard_Failure>(m, "OCC-Exception");
|
{
|
||||||
|
try {
|
||||||
|
if(p) std::rethrow_exception(p);
|
||||||
|
} catch (const Standard_Failure& e) {
|
||||||
|
exc((string(e.DynamicType()->Name()) + ": " + e.GetMessageString()).c_str());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
py::class_<OCCGeometry, shared_ptr<OCCGeometry>, NetgenGeometry> (m, "OCCGeometry", R"raw_string(Use LoadOCCGeometry to load the geometry from a *.step file.)raw_string")
|
py::class_<OCCGeometry, shared_ptr<OCCGeometry>, NetgenGeometry> (m, "OCCGeometry", R"raw_string(Use LoadOCCGeometry to load the geometry from a *.step file.)raw_string")
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user