From a72fd0ebdd39580c91391fe30288805b8869b753 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 17 May 2023 08:42:29 +0200 Subject: [PATCH] Simulator: Ensure connectivity is up to date (incremental mode) before building netlist also: SIM_PLOT_FRAME::onShowNetlist(): verify all symbols are annotated. --- eeschema/sim/sim_plot_frame.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index d89df0f4e3..b4fccb0e03 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -56,6 +56,7 @@ #include #include #include +#include // for Incremental Connectivity option SIM_PLOT_TYPE operator|( SIM_PLOT_TYPE aFirst, SIM_PLOT_TYPE aSecond ) @@ -460,8 +461,14 @@ void SIM_PLOT_FRAME::StartSimulation( const wxString& aSimCommand ) wxString errors; WX_STRING_REPORTER reporter( &errors ); - if( !m_schematicFrame->ReadyToNetlist( _( "Simulator requires a fully annotated schematic." ) ) - || !m_simulator->Attach( m_circuitModel, reporter ) ) + if( !m_schematicFrame->ReadyToNetlist( _( "Simulator requires a fully annotated schematic." ) ) ) + return; + + // If we are using the new connectivity, make sure that we do a full-rebuild + if( ADVANCED_CFG::GetCfg().m_IncrementalConnectivity ) + m_schematicFrame->RecalculateConnections( GLOBAL_CLEANUP ); + + if( !m_simulator->Attach( m_circuitModel, reporter ) ) { DisplayErrorMessage( this, _( "Errors during netlist generation; simulation aborted.\n\n" ) + errors ); @@ -1728,6 +1735,13 @@ void SIM_PLOT_FRAME::onShowNetlist( wxCommandEvent& event ) if( m_schematicFrame == nullptr || m_simulator == nullptr ) return; + if( !m_schematicFrame->ReadyToNetlist( _( "Simulator requires a fully annotated schematic." ) ) ) + return; + + // If we are using the new connectivity, make sure that we do a full-rebuild + if( ADVANCED_CFG::GetCfg().m_IncrementalConnectivity ) + m_schematicFrame->RecalculateConnections( GLOBAL_CLEANUP ); + wxString errors; WX_STRING_REPORTER reporter( &errors ); STRING_FORMATTER formatter;