From b4b35eb2957205709aa4c75b20989b633a62d6dd Mon Sep 17 00:00:00 2001 From: logari81 Date: Mon, 17 Sep 2012 16:28:34 +0200 Subject: [PATCH] PartDesign: avoid selecting origin for transformed features silently --- src/Mod/PartDesign/Gui/Command.cpp | 66 ++++++++++++++---------------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 81c3be306..cd584a3f0 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -729,18 +729,17 @@ void CmdPartDesignMirrored::activated(int iMsg) features = getDocument()->getObjectsOfType(PartDesign::Additive::getClassTypeId()); subtractive = getDocument()->getObjectsOfType(PartDesign::Subtractive::getClassTypeId()); features.insert(features.end(), subtractive.begin(), subtractive.end()); - if (features.size() == 0) { + // If there is more than one selected or eligible object, show dialog and let user pick one + if (features.size() > 1) { + PartDesignGui::FeaturePickDialog Dlg(features); + if ((Dlg.exec() != QDialog::Accepted) || (features = Dlg.getFeatures()).empty()) + return; // Cancelled or nothing selected + } else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No valid features in this document"), QObject::tr("Please create a subtractive or additive feature first, please")); return; } } - // If there is more than one selected or eligible object, show dialog and let user pick one - if (features.size() > 1) { - PartDesignGui::FeaturePickDialog Dlg(features); - if ((Dlg.exec() != QDialog::Accepted) || (features = Dlg.getFeatures()).empty()) - return; // Cancelled or nothing selected - } std::string FeatName = getUniqueObjectName("Mirrored"); @@ -804,19 +803,17 @@ void CmdPartDesignLinearPattern::activated(int iMsg) features = getDocument()->getObjectsOfType(PartDesign::Additive::getClassTypeId()); subtractive = getDocument()->getObjectsOfType(PartDesign::Subtractive::getClassTypeId()); features.insert(features.end(), subtractive.begin(), subtractive.end()); - if (features.size() == 0) { + // If there is more than one selected or eligible object, show dialog and let user pick one + if (features.size() > 1) { + PartDesignGui::FeaturePickDialog Dlg(features); + if ((Dlg.exec() != QDialog::Accepted) || (features = Dlg.getFeatures()).empty()) + return; // Cancelled or nothing selected + } else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No valid features in this document"), QObject::tr("Please create a subtractive or additive feature first, please")); return; } } - // If there is more than one selected or eligible object, show dialog and let user pick one - if (features.size() > 1) { - PartDesignGui::FeaturePickDialog Dlg(features); - if ((Dlg.exec() != QDialog::Accepted) || (features = Dlg.getFeatures()).empty()) - return; // Cancelled or nothing selected - } - std::string FeatName = getUniqueObjectName("LinearPattern"); @@ -880,18 +877,17 @@ void CmdPartDesignPolarPattern::activated(int iMsg) features = getDocument()->getObjectsOfType(PartDesign::Additive::getClassTypeId()); subtractive = getDocument()->getObjectsOfType(PartDesign::Subtractive::getClassTypeId()); features.insert(features.end(), subtractive.begin(), subtractive.end()); - if (features.size() == 0) { + // If there is more than one selected or eligible object, show dialog and let user pick one + if (features.size() > 1) { + PartDesignGui::FeaturePickDialog Dlg(features); + if ((Dlg.exec() != QDialog::Accepted) || (features = Dlg.getFeatures()).empty()) + return; // Cancelled or nothing selected + } else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No valid features in this document"), QObject::tr("Please create a subtractive or additive feature first, please")); return; } } - // If there is more than one selected or eligible object, show dialog and let user pick one - if (features.size() > 1) { - PartDesignGui::FeaturePickDialog Dlg(features); - if ((Dlg.exec() != QDialog::Accepted) || (features = Dlg.getFeatures()).empty()) - return; // Cancelled or nothing selected - } std::string FeatName = getUniqueObjectName("PolarPattern"); @@ -955,18 +951,17 @@ void CmdPartDesignScaled::activated(int iMsg) features = getDocument()->getObjectsOfType(PartDesign::Additive::getClassTypeId()); subtractive = getDocument()->getObjectsOfType(PartDesign::Subtractive::getClassTypeId()); features.insert(features.end(), subtractive.begin(), subtractive.end()); - if (features.size() == 0) { + // If there is more than one selected or eligible object, show dialog and let user pick one + if (features.size() > 1) { + PartDesignGui::FeaturePickDialog Dlg(features); + if ((Dlg.exec() != QDialog::Accepted) || (features = Dlg.getFeatures()).empty()) + return; // Cancelled or nothing selected + } else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No valid features in this document"), QObject::tr("Please create a subtractive or additive feature first, please")); return; } } - // If there is more than one selected or eligible object, show dialog and let user pick one - if (features.size() > 1) { - PartDesignGui::FeaturePickDialog Dlg(features); - if ((Dlg.exec() != QDialog::Accepted) || (features = Dlg.getFeatures()).empty()) - return; // Cancelled or nothing selected - } std::string FeatName = getUniqueObjectName("Scaled"); @@ -1029,18 +1024,17 @@ void CmdPartDesignMultiTransform::activated(int iMsg) features = getDocument()->getObjectsOfType(PartDesign::Additive::getClassTypeId()); subtractive = getDocument()->getObjectsOfType(PartDesign::Subtractive::getClassTypeId()); features.insert(features.end(), subtractive.begin(), subtractive.end()); - if (features.size() == 0) { + // If there is more than one selected or eligible object, show dialog and let user pick one + if (features.size() > 1) { + PartDesignGui::FeaturePickDialog Dlg(features); + if ((Dlg.exec() != QDialog::Accepted) || (features = Dlg.getFeatures()).empty()) + return; // Cancelled or nothing selected + } else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No valid features in this document"), QObject::tr("Please create a subtractive or additive feature first, please")); return; } } - // If there is more than one selected or eligible object, show dialog and let user pick one - if (features.size() > 1) { - PartDesignGui::FeaturePickDialog Dlg(features); - if ((Dlg.exec() != QDialog::Accepted) || (features = Dlg.getFeatures()).empty()) - return; // Cancelled or nothing selected - } std::string FeatName = getUniqueObjectName("MultiTransform");