mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-30 04:00:32 +05:00
22238: Study dump produced by SMESH refers to undefined variable names - merged from V6_7_BR
This commit is contained in:
parent
ccb450c106
commit
1779fc70bb
@ -170,8 +170,16 @@ namespace {
|
|||||||
cmd->Clear();
|
cmd->Clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// comment a command having not created args
|
// check if an Object was created in the script
|
||||||
for ( int iArg = cmd->GetNbArgs(); iArg; --iArg )
|
_AString comment;
|
||||||
|
const _pyID& obj = cmd->GetObject();
|
||||||
|
if ( !obj.IsEmpty() && cmd->IsStudyEntry( obj ) && !presentObjects.count( obj ))
|
||||||
|
{
|
||||||
|
comment = "not created Object";
|
||||||
|
theGen->ObjectCreationRemoved( obj );
|
||||||
|
}
|
||||||
|
// check if a command has not created args
|
||||||
|
for ( int iArg = cmd->GetNbArgs(); iArg && comment.IsEmpty(); --iArg )
|
||||||
{
|
{
|
||||||
const _pyID& arg = cmd->GetArg( iArg );
|
const _pyID& arg = cmd->GetArg( iArg );
|
||||||
if ( arg.IsEmpty() || arg.Value( 1 ) == '"' || arg.Value( 1 ) == '\'' )
|
if ( arg.IsEmpty() || arg.Value( 1 ) == '"' || arg.Value( 1 ) == '\'' )
|
||||||
@ -181,34 +189,29 @@ namespace {
|
|||||||
for ( ; id != idList.end(); ++id )
|
for ( ; id != idList.end(); ++id )
|
||||||
if ( !theGen->IsGeomObject( *id ) && !presentObjects.count( *id ))
|
if ( !theGen->IsGeomObject( *id ) && !presentObjects.count( *id ))
|
||||||
{
|
{
|
||||||
cmd->Comment();
|
comment += *id + " has not been yet created";
|
||||||
cmd->GetString() += " ### " ;
|
break;
|
||||||
cmd->GetString() += *id + " has not been yet created";
|
|
||||||
for ( int i = 0; i < cmd->GetNbResultValues(); i++ ) {
|
|
||||||
_pyID objID = cmd->GetResultValue( i+1 );
|
|
||||||
theGen->ObjectCreationRemoved( objID ); // objID.SetName( name ) is not needed
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// comment a command having not created Object
|
// treat result objects
|
||||||
const _pyID& obj = cmd->GetObject();
|
const _pyID& result = cmd->GetResultValue();
|
||||||
if ( !obj.IsEmpty() && cmd->IsStudyEntry( obj ) && !presentObjects.count( obj ))
|
if ( !result.IsEmpty() && result.Value( 1 ) != '"' && result.Value( 1 ) != '\'' )
|
||||||
{
|
{
|
||||||
cmd->Comment();
|
list< _pyID > idList = cmd->GetStudyEntries( result );
|
||||||
cmd->GetString() += " ### not created object" ;
|
list< _pyID >::iterator id = idList.begin();
|
||||||
for ( int i = 0; i < cmd->GetNbResultValues(); i++ ) {
|
for ( ; id != idList.end(); ++id )
|
||||||
_pyID objID = cmd->GetResultValue( i+1 );
|
if ( comment.IsEmpty() )
|
||||||
theGen->ObjectCreationRemoved( objID ); // objID.SetName( name ) is not needed
|
presentObjects.insert( *id );
|
||||||
}
|
else
|
||||||
|
theGen->ObjectCreationRemoved( *id ); // objID.SetName( name ) is not needed
|
||||||
|
}
|
||||||
|
// comment the command
|
||||||
|
if ( !comment.IsEmpty() )
|
||||||
|
{
|
||||||
|
cmd->Comment();
|
||||||
|
cmd->GetString() += " ### ";
|
||||||
|
cmd->GetString() += comment;
|
||||||
}
|
}
|
||||||
const _pyID& result = cmd->GetResultValue();
|
|
||||||
if ( result.IsEmpty() || result.Value( 1 ) == '"' || result.Value( 1 ) == '\'' )
|
|
||||||
return;
|
|
||||||
list< _pyID > idList = cmd->GetStudyEntries( result );
|
|
||||||
list< _pyID >::iterator id = idList.begin();
|
|
||||||
for ( ; id != idList.end(); ++id )
|
|
||||||
presentObjects.insert( *id );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -3002,6 +3005,7 @@ int _pyCommand::GetBegPos( int thePartIndex )
|
|||||||
return EMPTY;
|
return EMPTY;
|
||||||
if ( myBegPos.Length() < thePartIndex )
|
if ( myBegPos.Length() < thePartIndex )
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
|
ASSERT( thePartIndex > 0 );
|
||||||
return myBegPos( thePartIndex );
|
return myBegPos( thePartIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3017,6 +3021,7 @@ void _pyCommand::SetBegPos( int thePartIndex, int thePosition )
|
|||||||
{
|
{
|
||||||
while ( myBegPos.Length() < thePartIndex )
|
while ( myBegPos.Length() < thePartIndex )
|
||||||
myBegPos.Append( UNKNOWN );
|
myBegPos.Append( UNKNOWN );
|
||||||
|
ASSERT( thePartIndex > 0 );
|
||||||
myBegPos( thePartIndex ) = thePosition;
|
myBegPos( thePartIndex ) = thePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3544,7 +3549,7 @@ void _pyCommand::Comment()
|
|||||||
if ( i <= Length() )
|
if ( i <= Length() )
|
||||||
{
|
{
|
||||||
myString.Insert( i, "#" );
|
myString.Insert( i, "#" );
|
||||||
for ( int iPart = 0; iPart < myBegPos.Length(); ++iPart )
|
for ( int iPart = 1; iPart <= myBegPos.Length(); ++iPart )
|
||||||
{
|
{
|
||||||
int begPos = GetBegPos( iPart );
|
int begPos = GetBegPos( iPart );
|
||||||
if ( begPos != UNKNOWN )
|
if ( begPos != UNKNOWN )
|
||||||
|
@ -934,7 +934,8 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
|||||||
do {
|
do {
|
||||||
aName = aBaseName + (++objectCounter);
|
aName = aBaseName + (++objectCounter);
|
||||||
} while (theObjectNames.IsBound(aName));
|
} while (theObjectNames.IsBound(aName));
|
||||||
seqRemoved.Append(aName);
|
if ( !aRemovedObjIDs.count( anEntry ))
|
||||||
|
seqRemoved.Append(aName);
|
||||||
mapRemoved.Bind(anEntry, "1");
|
mapRemoved.Bind(anEntry, "1");
|
||||||
theObjectNames.Bind(anEntry, aName);
|
theObjectNames.Bind(anEntry, aName);
|
||||||
}
|
}
|
||||||
@ -972,7 +973,6 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
|||||||
anUpdatedScript += "\n\taStudyBuilder = theStudy.NewBuilder()";
|
anUpdatedScript += "\n\taStudyBuilder = theStudy.NewBuilder()";
|
||||||
}
|
}
|
||||||
for (int ir = 1; ir <= seqRemoved.Length(); ir++) {
|
for (int ir = 1; ir <= seqRemoved.Length(); ir++) {
|
||||||
if ( aRemovedObjIDs.count( seqRemoved.Value(ir) )) continue;
|
|
||||||
anUpdatedScript += "\n\tSO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(";
|
anUpdatedScript += "\n\tSO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(";
|
||||||
anUpdatedScript += seqRemoved.Value(ir);
|
anUpdatedScript += seqRemoved.Value(ir);
|
||||||
// for object wrapped by class of smesh.py
|
// for object wrapped by class of smesh.py
|
||||||
@ -983,12 +983,8 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set object names
|
// Set object names
|
||||||
anUpdatedScript += "\n\t## set object names";
|
|
||||||
// anUpdatedScript += "\n\t\tsmeshgui = salome.ImportComponentGUI(\"SMESH\")";
|
|
||||||
// anUpdatedScript += "\n\t\tsmeshgui.Init(theStudy._get_StudyId())";
|
|
||||||
// anUpdatedScript += "\n";
|
|
||||||
|
|
||||||
TCollection_AsciiString aGUIName;
|
TCollection_AsciiString aGUIName, aSetNameScriptPart;
|
||||||
Resource_DataMapOfAsciiStringAsciiString mapEntries;
|
Resource_DataMapOfAsciiStringAsciiString mapEntries;
|
||||||
for (Standard_Integer i = 1; i <= aLen; i += 2)
|
for (Standard_Integer i = 1; i <= aLen; i += 2)
|
||||||
{
|
{
|
||||||
@ -1003,16 +999,17 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
|||||||
aName = theObjectNames.Find(anEntry);
|
aName = theObjectNames.Find(anEntry);
|
||||||
aGUIName = theNames.Find(anEntry);
|
aGUIName = theNames.Find(anEntry);
|
||||||
mapEntries.Bind(anEntry, aName);
|
mapEntries.Bind(anEntry, aName);
|
||||||
anUpdatedScript += helper + "\n\t" + aSMESHGen + ".SetName(" + aName;
|
aSetNameScriptPart += helper + "\n\t" + aSMESHGen + ".SetName(" + aName;
|
||||||
if ( anEntry2AccessorMethod.IsBound( anEntry ) )
|
if ( anEntry2AccessorMethod.IsBound( anEntry ) )
|
||||||
anUpdatedScript += helper + "." + anEntry2AccessorMethod( anEntry );
|
aSetNameScriptPart += helper + "." + anEntry2AccessorMethod( anEntry );
|
||||||
anUpdatedScript += helper + ", '" + aGUIName + "')";
|
aSetNameScriptPart += helper + ", '" + aGUIName + "')";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( !aSetNameScriptPart.IsEmpty() )
|
||||||
// Issue 0021249: removed (a similar block is dumped by SALOMEDSImpl_Study)
|
{
|
||||||
//anUpdatedScript += "\n\tif salome.sg.hasDesktop():";
|
anUpdatedScript += "\n\t## set object names";
|
||||||
//anUpdatedScript += "\n\t\tsalome.sg.updateObjBrowser(0)";
|
anUpdatedScript += aSetNameScriptPart;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
// store visual properties of displayed objects
|
// store visual properties of displayed objects
|
||||||
|
Loading…
Reference in New Issue
Block a user