diff --git a/src/Mod/PartDesign/App/Feature.cpp b/src/Mod/PartDesign/App/Feature.cpp index 959a429e65..b519137eda 100644 --- a/src/Mod/PartDesign/App/Feature.cpp +++ b/src/Mod/PartDesign/App/Feature.cpp @@ -98,12 +98,11 @@ App::DocumentObjectExecReturn* Feature::recompute() FC_ERR("Failed to recompute suppressed feature " << getFullName()); } + Shape.setValue(getBaseTopoShape(true)); + if (!failed) { updateSuppressedShape(); } - else { - Shape.setValue(getBaseTopoShape(true)); - } return App::DocumentObject::StdReturn; } @@ -121,7 +120,6 @@ void Feature::setMaterialToBodyMaterial() void Feature::updateSuppressedShape() { - auto baseShape = getBaseTopoShape(true); TopoShape res(getID()); TopoShape shape = Shape.getShape(); shape.setPlacement(Base::Placement()); @@ -139,7 +137,6 @@ void Feature::updateSuppressedShape() res.makeElementCompound(generated); res.setPlacement(Placement.getValue()); } - Shape.setValue(baseShape); SuppressedShape.setValue(res); } @@ -196,6 +193,13 @@ void Feature::onChanged(const App::Property *prop) body->ShapeMaterial.setValue(ShapeMaterial.getValue()); } } + } else if (prop == &Suppressed){ + if (Suppressed.getValue()) { + SuppressedPlacement = Placement.getValue(); + } else { + Placement.setValue(SuppressedPlacement); + SuppressedPlacement = Base::Placement(); + } } } Part::Feature::onChanged(prop); diff --git a/src/Mod/PartDesign/App/Feature.h b/src/Mod/PartDesign/App/Feature.h index cda66bcd30..c85524e809 100644 --- a/src/Mod/PartDesign/App/Feature.h +++ b/src/Mod/PartDesign/App/Feature.h @@ -60,6 +60,8 @@ public: /// Keep a copy of suppressed shapes so that we can restore them (and maybe display them) Part::PropertyPartShape SuppressedShape; + /// Keep a copy of the placement before suppression to restore it back when unsuppressed, fix #20205 + Base::Placement SuppressedPlacement; App::DocumentObjectExecReturn* recompute() override; short mustExecute() const override;