diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 9a1ee5713e..95212cc61a 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -1515,7 +1516,11 @@ CONSTRUCTION_UPDATE_ACTION(CmdSketcherProjection, "Sketcher_Projection") void CmdSketcherProjection::activated(int iMsg) { Q_UNUSED(iMsg); - ActivateHandler(getActiveGuiDocument(), std::make_unique()); + bool extGeoRef = Gui::WindowParameter::getDefaultParameter() + ->GetGroup("Mod/Sketcher/General") + ->GetBool("AlwaysExtGeoReference", false); + ActivateHandler(getActiveGuiDocument(), + std::make_unique(extGeoRef, false)); } bool CmdSketcherProjection::isActive() @@ -1546,12 +1551,17 @@ CmdSketcherIntersection::CmdSketcherIntersection() CONSTRUCTION_UPDATE_ACTION(CmdSketcherIntersection, "Sketcher_Intersection") -void CmdSketcherIntersection::activated(int) +void CmdSketcherIntersection::activated(int iMsg) { - ActivateHandler(getActiveGuiDocument(), std::make_unique(true)); + Q_UNUSED(iMsg); + bool extGeoRef = Gui::WindowParameter::getDefaultParameter() + ->GetGroup("Mod/Sketcher/General") + ->GetBool("AlwaysExtGeoReference", false); + ActivateHandler(getActiveGuiDocument(), + std::make_unique(extGeoRef, true)); } -bool CmdSketcherIntersection::isActive(void) +bool CmdSketcherIntersection::isActive() { return isCommandActive(getActiveGuiDocument()); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerExternal.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerExternal.h index d7bc44bc6a..5739156809 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerExternal.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerExternal.h @@ -116,8 +116,9 @@ public: class DrawSketchHandlerExternal: public DrawSketchHandler { public: - DrawSketchHandlerExternal(bool intersection = false) - : intersection(intersection) + DrawSketchHandlerExternal(bool alwaysReference, bool intersection) + : alwaysReference {alwaysReference} + , intersection {intersection} {} ~DrawSketchHandlerExternal() override { @@ -168,7 +169,8 @@ public: "addExternal(\"%s\",\"%s\", %s, %s)", msg.pObjectName, msg.pSubName, - isConstructionMode() ? "False" : "True", + alwaysReference || isConstructionMode() ? "False" + : "True", intersection ? "True" : "False"); Gui::Command::commitCommand(); @@ -229,6 +231,7 @@ private: setAxisPickStyle(true); } + bool alwaysReference; bool intersection; }; diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.cpp b/src/Mod/Sketcher/Gui/SketcherSettings.cpp index c74c9e32f8..ca48c9f242 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.cpp +++ b/src/Mod/Sketcher/Gui/SketcherSettings.cpp @@ -112,6 +112,7 @@ void SketcherSettings::saveSettings() ui->checkBoxAutoRemoveRedundants->onSave(); ui->checkBoxUnifiedCoincident->onSave(); ui->checkBoxHorVerAuto->onSave(); + ui->checkBoxAddExtGeo->onSave(); enum { @@ -186,6 +187,7 @@ void SketcherSettings::loadSettings() setProperty("checkBoxUnifiedCoincident", ui->checkBoxUnifiedCoincident->isChecked()); ui->checkBoxHorVerAuto->onRestore(); setProperty("checkBoxHorVerAuto", ui->checkBoxHorVerAuto->isChecked()); + ui->checkBoxAddExtGeo->onRestore(); // Dimensioning constraints mode ui->dimensioningMode->clear(); diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.ui b/src/Mod/Sketcher/Gui/SketcherSettings.ui index 134703a284..f465cba556 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.ui +++ b/src/Mod/Sketcher/Gui/SketcherSettings.ui @@ -216,6 +216,25 @@ Requires to re-enter edit mode to take effect. + + + + If checked then external geometry is always added as reference, otherwise it's added according to the current construction mode. + + + Always add external geometry as reference + + + false + + + AlwaysExtGeoReference + + + Mod/Sketcher/General + + +