+ do not accept objects with no sub-elements selected if this is required

This commit is contained in:
wmayer 2014-05-16 19:09:15 +02:00
parent 0b7b0ecc21
commit 624537e5b6
2 changed files with 10 additions and 1 deletions

View File

@ -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;

View File

@ -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!"));