mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-27 01:40:33 +05:00
0022238: Study dump produced by SMESH refers to undefined variable names
Remove "aStudyBuilder.RemoveObjectWithChildren(SO)" for SO whose creation command was removed or commented
This commit is contained in:
parent
a58d128175
commit
06ef82c3a7
@ -217,16 +217,17 @@ namespace {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// comment a command having not created Object
|
// comment a command with an Object that was not created in the script
|
||||||
const _pyID& obj = cmd->GetObject();
|
const _pyID& obj = cmd->GetObject();
|
||||||
if ( !obj.IsEmpty() && cmd->IsStudyEntry( obj ) && !presentObjects.count( obj ))
|
if ( !obj.IsEmpty() && cmd->IsStudyEntry( obj ) && !presentObjects.count( obj ))
|
||||||
{
|
{
|
||||||
cmd->Comment();
|
cmd->Comment();
|
||||||
cmd->GetString() += " ### not created object" ;
|
cmd->GetString() += " ### not created Object" ;
|
||||||
for ( int i = 0; i < cmd->GetNbResultValues(); i++ ) {
|
for ( int i = 0; i < cmd->GetNbResultValues(); i++ ) {
|
||||||
_pyID objID = cmd->GetResultValue( i+1 );
|
_pyID objID = cmd->GetResultValue( i+1 );
|
||||||
theGen->ObjectCreationRemoved( objID ); // objID.SetName( name ) is not needed
|
theGen->ObjectCreationRemoved( objID ); // objID.SetName( name ) is not needed
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
const _pyID& result = cmd->GetResultValue();
|
const _pyID& result = cmd->GetResultValue();
|
||||||
if ( result.IsEmpty() || result.Value( 1 ) == '"' || result.Value( 1 ) == '\'' )
|
if ( result.IsEmpty() || result.Value( 1 ) == '"' || result.Value( 1 ) == '\'' )
|
||||||
|
@ -994,7 +994,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);
|
||||||
}
|
}
|
||||||
@ -1033,7 +1034,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 smeshBuilder.py
|
// for object wrapped by class of smeshBuilder.py
|
||||||
@ -1044,12 +1044,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)
|
||||||
{
|
{
|
||||||
@ -1057,23 +1053,24 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
|||||||
aName = geom->GetDumpName( anEntry.ToCString() );
|
aName = geom->GetDumpName( anEntry.ToCString() );
|
||||||
if (aName.IsEmpty() && // Not a GEOM object
|
if (aName.IsEmpty() && // Not a GEOM object
|
||||||
theNames.IsBound(anEntry) &&
|
theNames.IsBound(anEntry) &&
|
||||||
!aRemovedObjIDs.count(anEntry) && // a command creating anEntry was erased
|
!aRemovedObjIDs.count(anEntry) && // A command creating anEntry was erased
|
||||||
!mapEntries.IsBound(anEntry) && // Not yet processed
|
!mapEntries.IsBound(anEntry) && // Not yet processed
|
||||||
!mapRemoved.IsBound(anEntry)) // Was not removed
|
!mapRemoved.IsBound(anEntry)) // Was not removed
|
||||||
{
|
{
|
||||||
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