check for correct selection in Symmetry and Array sketcher commands

This commit is contained in:
wmayer
2017-09-27 19:12:30 +02:00
parent b3a1e8abbd
commit a2bfe1bbe1

View File

@@ -832,6 +832,12 @@ void CmdSketcherSymmetry::activated(int iMsg)
// get the needed lists and objects
const std::vector<std::string> &SubNames = selection[0].getSubNames();
if (SubNames.empty()) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
return;
}
Sketcher::SketchObject* Obj = static_cast<Sketcher::SketchObject*>(selection[0].getObject());
getSelection().clearSelection();
@@ -1620,6 +1626,12 @@ void CmdSketcherRectangularArray::activated(int iMsg)
// get the needed lists and objects
const std::vector<std::string> &SubNames = selection[0].getSubNames();
if (SubNames.empty()) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
return;
}
Sketcher::SketchObject* Obj = static_cast<Sketcher::SketchObject*>(selection[0].getObject());
getSelection().clearSelection();