From 5041bddc3bc23e34227e525128cfda85065440df Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 10 Mar 2023 21:32:16 +0000 Subject: [PATCH] Union workbook sim commands with any defined on schematic. Fixes https://gitlab.com/kicad/code/kicad/issues/14215 --- eeschema/sim/simulator_frame.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/eeschema/sim/simulator_frame.cpp b/eeschema/sim/simulator_frame.cpp index 5388bc8f1c..b54af307d0 100644 --- a/eeschema/sim/simulator_frame.cpp +++ b/eeschema/sim/simulator_frame.cpp @@ -2167,6 +2167,35 @@ bool SIMULATOR_FRAME::LoadWorkbook( const wxString& aPath ) LoadSimulator(); + wxString schTextSimCommand = m_circuitModel->GetSchTextSimCommand().Lower(); + SIM_TYPE schTextSimType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( schTextSimCommand ); + + if( schTextSimType != ST_UNKNOWN ) + { + bool found = false; + + for( int ii = 0; ii < (int) m_plotNotebook->GetPageCount(); ++ii ) + { + auto* plot = dynamic_cast( m_plotNotebook->GetPage( ii ) ); + + if( plot && plot->GetType() == schTextSimType ) + { + if( schTextSimType == ST_DC ) + { + wxString plotSimCommand = plot->GetSimCommand().Lower(); + found = plotSimCommand.GetChar( 4 ) == schTextSimCommand.GetChar( 4 ); + } + else + { + found = true; + } + } + } + + if( !found ) + NewPlotPanel( schTextSimCommand, m_circuitModel->GetSimOptions() ); + } + rebuildSignalsList(); rebuildSignalsGrid( m_filter->GetValue() ); @@ -2444,9 +2473,8 @@ bool SIMULATOR_FRAME::EditSimCommand() if( !m_circuitModel->ReadSchematicAndLibraries( NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS, reporter ) ) { - DisplayErrorMessage( this, _( "Errors during netlist generation; simulation aborted.\n\n" ) + DisplayErrorMessage( this, _( "Errors during netlist generation.\n\n" ) + errors ); - return false; } if( m_plotNotebook->GetPageIndex( plotPanelWindow ) != wxNOT_FOUND )