Skip to content

Commit

Permalink
+ do not accept objects with no sub-elements selected if this is requ…
Browse files Browse the repository at this point in the history
…ired
  • Loading branch information
wwmayer committed May 16, 2014
1 parent 0b7b0ec commit 624537e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Gui/SelectionFilter.cpp
Expand Up @@ -192,6 +192,8 @@ bool SelectionFilter::match(void)
int subCount=0;
for (std::vector<Gui::SelectionObject>::const_iterator it2=temp.begin();it2!=temp.end();++it2) {
const std::vector<std::string>& subNames = it2->getSubNames();
if (subNames.empty())
return false;
for (std::vector<std::string>::const_iterator it3=subNames.begin();it3!=subNames.end();++it3) {
if (it3->find((*it)->SubName) != 0)
return false;
Expand Down
9 changes: 8 additions & 1 deletion src/Mod/Sketcher/Gui/Command.cpp
Expand Up @@ -83,7 +83,14 @@ void CmdSketcherNewSketch::activated(int iMsg)
Part::Feature *part = static_cast<Part::Feature*>(FaceFilter.Result[0][0].getObject());
Base::Placement ObjectPos = part->Placement.getValue();
const std::vector<std::string> &sub = FaceFilter.Result[0][0].getSubNames();
if (sub.size() > 1){
if (sub.empty()) {
// No assert for wrong user input!
QMessageBox::warning(Gui::getMainWindow(),
qApp->translate(className(),"No sub-elements selected"),
qApp->translate(className(),"You have to select a single face as support for a sketch!"));
return;
}
else if (sub.size() > 1) {
// No assert for wrong user input!
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Several sub-elements selected"),
QObject::tr("You have to select a single face as support for a sketch!"));
Expand Down

0 comments on commit 624537e

Please sign in to comment.