cmd->Clear();\r
return;\r
}\r
- // comment a command having not created args
- for ( int iArg = cmd->GetNbArgs(); iArg; --iArg )
+ // check if an Object was created in the script\r
+ _AString comment;\r
+ const _pyID& obj = cmd->GetObject();\r
+ if ( !obj.IsEmpty() && cmd->IsStudyEntry( obj ) && !presentObjects.count( obj ))\r
+ {\r
+ comment = "not created Object";\r
+ theGen->ObjectCreationRemoved( obj );\r
+ }\r
+ // check if a command has not created args\r
+ for ( int iArg = cmd->GetNbArgs(); iArg && comment.IsEmpty(); --iArg )
{
const _pyID& arg = cmd->GetArg( iArg );
if ( arg.IsEmpty() || arg.Value( 1 ) == '"' || arg.Value( 1 ) == '\'' )
for ( ; id != idList.end(); ++id )
if ( !theGen->IsGeomObject( *id ) && !presentObjects.count( *id ))
{
- cmd->Comment();
- cmd->GetString() += " ### " ;
- cmd->GetString() += *id + " has not been yet created";
- for ( int i = 0; i < cmd->GetNbResultValues(); i++ ) {\r
- _pyID objID = cmd->GetResultValue( i+1 );\r
- theGen->ObjectCreationRemoved( objID ); // objID.SetName( name ) is not needed\r
- }
- return;
+ comment += *id + " has not been yet created";\r
+ break;
}
}
- // comment a command having not created Object
- const _pyID& obj = cmd->GetObject();
- if ( !obj.IsEmpty() && cmd->IsStudyEntry( obj ) && !presentObjects.count( obj ))
- {
- cmd->Comment();
- cmd->GetString() += " ### not created object" ;
- for ( int i = 0; i < cmd->GetNbResultValues(); i++ ) {\r
- _pyID objID = cmd->GetResultValue( i+1 );\r
- theGen->ObjectCreationRemoved( objID ); // objID.SetName( name ) is not needed\r
- }
+ // treat result objects\r
+ const _pyID& result = cmd->GetResultValue();\r
+ if ( !result.IsEmpty() && result.Value( 1 ) != '"' && result.Value( 1 ) != '\'' )\r
+ {\r
+ list< _pyID > idList = cmd->GetStudyEntries( result );\r
+ list< _pyID >::iterator id = idList.begin();\r
+ for ( ; id != idList.end(); ++id )\r
+ if ( comment.IsEmpty() )\r
+ presentObjects.insert( *id );\r
+ else\r
+ theGen->ObjectCreationRemoved( *id ); // objID.SetName( name ) is not needed\r
+ }\r
+ // comment the command\r
+ if ( !comment.IsEmpty() )\r
+ {\r
+ cmd->Comment();\r
+ cmd->GetString() += " ### ";\r
+ cmd->GetString() += comment;\r
}
- 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 );
}
//================================================================================
return EMPTY;
if ( myBegPos.Length() < thePartIndex )
return UNKNOWN;
+ ASSERT( thePartIndex > 0 );
return myBegPos( thePartIndex );
}
{
while ( myBegPos.Length() < thePartIndex )
myBegPos.Append( UNKNOWN );
+ ASSERT( thePartIndex > 0 );
myBegPos( thePartIndex ) = thePosition;
}
if ( i <= Length() )
{
myString.Insert( i, "#" );
- for ( int iPart = 0; iPart < myBegPos.Length(); ++iPart )
+ for ( int iPart = 1; iPart <= myBegPos.Length(); ++iPart )
{
int begPos = GetBegPos( iPart );
if ( begPos != UNKNOWN )
do {
aName = aBaseName + (++objectCounter);
} while (theObjectNames.IsBound(aName));
- seqRemoved.Append(aName);
+ if ( !aRemovedObjIDs.count( anEntry ))
+ seqRemoved.Append(aName);
mapRemoved.Bind(anEntry, "1");
theObjectNames.Bind(anEntry, aName);
}
anUpdatedScript += "\n\taStudyBuilder = theStudy.NewBuilder()";
}
for (int ir = 1; ir <= seqRemoved.Length(); ir++) {
- if ( aRemovedObjIDs.count( seqRemoved.Value(ir) )) continue;
anUpdatedScript += "\n\tSO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(";
anUpdatedScript += seqRemoved.Value(ir);
// for object wrapped by class of smesh.py
}
// 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;
for (Standard_Integer i = 1; i <= aLen; i += 2)
{
aName = theObjectNames.Find(anEntry);
aGUIName = theNames.Find(anEntry);
mapEntries.Bind(anEntry, aName);
- anUpdatedScript += helper + "\n\t" + aSMESHGen + ".SetName(" + aName;
+ aSetNameScriptPart += helper + "\n\t" + aSMESHGen + ".SetName(" + aName;
if ( anEntry2AccessorMethod.IsBound( anEntry ) )
- anUpdatedScript += helper + "." + anEntry2AccessorMethod( anEntry );
- anUpdatedScript += helper + ", '" + aGUIName + "')";
+ aSetNameScriptPart += helper + "." + anEntry2AccessorMethod( anEntry );
+ aSetNameScriptPart += helper + ", '" + aGUIName + "')";
}
}
-
- // Issue 0021249: removed (a similar block is dumped by SALOMEDSImpl_Study)
- //anUpdatedScript += "\n\tif salome.sg.hasDesktop():";
- //anUpdatedScript += "\n\t\tsalome.sg.updateObjBrowser(0)";
+ if ( !aSetNameScriptPart.IsEmpty() )\r
+ {\r
+ anUpdatedScript += "\n\t## set object names";\r
+ anUpdatedScript += aSetNameScriptPart;\r
+ }
// -----------------------------------------------------------------
// store visual properties of displayed objects