Salome HOME
Issue #1084: parameter cyclic dependence
authorspo <sergey.pokhodenko@opencascade.com>
Tue, 17 Nov 2015 12:03:32 +0000 (15:03 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Tue, 17 Nov 2015 12:03:48 +0000 (15:03 +0300)
src/ParametersPlugin/ParametersPlugin_Parameter.cpp

index 712533bbcc975aa8534292185e7b3eb8f5a3bd87..c51ae80de24f2d1496686ca301ec788664ed8c07 100644 (file)
@@ -104,9 +104,15 @@ double ParametersPlugin_Parameter::evaluate(const std::string& theExpression, st
   for ( ; it != anExprParams.end(); it++) {
     std::string& aVariableName = *it;
 
+    // parameter with the same name should be searched in the parent document
+    // currently there is no way to get parent document, so we get PartSet doc
+    DocumentPtr aDocument = document();
+    if (data()->name() == aVariableName)
+      aDocument = ModelAPI_Session::get()->moduleDocument();
+
     double aValue;
     ResultParameterPtr aParamRes;
-    if (!ModelAPI_Tools::findVariable(aVariableName, aValue, aParamRes, document())) continue;
+    if (!ModelAPI_Tools::findVariable(aVariableName, aValue, aParamRes, aDocument)) continue;
     aParamsList.push_back(aParamRes);
 
     std::ostringstream sstream;