CLI: Add allegro and pads netlist output format options

This commit is contained in:
Ethan Chien 2024-03-26 19:58:22 +08:00
parent 54919e6854
commit 0a89236f19
3 changed files with 24 additions and 2 deletions

View File

@ -40,7 +40,9 @@ public:
ORCADPCB2,
CADSTAR,
SPICE,
SPICEMODEL
SPICEMODEL,
PADS,
ALLEGRO
};
FORMAT format;

View File

@ -61,6 +61,8 @@
#include <netlist_exporter_spice_model.h>
#include <netlist_exporter_kicad.h>
#include <netlist_exporter_xml.h>
#include <netlist_exporter_pads.h>
#include <netlist_exporter_allegro.h>
#include <fields_data_model.h>
@ -307,6 +309,16 @@ int EESCHEMA_JOBS_HANDLER::JobExportNetlist( JOB* aJob )
helper = std::make_unique<NETLIST_EXPORTER_XML>( sch );
break;
case JOB_EXPORT_SCH_NETLIST::FORMAT::PADS:
fileExt = wxS( "asc" );
helper = std::make_unique<NETLIST_EXPORTER_PADS>( sch );
break;
case JOB_EXPORT_SCH_NETLIST::FORMAT::ALLEGRO:
fileExt = wxS( "txt" );
helper = std::make_unique<NETLIST_EXPORTER_ALLEGRO>( sch );
break;
default:
m_reporter->Report( _( "Unknown netlist format.\n" ), RPT_SEVERITY_ERROR );
return CLI::EXIT_CODES::ERR_UNKNOWN;

View File

@ -38,7 +38,7 @@ CLI::SCH_EXPORT_NETLIST_COMMAND::SCH_EXPORT_NETLIST_COMMAND() : COMMAND( "netlis
m_argParser.add_argument( ARG_FORMAT )
.default_value( std::string( "kicadsexpr" ) )
.help( UTF8STDSTR( _( "Netlist output format, valid options: kicadsexpr, kicadxml, "
"cadstar, orcadpcb2, spice, spicemodel" ) ) )
"cadstar, orcadpcb2, spice, spicemodel, pads, allegro" ) ) )
.metavar( "FORMAT" );
}
@ -82,6 +82,14 @@ int CLI::SCH_EXPORT_NETLIST_COMMAND::doPerform( KIWAY& aKiway )
{
netJob->format = JOB_EXPORT_SCH_NETLIST::FORMAT::SPICEMODEL;
}
else if( format == "pads" )
{
netJob->format = JOB_EXPORT_SCH_NETLIST::FORMAT::PADS;
}
else if( format == "allegro" )
{
netJob->format = JOB_EXPORT_SCH_NETLIST::FORMAT::ALLEGRO;
}
else
{
wxFprintf( stderr, _( "Invalid format\n" ) );