#include "PreCompiled.h" #include #include "DrawProjGroup.h" #include "DrawProjGroupItem.h" // inclusion of the generated files (generated out of DrawProjGroupPy.xml) #include #include #include using namespace TechDraw; // returns a string which represents the object e.g. when printed in python std::string DrawProjGroupPy::representation(void) const { return std::string(""); } PyObject* DrawProjGroupPy::addProjection(PyObject* args) { const char* projType; if (!PyArg_ParseTuple(args, "s", &projType)) { throw Py::Exception(); } DrawProjGroup* projGroup = getDrawProjGroupPtr(); App::DocumentObject* docObj = projGroup->addProjection(projType); TechDraw::DrawProjGroupItem* newProj = dynamic_cast( docObj ); return new DrawProjGroupItemPy(newProj); } PyObject* DrawProjGroupPy::removeProjection(PyObject* args) { const char* projType; if (!PyArg_ParseTuple(args, "s", &projType)) { throw Py::Exception(); } DrawProjGroup* projGroup = getDrawProjGroupPtr(); int i = projGroup->removeProjection(projType); return PyInt_FromLong((long) i);; } PyObject* DrawProjGroupPy::purgeProjections(PyObject* /*args*/) { DrawProjGroup* projGroup = getDrawProjGroupPtr(); int i = projGroup->purgeProjections(); return PyInt_FromLong((long) i);; } PyObject* DrawProjGroupPy::getItemByLabel(PyObject* args) { const char* projType; if (!PyArg_ParseTuple(args, "s", &projType)) { throw Py::Exception(); } DrawProjGroup* projGroup = getDrawProjGroupPtr(); App::DocumentObject* docObj = projGroup->getProjObj(projType); TechDraw::DrawProjGroupItem* newProj = dynamic_cast( docObj ); return new DrawProjGroupItemPy(newProj); } //TODO: this is no longer required? PyObject* DrawProjGroupPy::setViewOrientation(PyObject* args) { const char* projType; PyObject* pcObj; if (!PyArg_ParseTuple(args, "Os", &pcObj,&projType)) throw Py::Exception(); // App::DocumentObject* obj = static_cast(pcObj)->getDocumentObjectPtr(); // if (obj->getTypeId().isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) { // TechDraw::DrawProjGroupItem* view = static_cast(obj); // TechDraw::DrawProjGroup* projGroup = getDrawProjGroupPtr(); // projGroup->setViewOrientation( view, projType ); // } else { // Base::Console().Message("'%s' is not a DrawProjGroup Item, it will be ignored.\n", obj->Label.getValue()); // } return Py_None; } PyObject *DrawProjGroupPy::getCustomAttributes(const char* /*attr*/) const { return 0; } int DrawProjGroupPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) { return 0; }