diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 35adb3825..b60ef85f9 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include "ViewProviderSketch.h" #include "DrawSketchHandler.h" @@ -4481,8 +4482,17 @@ namespace SketcherGui { pObj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId())) return true; - if (!sketch->allowOtherBody && (pObj != support)) - return false; + if (pObj != support) { + // Selection outside of support not allowed + if (!sketch->allowOtherBody) + return false; + + // Selection outside of support allowed if from other body + // TODO: There is still a possibility of creating cyclic references here + if (Part::BodyBase::findBodyOf(pObj) == Part::BodyBase::findBodyOf(support)) + return false; + } + if (!sSubName || sSubName[0] == '\0') return false; std::string element(sSubName);