[PD] fix issue 3968
https://tracker.freecadweb.org/view.php?id=3968 Don't set the tip to features that cannot hold the tip
This commit is contained in:
@@ -842,13 +842,13 @@ void CmdPartDesignMoveFeatureInTree::activated(int iMsg)
|
||||
bool allFeaturesFromSameBody = true;
|
||||
|
||||
if ( body ) {
|
||||
bodyBase= body->BaseFeature.getValue();
|
||||
bodyBase = body->BaseFeature.getValue();
|
||||
for ( auto feat: features ) {
|
||||
if ( !body->hasObject ( feat ) ) {
|
||||
allFeaturesFromSameBody = false;
|
||||
break;
|
||||
}
|
||||
if ( bodyBase== feat) {
|
||||
if ( bodyBase == feat) {
|
||||
QMessageBox::warning (0, QObject::tr( "Selection error" ),
|
||||
QObject::tr( "Impossible to move the base feature of a body." ) );
|
||||
return;
|
||||
@@ -943,17 +943,19 @@ void CmdPartDesignMoveFeatureInTree::activated(int iMsg)
|
||||
|
||||
// If the selected objects have been moved after the current tip then ask the
|
||||
// user if he wants the last object to be the new tip.
|
||||
if (lastObject && body->Tip.getValue() == target) {
|
||||
// Only do this for features that can hold a tip (not for e.g. datums)
|
||||
if ( lastObject && body->Tip.getValue() == target
|
||||
&& lastObject->isDerivedFrom(PartDesign::Feature::getClassTypeId()) ) {
|
||||
QMessageBox msgBox(Gui::getMainWindow());
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
msgBox.setWindowTitle(qApp->translate("PartDesign_MoveFeatureInTree","Move tip"));
|
||||
msgBox.setText(qApp->translate("PartDesign_MoveFeatureInTree","The moved feature appears after the currently set tip."));
|
||||
msgBox.setInformativeText(qApp->translate("PartDesign_MoveFeatureInTree","Do you want the last feature to be the new tip?"));
|
||||
msgBox.setWindowTitle(qApp->translate("PartDesign_MoveFeatureInTree", "Move tip"));
|
||||
msgBox.setText(qApp->translate("PartDesign_MoveFeatureInTree", "The moved feature appears after the currently set tip."));
|
||||
msgBox.setInformativeText(qApp->translate("PartDesign_MoveFeatureInTree", "Do you want the last feature to be the new tip?"));
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
msgBox.setDefaultButton(QMessageBox::No);
|
||||
int ret = msgBox.exec();
|
||||
if (ret == QMessageBox::Yes)
|
||||
FCMD_OBJ_CMD(body,"Tip = " << getObjectCmd(lastObject));
|
||||
FCMD_OBJ_CMD(body, "Tip = " << getObjectCmd(lastObject));
|
||||
}
|
||||
|
||||
updateActive();
|
||||
|
||||
Reference in New Issue
Block a user