30#include <wx/tokenzr.h>
32#define ARG_FORMAT "--format"
33#define ARG_EXCELLON_MIRRORY "--excellon-mirror-y"
34#define ARG_EXCELLON_MINIMALHEAD "--excellon-min-header"
35#define ARG_EXCELLON_SEPARATE_TH "--excellon-separate-th"
36#define ARG_EXCELLON_ZEROS_FORMAT "--excellon-zeros-format"
37#define ARG_EXCELLON_OVAL_FORMAT "--excellon-oval-format"
38#define ARG_GERBER_PRECISION "--gerber-precision"
39#define ARG_EXCELLON_UNITS "--excellon-units"
40#define ARG_GENERATE_MAP "--generate-map"
41#define ARG_MAP_FORMAT "--map-format"
42#define ARG_DRILL_ORIGIN "--drill-origin"
49 .default_value( std::string(
"excellon" ) )
50 .help(
UTF8STDSTR(
_(
"Valid options excellon, gerber." ) ) )
54 .default_value( std::string(
"absolute" ) )
55 .help(
UTF8STDSTR(
_(
"Valid options are: absolute,plot" ) ) )
56 .metavar(
"DRILL_ORIGIN" );
59 .default_value( std::string(
"decimal" ) )
61 _(
"Valid options are: decimal,suppressleading,suppresstrailing,keep." ) ) )
62 .metavar(
"ZEROS_FORMAT" );
65 .default_value( std::string(
"alternate" ) )
66 .help(
UTF8STDSTR(
_(
"Valid options are: route,alternate." ) ) )
67 .metavar(
"OVAL_FORMAT" );
70 .default_value( std::string(
"mm" ) )
71 .help(
UTF8STDSTR(
_(
"Output units, valid options:in,mm" ) ) )
76 .implicit_value(
true )
77 .default_value(
false );
81 .implicit_value(
true )
82 .default_value(
false );
85 .help(
UTF8STDSTR(
_(
"Generate independent files for NPTH and PTH holes" ) ) )
86 .implicit_value(
true )
87 .default_value(
false );
90 .help(
UTF8STDSTR(
_(
"Generate map / summary of drill hits" ) ) )
91 .implicit_value(
true )
92 .default_value(
false );
95 .default_value( std::string(
"pdf" ) )
96 .help(
UTF8STDSTR(
_(
"Valid options: pdf,gerberx2,ps,dxf,svg" ) ) )
97 .metavar(
"MAP_FORMAT" );
100 .help(
UTF8STDSTR(
_(
"Precision of Gerber coordinates (5 or 6)" ) ) )
109 drillJob->m_filename = m_argInput;
110 drillJob->m_outputDir = m_argOutput;
112 if( !drillJob->m_outputDir.IsEmpty() )
114 wxFileName fn( drillJob->m_outputDir );
117 wxFprintf( stderr,
_(
"Output must be a directory\n" ) );
123 if( format ==
"excellon" )
127 else if( format ==
"gerber" )
133 wxFprintf( stderr,
_(
"Invalid drill format\n" ) );
139 if( units == wxS(
"mm" ) )
143 else if( units == wxS(
"in" ) )
149 wxFprintf( stderr,
_(
"Invalid units specified\n" ) );
155 if( zeroFormat == wxS(
"decimal" ) )
159 else if( zeroFormat == wxS(
"suppressleading" ) )
163 else if( zeroFormat == wxS(
"suppresstrailing" ) )
167 else if( zeroFormat == wxS(
"keep" ) )
173 wxFprintf( stderr,
_(
"Invalid zeros format specified\n" ) );
177 wxString drillFormat =
179 if( drillFormat == wxS(
"route" ) )
181 drillJob->m_excellonOvalDrillRoute =
true;
183 else if( drillFormat == wxS(
"alternate" ) )
185 drillJob->m_excellonOvalDrillRoute =
false;
189 wxFprintf( stderr,
_(
"Invalid oval drill format specified\n" ) );
195 if( mapFormat == wxS(
"pdf" ) )
199 else if( mapFormat == wxS(
"ps" ) )
203 else if( mapFormat == wxS(
"gerberx2" ) )
207 else if( mapFormat == wxS(
"dxf" ) )
211 else if( mapFormat == wxS(
"svg" ) )
217 wxFprintf( stderr,
_(
"Invalid map format specified\n" ) );
223 if( origin == wxS(
"absolute" ) )
227 else if( origin == wxS(
"plot" ) )
233 wxFprintf( stderr,
_(
"Invalid origin mode specified\n" ) );
242 if( drillJob->m_gerberPrecision != 5 && drillJob->m_gerberPrecision != 6 )
244 wxFprintf( stderr,
_(
"Gerber coordinate precision should be either 5 or 6\n" ) );
argparse::ArgumentParser m_argParser
int doPerform(KIWAY &aKiway) override
The internal handler that should be overloaded to implement command specific processing and work.
PCB_EXPORT_DRILL_COMMAND()
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
int ProcessJob(KIWAY::FACE_T aFace, JOB *job)
#define ARG_EXCELLON_SEPARATE_TH
#define ARG_EXCELLON_MINIMALHEAD
#define ARG_EXCELLON_ZEROS_FORMAT
#define ARG_EXCELLON_UNITS
#define ARG_EXCELLON_MIRRORY
#define ARG_EXCELLON_OVAL_FORMAT
#define ARG_GERBER_PRECISION
This file contains miscellaneous commonly used macros and functions.
static const int ERR_ARGS
wxString From_UTF8(const char *cstring)