Part:: Geometry container extend hasExtension to type and name

This commit is contained in:
Abdullah Tahiri
2019-02-11 16:21:40 +01:00
committed by wmayer
parent 4d9d3b0c83
commit d8e99c1923
4 changed files with 68 additions and 0 deletions

View File

@@ -291,6 +291,53 @@ PyObject* GeometryPy::getExtension(PyObject *args)
return 0;
}
PyObject* GeometryPy::hasExtensionType(PyObject *args)
{
char* o;
if (PyArg_ParseTuple(args, "s", &o)) {
Base::Type type = Base::Type::fromName(o);
if(type != Base::Type::badType()) {
try {
return Py::new_reference_to(Py::Boolean(this->getGeometryPtr()->hasExtension(type)));
}
catch(Base::ValueError e) {
PyErr_SetString(PartExceptionOCCError, e.what());
return 0;
}
}
else
{
PyErr_SetString(PartExceptionOCCError, "Exception type does not exist");
return 0;
}
}
PyErr_SetString(PartExceptionOCCError, "A string with the type of the geometry extension was expected");
return 0;
}
PyObject* GeometryPy::hasExtensionName(PyObject *args)
{
char* o;
if (PyArg_ParseTuple(args, "s", &o)) {
try {
return Py::new_reference_to(Py::Boolean(this->getGeometryPtr()->hasExtension(std::string(o))));
}
catch(Base::ValueError e) {
PyErr_SetString(PartExceptionOCCError, e.what());
return 0;
}
}
PyErr_SetString(PartExceptionOCCError, "A string with the type of the geometry extension was expected");
return 0;
}
PyObject* GeometryPy::deleteExtensionType(PyObject *args)
{
char* o;