FreeCAD/src/Mod/TechDraw/App/DrawViewCollectionPyImp.cpp
2016-09-11 13:12:24 -04:00

63 lines
1.8 KiB
C++

#include "PreCompiled.h"
#include "DrawViewCollection.h"
// inclusion of the generated files (generated out of DrawViewCollectionPy.xml)
#include <Mod/TechDraw/App/DrawViewCollectionPy.h>
#include <Mod/TechDraw/App/DrawViewCollectionPy.cpp>
using namespace TechDraw;
// returns a string which represents the object e.g. when printed in python
std::string DrawViewCollectionPy::representation(void) const
{
return std::string("<DrawViewCollection object>");
}
PyObject* DrawViewCollectionPy::addView(PyObject* args)
{
PyObject *pcDocObj;
if (!PyArg_ParseTuple(args, "O!", &(App::DocumentObjectPy::Type), &pcDocObj)) {
Base::Console().Error("Error: DrawViewClipPy::addView - Bad Arg - not DocumentObject\n");
return NULL;
}
DrawViewCollection* collect = getDrawViewCollectionPtr();
DrawViewPy* pyView = static_cast<TechDraw::DrawViewPy*>(pcDocObj);
DrawView* view = pyView->getDrawViewPtr(); //get DrawView for pyView
int i = collect->addView(view);
return PyInt_FromLong((long) i);
}
PyObject* DrawViewCollectionPy::removeView(PyObject* args)
{
PyObject *pcDocObj;
if (!PyArg_ParseTuple(args, "O!", &(App::DocumentObjectPy::Type), &pcDocObj)) {
Base::Console().Error("Error: DrawViewClipPy::addView - Bad Arg - not DocumentObject\n");
return NULL;
}
DrawViewCollection* collect = getDrawViewCollectionPtr();
DrawViewPy* pyView = static_cast<TechDraw::DrawViewPy*>(pcDocObj);
DrawView* view = pyView->getDrawViewPtr(); //get DrawView for pyView
int i = collect->removeView(view);
return PyInt_FromLong((long) i);
}
PyObject *DrawViewCollectionPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
}
int DrawViewCollectionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}