Use placement only on new objects

This commit is contained in:
bgbsww
2023-11-16 11:59:23 -05:00
committed by Yorik van Havre
parent 156c506f19
commit e10a62ae82
3 changed files with 7 additions and 2 deletions

View File

@@ -55,7 +55,8 @@ Boolean::Boolean()
Base::Reference<ParameterGrp> 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<Part::Feature*>(tool)->Shape.getShape();
toolShape.setPlacement(bodyPlacement * toolShape.getPlacement());
if ( UsePlacement.getValue() )
toolShape.setPlacement(bodyPlacement * toolShape.getPlacement());
TopoDS_Shape shape = toolShape.getShape();
TopoDS_Shape boolOp;

View File

@@ -47,6 +47,7 @@ public:
App::PropertyEnumeration Type;
App::PropertyBool Refine;
App::PropertyBool UsePlacement;
/** @name methods override feature */
//@{

View File

@@ -47,6 +47,7 @@
#include <Gui/SelectionObject.h>
#include <Mod/Sketcher/App/SketchObject.h>
#include <Mod/PartDesign/App/Body.h>
#include <Mod/PartDesign/App/FeatureBoolean.h>
#include <Mod/PartDesign/App/FeatureGroove.h>
#include <Mod/PartDesign/App/FeatureMultiTransform.h>
#include <Mod/PartDesign/App/FeatureRevolution.h>
@@ -2362,6 +2363,7 @@ void CmdPartDesignBoolean::activated(int iMsg)
std::string FeatName = getUniqueObjectName("Boolean",pcActiveBody);
FCMD_OBJ_CMD(pcActiveBody,"newObject('PartDesign::Boolean','"<<FeatName<<"')");
auto Feat = pcActiveBody->getDocument()->getObject(FeatName.c_str());
static_cast<PartDesign::Boolean*>(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