From eaedcd1720f0934b53748dcfdd4d9ae6d7c02ffe Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 16 May 2017 17:42:26 +0300 Subject: [PATCH] Fix for the issue #2165 : reuse of the variable in expression of this variable is not allowed now. --- src/ModelAPI/ModelAPI_Tools.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index 963a0c31d..988cfd64d 100755 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -167,8 +167,12 @@ bool findVariable(const DocumentPtr& theDocument, FeaturePtr theSearcher, if (!theParam.get()) return false; // avoid usage of parameters created later than the initial parameter - if (theSearcher.get() && theDocument->isLater(theDocument->feature(theParam), theSearcher)) - return false; + + if (theSearcher.get()) { + FeaturePtr aParamFeat = theDocument->feature(theParam); + if (aParamFeat == theSearcher || theDocument->isLater(aParamFeat, theSearcher)) + return false; + } AttributeDoublePtr aValueAttribute = theParam->data()->real(ModelAPI_ResultParameter::VALUE()); outValue = aValueAttribute->value(); return true; -- 2.39.2