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"
50 .default_value( std::string(
"excellon" ) )
51 .help(
UTF8STDSTR(
_(
"Valid options excellon, gerber." ) ) )
55 .default_value( std::string(
"absolute" ) )
56 .help(
UTF8STDSTR(
_(
"Valid options are: absolute,plot" ) ) )
57 .metavar(
"DRILL_ORIGIN" );
60 .default_value( std::string(
"decimal" ) )
62 _(
"Valid options are: decimal,suppressleading,suppresstrailing,keep." ) ) )
63 .metavar(
"ZEROS_FORMAT" );
66 .default_value( std::string(
"alternate" ) )
67 .help(
UTF8STDSTR(
_(
"Valid options are: route,alternate." ) ) )
68 .metavar(
"OVAL_FORMAT" );
71 .default_value( std::string(
"mm" ) )
72 .help(
UTF8STDSTR(
_(
"Output units, valid options:in,mm" ) ) )
84 .help(
UTF8STDSTR(
_(
"Generate independent files for NPTH and PTH holes" ) ) )
88 .help(
UTF8STDSTR(
_(
"Generate map / summary of drill hits" ) ) )
92 .default_value( std::string(
"pdf" ) )
93 .help(
UTF8STDSTR(
_(
"Valid options: pdf,gerberx2,ps,dxf,svg" ) ) )
94 .metavar(
"MAP_FORMAT" );
97 .help(
UTF8STDSTR(
_(
"Precision of Gerber coordinates (5 or 6)" ) ) )
107 drillJob->m_filename = m_argInput;
108 drillJob->m_outputDir = m_argOutput;
110 if( !drillJob->m_outputDir.IsEmpty() )
112 wxFileName fn( drillJob->m_outputDir );
115 wxFprintf( stderr,
_(
"Output must be a directory\n" ) );
122 if( format == wxS(
"excellon" ) )
126 else if( format == wxS(
"gerber" ) )
132 wxFprintf( stderr,
_(
"Invalid drill format\n" ) );
138 if( units == wxS(
"mm" ) )
142 else if( units == wxS(
"in" ) )
148 wxFprintf( stderr,
_(
"Invalid units specified\n" ) );
154 if( zeroFormat == wxS(
"decimal" ) )
158 else if( zeroFormat == wxS(
"suppressleading" ) )
162 else if( zeroFormat == wxS(
"suppresstrailing" ) )
166 else if( zeroFormat == wxS(
"keep" ) )
172 wxFprintf( stderr,
_(
"Invalid zeros format specified\n" ) );
176 wxString drillFormat =
178 if( drillFormat == wxS(
"route" ) )
180 drillJob->m_excellonOvalDrillRoute =
true;
182 else if( drillFormat == wxS(
"alternate" ) )
184 drillJob->m_excellonOvalDrillRoute =
false;
188 wxFprintf( stderr,
_(
"Invalid oval drill format specified\n" ) );
194 if( mapFormat == wxS(
"pdf" ) )
198 else if( mapFormat == wxS(
"ps" ) )
202 else if( mapFormat == wxS(
"gerberx2" ) )
206 else if( mapFormat == wxS(
"dxf" ) )
210 else if( mapFormat == wxS(
"svg" ) )
216 wxFprintf( stderr,
_(
"Invalid map format specified\n" ) );
222 if( origin == wxS(
"absolute" ) )
226 else if( origin == wxS(
"plot" ) )
232 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)