void ProcessFunction(Handle(GEOM_Function)& theFunction,
TCollection_AsciiString& theScript,
Resource_DataMapOfAsciiStringAsciiString& theVariableNames,
+ TColStd_HSequenceOfAsciiString& theStudyVariables,
TColStd_MapOfTransient& theProcessed);
void ReplaceVariables(TCollection_AsciiString& theCommand,
- Resource_DataMapOfAsciiStringAsciiString& theVariableNames);
+ Resource_DataMapOfAsciiStringAsciiString& theVariableNames,
+ TColStd_HSequenceOfAsciiString& theStudyVariables);
TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
Resource_DataMapOfAsciiStringAsciiString& theVariableNames,
+ TColStd_HSequenceOfAsciiString& theStudyVariables,
bool isPublished,
bool& aValidScript)
{
MESSAGE ( "Null function !!!!" );
continue;
}
- ProcessFunction(aFunction, aScript,theVariableNames,aMap);
+ ProcessFunction(aFunction, aScript, theVariableNames, theStudyVariables ,aMap);
}
}
void ProcessFunction(Handle(GEOM_Function)& theFunction,
TCollection_AsciiString& theScript,
Resource_DataMapOfAsciiStringAsciiString& theVariableNames,
+ TColStd_HSequenceOfAsciiString& theStudyVariables,
TColStd_MapOfTransient& theProcessed)
{
if(theFunction.IsNull() || theProcessed.Contains(theFunction)) return;
if(aDescr == "None") return;
//Replace parameter by notebook variables
- ReplaceVariables(aDescr,theVariableNames);
+ ReplaceVariables(aDescr,theVariableNames,theStudyVariables);
theScript += "\n\t";
theScript += aDescr;
*/
//=============================================================================
void ReplaceVariables(TCollection_AsciiString& theCommand,
- Resource_DataMapOfAsciiStringAsciiString& theVariableNames)
+ Resource_DataMapOfAsciiStringAsciiString& theVariableNames,
+ TColStd_HSequenceOfAsciiString& theStudyVariables)
{
//Get Entry of the result object
TCollection_AsciiString anEntry = theCommand.Token("=",1);
-
+
//Remove white spaces
anEntry.RightAdjust();
anEntry.LeftAdjust();
aEndPos = theCommand.Location(i, COMMA, 1, theCommand.Length());
}
- TCollection_AsciiString aParameter = theCommand.SubString(aStartPos, aStartPos);
-
- if(MYDEBUG)
- cout<<"Current parameter "<<aParameter<<endl;
-
aVar = aVarSeq.Value(iVar);
//If parameter is entry, skip it
iVar++;
continue;
}
-
- aVar.InsertBefore(1,"\"");
- aVar.InsertAfter(aVar.Length(),"\"");
+
+ bool isVar = false;
+ for(Standard_Integer i = 1; i <= theStudyVariables.Length();i++)
+ if(theStudyVariables.Value(i).IsEqual(aVar)) {
+ isVar = true;
+ break;
+ }
+ if(isVar) {
+ aVar.InsertBefore(1,"\"");
+ aVar.InsertAfter(aVar.Length(),"\"");
+ }
theCommand.Remove(aStartPos, aEndPos - aStartPos);
theCommand.Insert(aStartPos,aVar);
CORBA::String_var aName = aValue->GetName();
CORBA::String_var anEntry = GO->GetEntry();
aMap.Bind( (char*)anEntry.in(), (char*)aName.in() );
-
+
//Find attribute with list of used notebook variables
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeString_var anAttrStr;
}
}
+ //Get Study variables
+ SALOMEDS::ListOfStrings_var aListOfVars = aStudy->GetVariableNames();
+ TColStd_HSequenceOfAsciiString aStudyVariables;
+ for(int i = 0;i < aListOfVars->length();i++)
+ {
+ aStudyVariables.Append(aListOfVars[i].in());
+ }
+
TCollection_AsciiString aScript =
"### This file is generated by SALOME automatically by dump python functionality\n"
"### of GEOM component\n\n";
- aScript += _impl->DumpPython(aStudy->StudyId(), aMap, aVariableMap, isPublished, isValidScript);
+ aScript += _impl->DumpPython(aStudy->StudyId(), aMap, aVariableMap, aStudyVariables, isPublished, isValidScript);
if (isPublished)
{