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.
This commit is contained in:
WandererFan
2018-02-01 18:56:55 -05:00
parent d2aba05eed
commit 0ea5b9923b

View File

@@ -33,8 +33,10 @@
#include <App/Application.h>
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <App/DocumentObjectGroup.h>
#include <App/FeaturePython.h>
#include <App/PropertyGeo.h>
#include <App/GeoFeature.h>
#include <Base/Console.h>
#include <Base/Exception.h>
#include <Base/Parameter.h>
@@ -253,12 +255,17 @@ void CmdTechDrawNewView::activated(int iMsg)
return;
}
std::vector<App::DocumentObject*> shapes = getSelection().getObjectsOfType(App::DocumentObject::getClassTypeId());
if (shapes.empty()) {
std::vector<App::DocumentObject*> shapes = getSelection().getObjectsOfType(App::GeoFeature::getClassTypeId());
std::vector<App::DocumentObject*> 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<App::DocumentObject*> shapes = getSelection().getObjectsOfType(Part::Feature::getClassTypeId());
if (shapes.empty()) {
std::vector<App::DocumentObject*> shapes = getSelection().getObjectsOfType(App::GeoFeature::getClassTypeId());
std::vector<App::DocumentObject*> 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();