Salome HOME
Fix for the issue #2165 : reuse of the variable in expression of this variable is...
authormpv <mpv@opencascade.com>
Tue, 16 May 2017 14:42:26 +0000 (17:42 +0300)
committermpv <mpv@opencascade.com>
Tue, 16 May 2017 14:42:26 +0000 (17:42 +0300)
src/ModelAPI/ModelAPI_Tools.cpp

index 963a0c31d78dd5a1cde2e8910946e8ebc0033da8..988cfd64d0f212285073e06848f46146078e7739 100755 (executable)
@@ -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;