diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp index 61df266fd1..9778847112 100644 --- a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp @@ -45,7 +45,6 @@ #include #include #include -#include #include "TaskSketchBasedParameters.h" #include "ReferenceSelection.h" #include "Workbench.h" diff --git a/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp b/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp index 357f43491b..ddf65731de 100644 --- a/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include "TaskSketchBasedParameters.h" #include "ReferenceSelection.h" #include "Workbench.h" diff --git a/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp b/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp index 5bd8e81cf7..c88318b0ef 100644 --- a/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp @@ -296,33 +296,40 @@ void TaskDlgSketchBasedParameters::clicked(int) bool TaskDlgSketchBasedParameters::reject() { - // get the support and Sketch PartDesign::SketchBased* pcSketchBased = static_cast(vp->getObject()); + // get the Sketch Sketcher::SketchObject *pcSketch; if (pcSketchBased->Sketch.getValue()) { pcSketch = static_cast(pcSketchBased->Sketch.getValue()); } + PartDesign::Body* body = PartDesign::Body::findBodyOf(pcSketchBased); + // roll back the done things Gui::Command::abortCommand(); Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); - // if abort command deleted the object the sketch is visible again + + // if abort command deleted the object the sketch is visible again as well as the previous feature if (!Gui::Application::Instance->getViewProvider(pcSketchBased)) { if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch)) Gui::Application::Instance->getViewProvider(pcSketch)->show(); - } - // Body housekeeping - PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject(PDBODYKEY); - if (activeBody != NULL) { - // Make the new Tip and the previous solid feature visible again - App::DocumentObject* tip = activeBody->Tip.getValue(); - App::DocumentObject* prev = activeBody->getPrevSolidFeature(); - if (tip != NULL) { - Gui::Application::Instance->getViewProvider(tip)->show(); - if ((tip != prev) && (prev != NULL)) - Gui::Application::Instance->getViewProvider(prev)->show(); + // Body housekeeping + if (body != NULL) { + // Make the new Tip and the previous solid feature visible again + // TODO: do we really should make them both visiable? + App::DocumentObject* tip = body->Tip.getValue(); + App::DocumentObject* prev = body->getPrevSolidFeature(pcSketchBased); + if (tip != NULL) { + Gui::Application::Instance->getViewProvider(tip)->show(); + if ((tip != prev) && (prev != NULL)) + Gui::Application::Instance->getViewProvider(prev)->show(); + } + } else { + App::DocumentObject *pcSupport = pcSketch->Support.getValue(); + if (pcSupport && Gui::Application::Instance->getViewProvider(pcSupport)) + Gui::Application::Instance->getViewProvider(pcSupport)->show(); } }