getActivePart() python function as complement to setActivePart()

This commit is contained in:
jrheinlaender
2013-08-31 17:01:39 +02:00
committed by Stefan Tröger
parent f7874306b9
commit 5c18e947e6
2 changed files with 60 additions and 27 deletions

View File

@@ -78,10 +78,22 @@ static PyObject * setActivePart(PyObject *self, PyObject *args)
Py_Return;
}
static PyObject * getActivePart(PyObject *, PyObject *)
{
if (PartDesignGui::ActivePartObject == NULL) {
return Py::_None();
}
return PartDesignGui::ActivePartObject->getPyObject();
}
/* registration table */
struct PyMethodDef Assembly_methods[] = {
{"setActivePart" ,setActivePart ,METH_VARARGS,
"setActivePart(BodyObject) -- Set the PartBody object in work."},
{"getActivePart" ,getActivePart ,METH_NOARGS,
"getActivePart() -- Get the PartBody object in work."},
{NULL, NULL} /* end of table marker */
};