Support .title directive in spice netlist exporter

Spice netlist exporter processes all texts on the exported schematic
sheet to find spice directives and include them in the output file.
By default it also added ".title KiCad schematic" in the first line, so
if there was another .title directive in the exported schematic sheet,
the generated file would contain two .title directives.

This patch looks for .title directive and when one is found - it uses
the specified title in the first line.
This commit is contained in:
ludovic léau-mercier 2018-01-26 08:50:10 +01:00 committed by Maciej Suminski
parent 8e18aea11d
commit 0d532b43de
2 changed files with 11 additions and 1 deletions

View File

@ -63,10 +63,13 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* aFormatter, unsigned aCtl
// Netlist options
const bool useNetcodeAsNetName = false;//aCtl & NET_USE_NETCODES_AS_NETNAMES;
// default title
m_title = "KiCad schematic";
if( !ProcessNetlist( aCtl ) )
return false;
aFormatter->Print( 0, ".title KiCad schematic\n" );
aFormatter->Print( 0, ".title %s\n", (const char*) m_title.c_str() );
// Write .include directives
for( const auto& lib : m_libraries )
@ -382,6 +385,10 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
if( !lib.IsEmpty() )
m_libraries.insert( lib );
}
else if( directive.StartsWith( ".title " ) )
{
m_title = directive.AfterFirst( ' ' );
}
else
{
m_directives.push_back( directive );

View File

@ -216,6 +216,9 @@ protected:
virtual void writeDirectives( OUTPUTFORMATTER* aFormatter, unsigned aCtl ) const;
private:
///> Spice simulation title found in the processed schematic sheet
wxString m_title;
///> Spice directives found in the processed schematic sheet
std::vector<wxString> m_directives;