diff --git a/src/Mod/TechDraw/App/DrawPage.cpp b/src/Mod/TechDraw/App/DrawPage.cpp index 2ea5bb822..a9010ab73 100644 --- a/src/Mod/TechDraw/App/DrawPage.cpp +++ b/src/Mod/TechDraw/App/DrawPage.cpp @@ -237,9 +237,9 @@ int DrawPage::addView(App::DocumentObject *docObj) { if(!docObj->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) return -1; + DrawView* view = static_cast(docObj); //position all new views in center of Page (exceptDVDimension) - DrawView* view = static_cast(docObj); if (!docObj->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) { view->X.setValue(getPageWidth()/2.0); view->Y.setValue(getPageHeight()/2.0); diff --git a/src/Mod/TechDraw/App/DrawPagePyImp.cpp b/src/Mod/TechDraw/App/DrawPagePyImp.cpp index daaaaac5b..a85b1fc6c 100644 --- a/src/Mod/TechDraw/App/DrawPagePyImp.cpp +++ b/src/Mod/TechDraw/App/DrawPagePyImp.cpp @@ -27,11 +27,8 @@ PyObject* DrawPagePy::addView(PyObject* args) PyObject *pcDocObj; if (!PyArg_ParseTuple(args, "O!", &(App::DocumentObjectPy::Type), &pcDocObj)) { - Base::Console().Error("Error: DrawPagePy::addView - Bad Arg - not DocumentObject\n"); - return NULL; - //TODO: sb PyErr?? - //PyErr_SetString(PyExc_TypeError,"addView expects a DrawView"); - //return -1; + PyErr_SetString(PyExc_TypeError, "DrawPagePy::AddView - Bad Arg - not DocumentObject"); + return nullptr; } DrawPage* page = getDrawPagePtr(); //get DrawPage for pyPage @@ -52,11 +49,8 @@ PyObject* DrawPagePy::removeView(PyObject* args) PyObject *pcDocObj; if (!PyArg_ParseTuple(args, "O!", &(App::DocumentObjectPy::Type), &pcDocObj)) { - Base::Console().Error("Error: DrawPagePy::removeView - Bad Arg - not DocumentObject\n"); - return NULL; - //TODO: sb PyErr?? - //PyErr_SetString(PyExc_TypeError,"removeView expects a DrawView"); - //return -1; + PyErr_SetString(PyExc_TypeError, "DrawPagePy::removeView - Bad Arg - not DocumentObject"); + return nullptr; } DrawPage* page = getDrawPagePtr(); //get DrawPage for pyPage diff --git a/src/Mod/TechDraw/App/DrawViewCollection.cpp b/src/Mod/TechDraw/App/DrawViewCollection.cpp index acb29de81..4c0de80e3 100644 --- a/src/Mod/TechDraw/App/DrawViewCollection.cpp +++ b/src/Mod/TechDraw/App/DrawViewCollection.cpp @@ -135,8 +135,7 @@ int DrawViewCollection::countChildren() const std::vector &views = Views.getValues(); for(std::vector::const_iterator it = views.begin(); it != views.end(); ++it) { - App::DocumentObject *docObj = static_cast(*it); - if(docObj->getTypeId().isDerivedFrom(TechDraw::DrawViewCollection::getClassTypeId())) { + if((*it)->getTypeId().isDerivedFrom(TechDraw::DrawViewCollection::getClassTypeId())) { TechDraw::DrawViewCollection *viewCollection = static_cast(*it); numChildren += viewCollection->countChildren() + 1; } else { diff --git a/src/Mod/TechDraw/App/DrawViewCollectionPyImp.cpp b/src/Mod/TechDraw/App/DrawViewCollectionPyImp.cpp index 1fe97d292..6c2780206 100644 --- a/src/Mod/TechDraw/App/DrawViewCollectionPyImp.cpp +++ b/src/Mod/TechDraw/App/DrawViewCollectionPyImp.cpp @@ -19,8 +19,8 @@ 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; + PyErr_SetString(PyExc_TypeError, "DrawViewCollectionPy::addView - Bad Arg - not DocumentObject"); + return nullptr; } DrawViewCollection* collect = getDrawViewCollectionPtr(); @@ -37,8 +37,8 @@ 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; + PyErr_SetString(PyExc_TypeError, "DrawViewCollectionPy::removeView - Bad Arg - not DocumentObject"); + return nullptr; } DrawViewCollection* collect = getDrawViewCollectionPtr();