From 7dae0ae0fb7f516cadbe80a60943995fa6044f56 Mon Sep 17 00:00:00 2001 From: jrheinlaender Date: Mon, 15 Jul 2013 07:40:03 +0200 Subject: [PATCH] Allow external references from other body but not from same body outside the support --- src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 35adb3825a..b60ef85f99 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);