From e10a62ae8283a1b5830a4ca7cf545634577d989e Mon Sep 17 00:00:00 2001 From: bgbsww Date: Thu, 16 Nov 2023 11:59:23 -0500 Subject: [PATCH] Use placement only on new objects --- src/Mod/PartDesign/App/FeatureBoolean.cpp | 6 ++++-- src/Mod/PartDesign/App/FeatureBoolean.h | 1 + src/Mod/PartDesign/Gui/Command.cpp | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureBoolean.cpp b/src/Mod/PartDesign/App/FeatureBoolean.cpp index 8341db8710..3df796e4e3 100644 --- a/src/Mod/PartDesign/App/FeatureBoolean.cpp +++ b/src/Mod/PartDesign/App/FeatureBoolean.cpp @@ -55,7 +55,8 @@ Boolean::Boolean() Base::Reference hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign"); this->Refine.setValue(hGrp->GetBool("RefineModel", false)); - + ADD_PROPERTY_TYPE(UsePlacement,(0),"Part Design",(App::PropertyType)(App::Prop_None),"Apply the placement of the second ( tool ) object"); + this->UsePlacement.setValue(false); initExtension(this); } @@ -113,7 +114,8 @@ App::DocumentObjectExecReturn *Boolean::execute() return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Cannot do boolean with anything but Part::Feature and its derivatives")); Part::TopoShape toolShape = static_cast(tool)->Shape.getShape(); - toolShape.setPlacement(bodyPlacement * toolShape.getPlacement()); + if ( UsePlacement.getValue() ) + toolShape.setPlacement(bodyPlacement * toolShape.getPlacement()); TopoDS_Shape shape = toolShape.getShape(); TopoDS_Shape boolOp; diff --git a/src/Mod/PartDesign/App/FeatureBoolean.h b/src/Mod/PartDesign/App/FeatureBoolean.h index b3ad810340..c1e33b501e 100644 --- a/src/Mod/PartDesign/App/FeatureBoolean.h +++ b/src/Mod/PartDesign/App/FeatureBoolean.h @@ -47,6 +47,7 @@ public: App::PropertyEnumeration Type; App::PropertyBool Refine; + App::PropertyBool UsePlacement; /** @name methods override feature */ //@{ diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index f79aa94a09..f0d575d3c7 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -2362,6 +2363,7 @@ void CmdPartDesignBoolean::activated(int iMsg) std::string FeatName = getUniqueObjectName("Boolean",pcActiveBody); FCMD_OBJ_CMD(pcActiveBody,"newObject('PartDesign::Boolean','"<getDocument()->getObject(FeatName.c_str()); + static_cast(Feat)->UsePlacement.setValue(true); // If we don't add an object to the boolean group then don't update the body // as otherwise this will fail and it will be marked as invalid