From 5b6e886a3c4e28c2df23136f51b6042817ae283e Mon Sep 17 00:00:00 2001 From: mwganson Date: Tue, 15 Oct 2024 05:53:38 +0000 Subject: [PATCH] [PartDesign DuplicateSelected] do not put duplicated feature into active body if it is already in another body -- addresses issue #6278 --- src/Mod/PartDesign/Gui/CommandBody.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Mod/PartDesign/Gui/CommandBody.cpp b/src/Mod/PartDesign/Gui/CommandBody.cpp index 8f32f7135d..e822ae4724 100644 --- a/src/Mod/PartDesign/Gui/CommandBody.cpp +++ b/src/Mod/PartDesign/Gui/CommandBody.cpp @@ -30,6 +30,7 @@ #endif #include +#include #include #include #include @@ -635,8 +636,12 @@ void CmdPartDesignDuplicateSelection::activated(int iMsg) for (auto feature : newFeatures) { if (PartDesign::Body::isAllowed(feature)) { - FCMD_OBJ_CMD(pcActiveBody,"addObject(" << getObjectCmd(feature) << ")"); - FCMD_OBJ_HIDE(feature); + // if feature already is in a body, then we don't put it into the active body issue #6278 + auto body = App::GeoFeatureGroupExtension::getGroupOfObject(feature); + if (!body) { + FCMD_OBJ_CMD(pcActiveBody,"addObject(" << getObjectCmd(feature) << ")"); + FCMD_OBJ_HIDE(feature); + } } }