From 0ff0359524228e971158d5d13aef0092c1ab6668 Mon Sep 17 00:00:00 2001 From: PaddleStroke Date: Fri, 7 Nov 2025 21:34:59 +0100 Subject: [PATCH] PartDesign: Fix 'UpToShape' not saving correctly --- .../PartDesign/Gui/TaskExtrudeParameters.cpp | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp b/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp index a6128d00b0..3460be95c9 100644 --- a/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp @@ -123,6 +123,12 @@ void TaskExtrudeParameters::setupSideDialog(SideController& side) Base::Quantity offset = side.Offset->getQuantityValue(); Base::Quantity taper = side.TaperAngle->getQuantityValue(); int typeIndex = side.Type->getValue(); + // The Type/Type2 properties are stuck with the deprecated 'TwoLength' mode. + // Because enums do not store text just an index. So this create + // a inconsistence between the UI and the property. + if (typeIndex > static_cast(Mode::ToShape)) { + typeIndex --; + } // --- Set up UI widgets with initial values --- side.lengthEdit->setValue(length); @@ -1287,6 +1293,16 @@ void TaskExtrudeParameters::applyParameters() facename2 = getFaceName(ui->lineFaceName2); } + // Handle deprecated 'TwoLength' mode. + int type1 = getMode(); + if (static_cast(type1) == Mode::ToShape) { + type1++; + } + int type2 = getMode2(); + if (static_cast(type2) == Mode::ToShape) { + type2++; + } + ui->lengthEdit->apply(); ui->lengthEdit2->apply(); ui->taperEdit->apply(); @@ -1298,8 +1314,8 @@ void TaskExtrudeParameters::applyParameters() FCMD_OBJ_CMD(obj, "ReferenceAxis = " << getReferenceAxis()); FCMD_OBJ_CMD(obj, "AlongSketchNormal = " << (getAlongSketchNormal() ? 1 : 0)); FCMD_OBJ_CMD(obj, "SideType = " << getSidesMode()); - FCMD_OBJ_CMD(obj, "Type = " << getMode()); - FCMD_OBJ_CMD(obj, "Type2 = " << getMode2()); + FCMD_OBJ_CMD(obj, "Type = " << type1); + FCMD_OBJ_CMD(obj, "Type2 = " << type2); FCMD_OBJ_CMD(obj, "UpToFace = " << facename.toLatin1().data()); FCMD_OBJ_CMD(obj, "UpToFace2 = " << facename2.toLatin1().data()); FCMD_OBJ_CMD(obj, "Reversed = " << (getReversed() ? 1 : 0)); @@ -1456,3 +1472,4 @@ bool TaskDlgExtrudeParameters::reject() +