PartDesign: Use AllowCompound user parameter along the workbench - fixes #23596

This commit is contained in:
marioalexis
2025-09-25 10:40:47 -03:00
committed by Chris Hennes
parent 68b754effd
commit 406c3ba42c
4 changed files with 27 additions and 1 deletions

View File

@@ -189,11 +189,22 @@ void needActiveBodyError()
PartDesign::Body * makeBody(App::Document *doc)
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp/Preferences/Mod/PartDesign");
bool allowCompound = hGrp->GetBool("AllowCompoundDefault", true);
// This is intended as a convenience when starting a new document.
auto bodyName( doc->getUniqueObjectName("Body") );
Gui::Command::doCommand( Gui::Command::Doc,
"App.getDocument('%s').addObject('PartDesign::Body','%s')",
doc->getName(), bodyName.c_str() );
Gui::Command::doCommand( Gui::Command::Doc,
"App.getDocument('%s').getObject('%s').AllowCompound = %s",
doc->getName(), bodyName.c_str(), allowCompound ? "True" : "False" );
auto body = dynamic_cast<PartDesign::Body*>(doc->getObject(bodyName.c_str()));
if(body)
makeBodyActive(body, doc);