PD: Improve error handling for RevolMethod::ToFirst

(cherry picked from commit 9e042ff480)
This commit is contained in:
Chris Hennes
2026-02-13 21:21:25 +01:00
committed by Max Wilfinger
parent 0f338003dd
commit 0439a998f1
3 changed files with 16 additions and 6 deletions
+2 -3
View File
@@ -192,9 +192,8 @@ App::DocumentObjectExecReturn* Groove::execute()
upToFace.move(invObjLoc);
}
else {
throw Base::RuntimeError(
"ProfileBased: Revolution up to first/last is not yet supported"
);
// TODO: Implement finding the first face this revolution would intersect with
return new App::DocumentObjectExecReturn("Groove up to first is not yet supported");
}
if (Reversed.getValue()) {
+2 -3
View File
@@ -214,9 +214,8 @@ App::DocumentObjectExecReturn* Revolution::execute()
upToFace.move(invObjLoc);
}
else {
throw Base::RuntimeError(
"ProfileBased: Revolution up to first/last is not yet supported"
);
// TODO: Implement finding the first face this revolution would intersect with
return new App::DocumentObjectExecReturn("Revolve up to first is not yet supported");
}
if (Reversed.getValue()) {
@@ -44,6 +44,8 @@
#include "ViewProviderRevolution.h"
#include "ReferenceSelection.h"
#include <QStandardItemModel>
using namespace PartDesignGui;
using namespace Gui;
@@ -200,6 +202,16 @@ void TaskRevolutionParameters::translateModeList(int index)
ui->changeMode->addItem(tr("Through all"));
}
ui->changeMode->addItem(tr("To first"));
// "To first" is not available for revolutions right now, but if we just don't add it, the index
// will be wrong. So disable it instead. Messy workaround for #27403
auto toFirstIndex = ui->changeMode->count() - 1;
auto* model = qobject_cast<QStandardItemModel*>(ui->changeMode->model());
if (model) {
QStandardItem* item = model->item(toFirstIndex);
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
}
ui->changeMode->addItem(tr("Up to face"));
ui->changeMode->addItem(tr("Two angles"));
ui->changeMode->setCurrentIndex(index);