PartDesign: Remove use of user parameters from Body constructor

This commit is contained in:
marioalexis
2025-08-19 08:50:11 -03:00
committed by Kacper Donat
parent 7d4e704030
commit 94d20bbc95
2 changed files with 8 additions and 9 deletions

View File

@@ -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<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp/Preferences/Mod/PartDesign");
auto allowCompoundDefaultValue = hGrp->GetBool("AllowCompoundDefault", true);
ADD_PROPERTY(AllowCompound, (allowCompoundDefaultValue));
}
/*

View File

@@ -104,6 +104,11 @@ void CmdPartDesignBody::activated(int iMsg)
App::DocumentObject* baseFeature = nullptr;
bool addtogroup = false;
Base::Reference<ParameterGrp> 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