mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-12 01:30:36 +05:00
PR: dump correction when sudies from older versions are loaded
This commit is contained in:
parent
376506dfdb
commit
b8e8a40b70
@ -55,6 +55,29 @@ void RemoveTabulation( TCollection_AsciiString& theScript )
|
||||
theScript = aString.c_str();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConvertV6toV7
|
||||
//purpose : dump elements are stored when study is saved,
|
||||
// and kept when study is reloaded.
|
||||
// When a study from an older version is loaded,
|
||||
// the dump must be post processed in case of syntax modification.
|
||||
// In V7.2, geompy.GEOM --> GEOM
|
||||
//=======================================================================
|
||||
void ConvertV6toV7( TCollection_AsciiString& theScript )
|
||||
{
|
||||
std::string aString( theScript.ToCString() );
|
||||
std::string::size_type aPos = 0;
|
||||
while( aPos < aString.length() )
|
||||
{
|
||||
aPos = aString.find( "geompy.GEOM", aPos );
|
||||
if( aPos == std::string::npos )
|
||||
break;
|
||||
aString.replace( aPos, 11, "GEOM" );
|
||||
aPos++;
|
||||
}
|
||||
theScript = aString.c_str();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpPython
|
||||
//purpose :
|
||||
@ -177,6 +200,8 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
|
||||
if( !isMultiFile ) // remove unnecessary tabulation
|
||||
RemoveTabulation( aScript );
|
||||
|
||||
ConvertV6toV7( aScript ); //convert scripts related to studies saved in SALOME V6 and older
|
||||
|
||||
int aLen = aScript.Length();
|
||||
unsigned char* aBuffer = new unsigned char[aLen+1];
|
||||
strcpy((char*)aBuffer, aScript.ToCString());
|
||||
|
Loading…
Reference in New Issue
Block a user