From f18c9a23914df1ca2d8764cf7557ed37429ac5c3 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 8 Dec 2022 00:09:48 +0100 Subject: [PATCH] PD: fixes #6000: auto-generated Body not placed under existing Part --- src/Mod/PartDesign/Gui/SketchWorkflow.cpp | 26 +++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Mod/PartDesign/Gui/SketchWorkflow.cpp b/src/Mod/PartDesign/Gui/SketchWorkflow.cpp index 6b56e7af7c..829aee9736 100644 --- a/src/Mod/PartDesign/Gui/SketchWorkflow.cpp +++ b/src/Mod/PartDesign/Gui/SketchWorkflow.cpp @@ -258,12 +258,23 @@ private: { if (!activeBody) { activeBody = PartDesignGui::getBody( /* messageIfNot = */ true ); - if (!activeBody) { + if (activeBody) { + tryAddNewBodyToActivePart(); + } + else { throw RejectException(); } } } + void tryAddNewBodyToActivePart() + { + App::Part *activePart = PartDesignGui::getActivePart(); + if (activePart) { + activePart->addObject(activeBody); + } + } + void handleIfSupportOutOfBody(App::DocumentObject* selectedObject) { if (!activeBody->hasObject(selectedObject)) { @@ -498,12 +509,23 @@ private: if (!activeBody) { App::Document* appdocument = guidocument->getDocument(); activeBody = PartDesignGui::makeBody(appdocument); - if (!activeBody) { + if (activeBody) { + tryAddNewBodyToActivePart(); + } + else { throw RejectException(); } } } + void tryAddNewBodyToActivePart() + { + App::Part *activePart = PartDesignGui::getActivePart(); + if (activePart) { + activePart->addObject(activeBody); + } + } + void findAndSelectPlane() { App::Document* appdocument = guidocument->getDocument();