PartDesign: Extrude: Fix twoLength/uptoshape broken (#23812)

* PartDesign: Extrude: Fix twoLength/uptoshape broken

* Update FeaturePocket.cpp

* Update FeatureExtrude.cpp

* fix test
This commit is contained in:
PaddleStroke
2025-09-10 19:12:02 +02:00
committed by GitHub
parent 8aa527119b
commit aef10a1bc8
4 changed files with 14 additions and 4 deletions

View File

@@ -740,7 +740,7 @@ TopoShape FeatureExtrude::generateSingleExtrusionSide(const TopoShape& sketchsha
void FeatureExtrude::onDocumentRestored()
{
// property Type no longer has TwoLengths.
if (strcmp(Type.getValueAsString(), "TwoLengths") == 0) {
if (strcmp(Type.getValueAsString(), "?TwoLengths") == 0) {
Type.setValue("Length");
Type2.setValue("Length");
SideType.setValue("Two sides");

View File

@@ -38,7 +38,11 @@
using namespace PartDesign;
const char* Pad::TypeEnums[]= {"Length", "UpToLast", "UpToFirst", "UpToFace", "UpToShape", nullptr};
// Note, TwoLengths has been deprecated by #21794. We do not remove it from the ui
// because the files store the enum index. So it is not possible to migrate files if the
// enum entry is removed (see #23612). In the distant future, when all files are reasonably
// migrated we can drop this.
const char* Pad::TypeEnums[]= {"Length", "UpToLast", "UpToFirst", "UpToFace", "?TwoLengths", "UpToShape", nullptr};
PROPERTY_SOURCE(PartDesign::Pad, PartDesign::FeatureExtrude)
@@ -82,3 +86,4 @@ App::DocumentObjectExecReturn* Pad::execute()
{
return buildExtrusion(ExtrudeOption::MakeFace | ExtrudeOption::MakeFuse);
}

View File

@@ -39,7 +39,11 @@ using namespace PartDesign;
/* TRANSLATOR PartDesign::Pocket */
const char* Pocket::TypeEnums[]= {"Length", "ThroughAll", "UpToFirst", "UpToFace", "UpToShape", nullptr};
// Note, TwoLengths has been deprecated by #21794. We do not remove it from the ui
// because the files store the enum index. So it is not possible to migrate files if the
// enum entry is removed (see #23612). In the distant future, when all files are reasonably
// migrated we can drop this.
const char* Pocket::TypeEnums[]= {"Length", "ThroughAll", "UpToFirst", "UpToFace", "?TwoLengths", "UpToShape", nullptr};
PROPERTY_SOURCE(PartDesign::Pocket, PartDesign::FeatureExtrude)
@@ -94,3 +98,4 @@ Base::Vector3d Pocket::getProfileNormal() const
// turn around for pockets
return res * -1;
}

View File

@@ -238,7 +238,7 @@ class TestPad(unittest.TestCase):
self.Pad1 = self.Doc.addObject("PartDesign::Pad", "Pad1")
self.Body.addObject(self.Pad1)
self.Pad1.Profile = self.PadSketch1
self.Pad1.Type = 4
self.Pad1.Type = 5
self.Doc.recompute()
self.assertAlmostEqual(self.Pad1.Shape.Volume, 2.58787, places=4)