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"
51 .default_value( std::string(
"excellon" ) )
52 .help(
UTF8STDSTR(
_(
"Valid options excellon, gerber." ) ) )
56 .default_value( std::string(
"absolute" ) )
57 .help(
UTF8STDSTR(
_(
"Valid options are: absolute,plot" ) ) )
58 .metavar(
"DRILL_ORIGIN" );
61 .default_value( std::string(
"decimal" ) )
63 _(
"Valid options are: decimal,suppressleading,suppresstrailing,keep." ) ) )
64 .metavar(
"ZEROS_FORMAT" );
67 .default_value( std::string(
"alternate" ) )
68 .help(
UTF8STDSTR(
_(
"Valid options are: route,alternate." ) ) )
69 .metavar(
"OVAL_FORMAT" );
72 .default_value( std::string(
"mm" ) )
73 .help(
UTF8STDSTR(
_(
"Output units, valid options:in,mm" ) ) )
85 .help(
UTF8STDSTR(
_(
"Generate independent files for NPTH and PTH holes" ) ) )
89 .help(
UTF8STDSTR(
_(
"Generate map / summary of drill hits" ) ) )
93 .default_value( std::string(
"pdf" ) )
94 .help(
UTF8STDSTR(
_(
"Valid options: pdf,gerberx2,ps,dxf,svg" ) ) )
95 .metavar(
"MAP_FORMAT" );
98 .help(
UTF8STDSTR(
_(
"Precision of Gerber coordinates (5 or 6)" ) ) )
108 drillJob->m_filename = m_argInput;
109 drillJob->SetOutputPath( m_argOutput );
111 if( !drillJob->GetOutputPath().IsEmpty() )
113 wxFileName fn( drillJob->GetOutputPath(), wxEmptyString );
117 wxFprintf( stderr,
_(
"Output must be a directory\n" ) );
124 if( format == wxS(
"excellon" ) )
128 else if( format == wxS(
"gerber" ) )
134 wxFprintf( stderr,
_(
"Invalid drill format\n" ) );
140 if( units == wxS(
"mm" ) )
144 else if( units == wxS(
"in" ) )
150 wxFprintf( stderr,
_(
"Invalid units specified\n" ) );
156 if( zeroFormat == wxS(
"decimal" ) )
160 else if( zeroFormat == wxS(
"suppressleading" ) )
164 else if( zeroFormat == wxS(
"suppresstrailing" ) )
168 else if( zeroFormat == wxS(
"keep" ) )
174 wxFprintf( stderr,
_(
"Invalid zeros format specified\n" ) );
178 wxString drillFormat =
181 if( drillFormat == wxS(
"route" ) )
183 drillJob->m_excellonOvalDrillRoute =
true;
185 else if( drillFormat == wxS(
"alternate" ) )
187 drillJob->m_excellonOvalDrillRoute =
false;
191 wxFprintf( stderr,
_(
"Invalid oval drill format specified\n" ) );
197 if( mapFormat == wxS(
"pdf" ) )
201 else if( mapFormat == wxS(
"ps" ) )
205 else if( mapFormat == wxS(
"gerberx2" ) )
209 else if( mapFormat == wxS(
"dxf" ) )
213 else if( mapFormat == wxS(
"svg" ) )
219 wxFprintf( stderr,
_(
"Invalid map format specified\n" ) );
225 if( origin == wxS(
"absolute" ) )
229 else if( origin == wxS(
"plot" ) )
235 wxFprintf( stderr,
_(
"Invalid origin mode specified\n" ) );
245 if( drillJob->m_gerberPrecision != 5 && drillJob->m_gerberPrecision != 6 )
247 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 *aJob, REPORTER *aReporter=nullptr)
#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)