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()