kicad-cli: add option to control oval drill export behavior

Add an argument to "kicad-cli pcb export drill" to control the oval
holes drill mode for the excellon output format.

The Generate Drill Files GUI dialog recommends the newer "route"
behavior by default.  Previously this option was not exposed in
kicad-cli.  This commit does not change the default kicad-cli behavior,
but simply adds an argument to control it.
This commit is contained in:
Adam Simpkins 2023-08-31 12:48:39 -07:00
parent 160ec181ac
commit 9b69d84688
1 changed files with 21 additions and 0 deletions

View File

@ -33,6 +33,7 @@
#define ARG_EXCELLON_MINIMALHEAD "--excellon-min-header"
#define ARG_EXCELLON_SEPARATE_TH "--excellon-separate-th"
#define ARG_EXCELLON_ZEROS_FORMAT "--excellon-zeros-format"
#define ARG_EXCELLON_OVAL_FORMAT "--excellon-oval-format"
#define ARG_GERBER_PRECISION "--gerber-precision"
#define ARG_EXCELLON_UNITS "--excellon-units"
#define ARG_GENERATE_MAP "--generate-map"
@ -54,6 +55,10 @@ CLI::PCB_EXPORT_DRILL_COMMAND::PCB_EXPORT_DRILL_COMMAND() : PCB_EXPORT_BASE_COMM
.help( UTF8STDSTR(
_( "Valid options are: decimal,suppressleading,suppresstrailing,keep." ) ) );
m_argParser.add_argument( ARG_EXCELLON_OVAL_FORMAT )
.default_value( std::string( "alternate" ) )
.help( UTF8STDSTR( _( "Valid options are: route,alternate." ) ) );
m_argParser.add_argument( "-u", ARG_EXCELLON_UNITS )
.default_value( std::string( "mm" ) )
.help( UTF8STDSTR( _( "Output units, valid options:in,mm" ) ) );
@ -160,6 +165,22 @@ int CLI::PCB_EXPORT_DRILL_COMMAND::doPerform( KIWAY& aKiway )
return EXIT_CODES::ERR_ARGS;
}
wxString drillFormat =
FROM_UTF8( m_argParser.get<std::string>( ARG_EXCELLON_OVAL_FORMAT ).c_str() );
if( drillFormat == wxS( "route" ) )
{
drillJob->m_excellonOvalDrillRoute = true;
}
else if( drillFormat == wxS( "alternate" ) )
{
drillJob->m_excellonOvalDrillRoute = false;
}
else
{
wxFprintf( stderr, _( "Invalid oval drill format specified\n" ) );
return EXIT_CODES::ERR_ARGS;
}
wxString mapFormat = FROM_UTF8( m_argParser.get<std::string>( ARG_MAP_FORMAT ).c_str() );
if( mapFormat == wxS( "pdf" ) )