From 3df305cc4e877c75e66a42ccefe7d8ea5c11d717 Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Wed, 8 Jul 2015 21:37:28 +0300 Subject: [PATCH] Sketcher: allow referencing everything; add testing for circular references --- src/Mod/Sketcher/App/SketchObject.cpp | 8 ++++++++ src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 3d6dba9b6..d4c240c34 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -1707,7 +1707,14 @@ bool SketchObject::isExternalAllowed(App::Document *pDoc, App::DocumentObject *p // Externals outside of the Document are NOT allowed if (this->getDocument() != pDoc) return false; + try { + return this->testIfLinkDAGCompatible(pObj); + } catch (Base::Exception &e) { + Base::Console().Warning("Probably, there is a circular reference in the document. Error: %s\n", e.what()); + return true; //prohibiting this reference won't remove the problem anyway... + } + /* // Note: Checking for the body of the support doesn't work when the support are the three base planes App::DocumentObject *support = this->Support.getValue(); Part::BodyBase* body = Part::BodyBase::findBodyOf(this); @@ -1723,6 +1730,7 @@ bool SketchObject::isExternalAllowed(App::Document *pDoc, App::DocumentObject *p } return true; + */ } int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, Sketcher::PointPos refPosId/*=Sketcher::none*/) diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 6ce987be4..95544db0e 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -4479,13 +4479,13 @@ namespace SketcherGui { return false; // Note: its better to search the support of the sketch in case the sketch support is a base plane - Part::BodyBase* body = Part::BodyBase::findBodyOf(sketch); - if ( body && body->hasFeature ( pObj ) && body->isAfter ( pObj, sketch ) ) { + //Part::BodyBase* body = Part::BodyBase::findBodyOf(sketch); + //if ( body && body->hasFeature ( pObj ) && body->isAfter ( pObj, sketch ) ) { // Don't allow selection after the sketch in the same body // NOTE: allowness of features in other bodies is handled by SketchObject::isExternalAllowed() // TODO may be this should be in SketchObject::isExternalAllowed() (2015-08-07, Fat-Zer) - return false; - } + //return false; + //} if (!sSubName || sSubName[0] == '\0') return false;