From 5c5e41500a2f11b69e7e51c98f77da1d79de1194 Mon Sep 17 00:00:00 2001 From: Adam Simpkins Date: Thu, 31 Aug 2023 12:48:39 -0700 Subject: [PATCH] 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. (cherry picked from commit 9b69d8468861c24229fa39f70349ac16c5a95c03) --- kicad/cli/command_export_pcb_drill.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/kicad/cli/command_export_pcb_drill.cpp b/kicad/cli/command_export_pcb_drill.cpp index b1e8c6a2d8..47f47c42bc 100644 --- a/kicad/cli/command_export_pcb_drill.cpp +++ b/kicad/cli/command_export_pcb_drill.cpp @@ -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::EXPORT_PCB_DRILL_COMMAND::EXPORT_PCB_DRILL_COMMAND() : EXPORT_PCB_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::EXPORT_PCB_DRILL_COMMAND::doPerform( KIWAY& aKiway ) return EXIT_CODES::ERR_ARGS; } + wxString drillFormat = + FROM_UTF8( m_argParser.get( 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( ARG_MAP_FORMAT ).c_str() ); if( mapFormat == wxS( "pdf" ) )