netlist_exporter_spice: cleanup data lists when rerun the netlister.

It avoid duplicate includes when rerun the simulator.
Avoid also duplicate includes found in symbols.
Fixes #12192
https://gitlab.com/kicad/code/kicad/issues/12192
This commit is contained in:
jean-pierre charras 2022-08-09 20:17:34 +02:00
parent 4f7d7013e0
commit 574783bf70
2 changed files with 8 additions and 5 deletions

View File

@ -69,6 +69,9 @@ bool NETLIST_EXPORTER_SPICE::WriteNetlist( const wxString& aOutFileName, unsigne
bool NETLIST_EXPORTER_SPICE::GenerateNetlist( OUTPUTFORMATTER& aFormatter, unsigned aNetlistOptions )
{
// Cleanup list to avoid duplicate if the netlist exporter is run more than once.
m_rawIncludes.clear();
// Default title.
m_title = "KiCad schematic";
@ -330,7 +333,7 @@ bool NETLIST_EXPORTER_SPICE::readModel( SCH_SYMBOL& aSymbol, SPICE_ITEM& aItem )
wxString path = model->GetParam( libParamIndex ).value->ToString();
if( path != "" )
m_rawIncludes.push_back( path );
m_rawIncludes.insert( path );
}
return true;

View File

@ -121,12 +121,12 @@ private:
void writeModels( OUTPUTFORMATTER& aFormatter );
void writeItems( OUTPUTFORMATTER& aFormatter );
wxString m_title; ///< Spice simulation title found in the schematic sheet
std::vector<wxString> m_directives; ///< Spice directives found in the schematic sheet
wxString m_title; ///< Spice simulation title found in the schematic sheet
std::vector<wxString> m_directives; ///< Spice directives found in the schematic sheet
std::map<wxString, std::unique_ptr<SIM_LIBRARY>> m_libraries; ///< Spice libraries
std::vector<wxString> m_rawIncludes;
std::set<wxString> m_rawIncludes; ///< include directives found in symbols
std::set<wxString> m_nets;
std::list<SPICE_ITEM> m_items; ///< Items representing schematic symbols in Spice world
std::list<SPICE_ITEM> m_items; ///< Items representing schematic symbols in Spice world
};