Attacher: Py: add interface for changing attacher type

Plus a mechanism to remember attacher type of AttachableObject through
save-restore cycle.
This commit is contained in:
DeepSOIC
2016-05-06 21:52:23 +03:00
parent c040ee7333
commit 41bae90d28
4 changed files with 86 additions and 2 deletions

View File

@@ -34,6 +34,25 @@ PyObject* AttachableObjectPy::positionBySupport(PyObject *args)
return Py::new_reference_to(Py::Boolean(bAttached));
}
PyObject* AttachableObjectPy::changeAttacherType(PyObject *args)
{
const char* typeName;
if (!PyArg_ParseTuple(args, "s", &typeName))
return 0;
bool ret;
try{
ret = this->getAttachableObjectPtr()->changeAttacherType(typeName);
} catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return NULL;
} catch (Base::Exception &e) {
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return NULL;
}
return Py::new_reference_to(Py::Boolean(ret));
}
PyObject *AttachableObjectPy::getCustomAttributes(const char* /*attr*/) const
{