From f176172faa1191eeb781bc9e1b4083c81c4799f8 Mon Sep 17 00:00:00 2001 From: marioalexis Date: Tue, 19 Aug 2025 08:50:11 -0300 Subject: [PATCH] PartDesign: Remove use of user parameters from Body constructor --- src/Mod/PartDesign/App/Body.cpp | 11 ++--------- src/Mod/PartDesign/Gui/CommandBody.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Mod/PartDesign/App/Body.cpp b/src/Mod/PartDesign/App/Body.cpp index 3cc683e5bf..1ede7388f8 100644 --- a/src/Mod/PartDesign/App/Body.cpp +++ b/src/Mod/PartDesign/App/Body.cpp @@ -41,18 +41,11 @@ using namespace PartDesign; PROPERTY_SOURCE(PartDesign::Body, Part::BodyBase) -Body::Body() { +Body::Body() +{ ADD_PROPERTY_TYPE(AllowCompound, (false), "Experimental", App::Prop_None, "Allow multiple solids in Body (experimental)"); _GroupTouched.setStatus(App::Property::Output, true); - - static Base::Reference hGrp = App::GetApplication() - .GetUserParameter() - .GetGroup("BaseApp/Preferences/Mod/PartDesign"); - - auto allowCompoundDefaultValue = hGrp->GetBool("AllowCompoundDefault", true); - - ADD_PROPERTY(AllowCompound, (allowCompoundDefaultValue)); } /* diff --git a/src/Mod/PartDesign/Gui/CommandBody.cpp b/src/Mod/PartDesign/Gui/CommandBody.cpp index c57c155d42..2bb3927974 100644 --- a/src/Mod/PartDesign/Gui/CommandBody.cpp +++ b/src/Mod/PartDesign/Gui/CommandBody.cpp @@ -104,6 +104,11 @@ void CmdPartDesignBody::activated(int iMsg) App::DocumentObject* baseFeature = nullptr; bool addtogroup = false; + Base::Reference hGrp = App::GetApplication() + .GetUserParameter() + .GetGroup("BaseApp/Preferences/Mod/PartDesign"); + + bool allowCompound = hGrp->GetBool("AllowCompoundDefault", true); if (!features.empty()) { if (features.size() == 1) { @@ -196,6 +201,7 @@ void CmdPartDesignBody::activated(int iMsg) std::string labelString = QObject::tr("Body").toUtf8().toStdString(); labelString = Base::Tools::escapeEncodeString(labelString); doCommand(Doc,"App.ActiveDocument.getObject('%s').Label = '%s'", bodyString, labelString.c_str()); + doCommand(Doc,"App.ActiveDocument.getObject('%s').AllowCompound = %s", bodyString, allowCompound ? "True" : "False"); if (baseFeature) { if (partOfBaseFeature){ //withdraw base feature from Part, otherwise visibility madness results