Split name from additional params only when model is a library reference.

This commit is contained in:
Jeff Young 2023-03-22 13:51:16 +00:00
parent 5bda3b99f9
commit b8cf7cc080
1 changed files with 8 additions and 15 deletions

View File

@ -1586,19 +1586,6 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
{ {
spiceModelInfo = FIELD_INFO( getSIValue( modelField ), modelField ); spiceModelInfo = FIELD_INFO( getSIValue( modelField ), modelField );
aSymbol.RemoveField( modelField ); aSymbol.RemoveField( modelField );
if( spiceModelInfo.m_Text.Contains( ' ' ) )
{
wxString params;
spiceModelInfo.m_Text = spiceModelInfo.m_Text.BeforeFirst( ' ', &params );
if( !params.Trim( false ).IsEmpty() )
{
spiceParamsInfo = spiceModelInfo;
spiceParamsInfo.m_Text = params.Trim( false );
}
}
} }
else else
{ {
@ -1802,12 +1789,18 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
T_field libraryField = spiceLibInfo.CreateField( &aSymbol, SIM_LIBRARY_FIELD ); T_field libraryField = spiceLibInfo.CreateField( &aSymbol, SIM_LIBRARY_FIELD );
aSymbol.AddField( libraryField ); aSymbol.AddField( libraryField );
// Split library model name from any following parameters
wxString modelLineParams;
spiceModelInfo.m_Text = spiceModelInfo.m_Text.BeforeFirst( ' ', &modelLineParams );
T_field nameField = spiceModelInfo.CreateField( &aSymbol, SIM_NAME_FIELD ); T_field nameField = spiceModelInfo.CreateField( &aSymbol, SIM_NAME_FIELD );
aSymbol.AddField( nameField ); aSymbol.AddField( nameField );
// Don't write a paramsField unless we actually have overrides if( !modelLineParams.IsEmpty() )
if( !spiceParamsInfo.IsEmpty() )
{ {
spiceParamsInfo = spiceModelInfo;
spiceParamsInfo.m_Text = modelLineParams;
T_field paramsField = spiceParamsInfo.CreateField( &aSymbol, SIM_PARAMS_FIELD ); T_field paramsField = spiceParamsInfo.CreateField( &aSymbol, SIM_PARAMS_FIELD );
aSymbol.AddField( paramsField ); aSymbol.AddField( paramsField );
} }