From a87c8dca31ea83f32e40e32b0ec5c6517d0599b7 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 15 Dec 2021 15:13:03 +0100 Subject: [PATCH] PD: hide the profile of a sketch based feature only if it can be recomputed successfully --- .../PartDesign/Gui/TaskSketchBasedParameters.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp b/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp index 1f1c5ba27c..3141bc9fe2 100644 --- a/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -266,15 +267,19 @@ bool TaskDlgSketchBasedParameters::accept() { // Make sure the feature is what we are expecting // Should be fine but you never know... - if ( !feature->getTypeId().isDerivedFrom(PartDesign::ProfileBased::getClassTypeId()) ) { + if (!feature->getTypeId().isDerivedFrom(PartDesign::ProfileBased::getClassTypeId())) { throw Base::TypeError("Bad object processed in the sketch based dialog."); } - App::DocumentObject* sketch = static_cast(feature)->Profile.getValue(); + // First verify that the feature can be built and then hide the profile as otherwise + // it will remain hidden if the feature's recompute fails + if (TaskDlgFeatureParameters::accept()) { + App::DocumentObject* sketch = static_cast(feature)->Profile.getValue(); + Gui::cmdAppObjectHide(sketch); + return true; + } - FCMD_OBJ_HIDE(sketch); - - return TaskDlgFeatureParameters::accept(); + return false; } bool TaskDlgSketchBasedParameters::reject()