Move annotation error reporting to preflight before simulation.

Fixes https://gitlab.com/kicad/code/kicad/issues/9220
This commit is contained in:
Jeff Young 2022-11-07 22:51:27 +00:00
parent 5af506777c
commit ece752d5a2
2 changed files with 7 additions and 11 deletions

View File

@ -361,20 +361,15 @@ bool NETLIST_EXPORTER_SPICE::readRefName( SCH_SHEET_PATH& aSheet, SCH_SYMBOL& aS
{
aItem.refName = aSymbol.GetRef( &aSheet );
if( aRefNames.count( aItem.refName ) )
{
DisplayErrorMessage( nullptr,
_( "Multiple symbols have the same reference designator.\n"
"Annotation must be corrected before simulating." ) );
return false;
}
if( !aRefNames.insert( aItem.refName ).second )
wxASSERT( wxT( "Duplicate refdes encountered; what happened to ReadyToNetlist()?" ) );
aRefNames.insert( aItem.refName );
return true;
}
void NETLIST_EXPORTER_SPICE::readModel( SCH_SHEET_PATH& aSheet, SCH_SYMBOL& aSymbol, SPICE_ITEM& aItem )
void NETLIST_EXPORTER_SPICE::readModel( SCH_SHEET_PATH& aSheet, SCH_SYMBOL& aSymbol,
SPICE_ITEM& aItem )
{
SIM_LIBRARY::MODEL libModel = m_libMgr.CreateModel( aSymbol );

View File

@ -476,9 +476,10 @@ void SIM_PLOT_FRAME::StartSimulation( const wxString& aSimCommand )
| NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_VOLTAGES
| NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_CURRENTS );
if( !m_simulator->Attach( m_circuitModel ) )
if( !m_schematicFrame->ReadyToNetlist( _( "Simulator requires a fully annotated schematic." ) )
|| !m_simulator->Attach( m_circuitModel ) )
{
DisplayErrorMessage( this, _( "There were errors during netlist export, aborted." ) );
DisplayErrorMessage( this, _( "Errors during netlist generation; simulation aborted." ) );
return;
}