From 0ea5b9923bab5f28f28186d30675dc411344602d Mon Sep 17 00:00:00 2001 From: WandererFan Date: Thu, 1 Feb 2018 18:56:55 -0500 Subject: [PATCH] Fix CmdTechDrawProjGroup Selection Criteria - CmdTechDrawProjGroup was not allowing Body or App::Part to be selected as Source for new ProjectionGroup even though DPG handles both. --- src/Mod/TechDraw/Gui/Command.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Mod/TechDraw/Gui/Command.cpp b/src/Mod/TechDraw/Gui/Command.cpp index 21ab78c6bc..02f0103d2f 100644 --- a/src/Mod/TechDraw/Gui/Command.cpp +++ b/src/Mod/TechDraw/Gui/Command.cpp @@ -33,8 +33,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -253,12 +255,17 @@ void CmdTechDrawNewView::activated(int iMsg) return; } - std::vector shapes = getSelection().getObjectsOfType(App::DocumentObject::getClassTypeId()); - if (shapes.empty()) { + std::vector shapes = getSelection().getObjectsOfType(App::GeoFeature::getClassTypeId()); + std::vector groups = getSelection().getObjectsOfType(App::DocumentObjectGroup::getClassTypeId()); + if ((shapes.empty()) && + (groups.empty())) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Can not make a View from this selection")); return; } + if (!groups.empty()) { + shapes.insert(shapes.end(),groups.begin(),groups.end()); + } std::string PageName = page->getNameInDocument(); @@ -446,12 +453,17 @@ void CmdTechDrawProjGroup::activated(int iMsg) return; } - std::vector shapes = getSelection().getObjectsOfType(Part::Feature::getClassTypeId()); - if (shapes.empty()) { + std::vector shapes = getSelection().getObjectsOfType(App::GeoFeature::getClassTypeId()); + std::vector groups = getSelection().getObjectsOfType(App::DocumentObjectGroup::getClassTypeId()); + if ((shapes.empty()) && + (groups.empty())) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), - QObject::tr("Can not make a ProjectionGroup from this selection.")); + QObject::tr("Can not make a ProjectionGroup from this selection")); return; } + if (!groups.empty()) { + shapes.insert(shapes.end(),groups.begin(),groups.end()); + } std::string PageName = page->getNameInDocument();