Salome HOME
23413: [CEA 2025] bug SMESH orientation
[modules/smesh.git] / src / SMESH_I / SMESH_2smeshpy.cxx
index 17ee75746e49b91d4e0f02b86d1e43d47f08f01d..e8bc862a90dd119667e2afc63ddeaf5a8254f506 100644 (file)
@@ -686,6 +686,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
       _AString indent = aCommand->GetIndentation();
       _AString tryStr = indent + "try:";
       _AString newCmd = indent + tab + ( aCommand->GetString().ToCString() + indent.Length() );
+      _AString pasCmd = indent + tab + "pass"; // to keep valid if newCmd is erased
       _AString excStr = indent + "except:";
       _AString msgStr = indent + "\tprint '"; msgStr += method + "() failed. Invalid file name?'";
 
@@ -693,6 +694,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
       aCommand->Clear();
       aCommand->GetString() = newCmd;
       aCommand->SetOrderNb( ++myNbCommands );
+      myCommands.push_back( new _pyCommand( pasCmd, ++myNbCommands ));
       myCommands.push_back( new _pyCommand( excStr, ++myNbCommands ));
       myCommands.push_back( new _pyCommand( msgStr, ++myNbCommands ));
     }