mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-06 13:04:17 +05:00
0051789: TC7.2.0: NoteBook cannot update study
Fix for "LayerDistribution" hypothesis + // string preceding an entry of object storing the attribute holding var names + static const char* ObjPrefix() { return " # OBJ: "; }
This commit is contained in:
parent
b72983c0ad
commit
21a7cf3d64
@ -73,6 +73,9 @@ namespace SMESH
|
||||
SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
|
||||
if(!aStudy->_is_nil() && !aCollection.IsEmpty())
|
||||
{
|
||||
const std::string & objEntry = SMESH_Gen_i::GetSMESHGen()->GetLastObjEntry();
|
||||
if ( !objEntry.empty() )
|
||||
aCollection += (TVar::ObjPrefix() + objEntry ).c_str();
|
||||
aSMESHGen->AddToPythonScript(aStudy->StudyId(),aCollection);
|
||||
if(MYDEBUG) MESSAGE(aString);
|
||||
// prevent misuse of already treated variables
|
||||
@ -312,7 +315,7 @@ namespace SMESH
|
||||
if(aSObject->_is_nil() && !CORBA::is_nil(theArg))
|
||||
myStream << "hyp_" << theArg->GetId();
|
||||
else
|
||||
*this << CORBA::Object_ptr( theArg );
|
||||
*this << aSObject;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -250,11 +250,28 @@ void SMESH_NoteBook::ReplaceVariables()
|
||||
}
|
||||
|
||||
// NEW APPROACH
|
||||
// Names of variables are stored in the Study, in "StringAttribute". Python commands
|
||||
// store zero-based indices (as e.g.'$1$') of variables within "StringAttribute";
|
||||
// An entry of object storing "StringAttribute" is at the end of the command
|
||||
// after TVar::ObjPrefix().
|
||||
|
||||
TEntry2VarVecMap::iterator ent2varVec = _entry2VarsMap.find( aObject );
|
||||
// Get the entry of object storing "StringAttribute"
|
||||
TCollection_AsciiString & cmdStr = aCmd->GetString();
|
||||
TEntry2VarVecMap::iterator ent2varVec;
|
||||
if (int pos = cmdStr.Location( SMESH::TVar::ObjPrefix(), 6, cmdStr.Length() ))
|
||||
{
|
||||
TCollection_AsciiString varHolderEntry =
|
||||
cmdStr.SubString( pos + strlen( SMESH::TVar::ObjPrefix() ), cmdStr.Length() );
|
||||
ent2varVec = _entry2VarsMap.find( varHolderEntry );
|
||||
cmdStr.Split( pos - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
ent2varVec = _entry2VarsMap.find( aObject );
|
||||
}
|
||||
// Set variables in cmdStr
|
||||
if ( ent2varVec != _entry2VarsMap.end() && !ent2varVec->second.empty() )
|
||||
{
|
||||
TCollection_AsciiString & cmdStr = aCmd->GetString();
|
||||
const std::vector< std::string >& vars = ent2varVec->second;
|
||||
int pos = 1, pos2;
|
||||
// look for '$VarIndex$' in cmdStr. TVar::Quote() == '$'
|
||||
@ -287,6 +304,8 @@ void SMESH_NoteBook::ReplaceVariables()
|
||||
}
|
||||
|
||||
// OLD APPROACH
|
||||
// Variable names are stored historically in "StringAttribute",
|
||||
// i.e. for each command there is a set of either var names or separated empty places.
|
||||
|
||||
// check if method modifies the object itself
|
||||
TVariablesMap::const_iterator it = _objectMap.find(aObject);
|
||||
|
@ -102,6 +102,8 @@ namespace SMESH
|
||||
// string used to temporary quote variable names in order
|
||||
// not to confuse variables with string arguments
|
||||
static char Quote() { return '$'; }
|
||||
// string preceding an entry of object storing the attribute holding var names
|
||||
static const char* ObjPrefix() { return " # OBJ: "; }
|
||||
};
|
||||
|
||||
// ===========================================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user