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_GENERATE_REPORT "--generate-report"
42#define ARG_REPORT_PATH "--report-path"
43#define ARG_GENERATE_TENTING "--generate-tenting"
44#define ARG_MAP_FORMAT "--map-format"
45#define ARG_DRILL_ORIGIN "--drill-origin"
54 .default_value( std::string(
"excellon" ) )
59 .default_value( std::string(
"absolute" ) )
61 .metavar(
"DRILL_ORIGIN" );
64 .default_value( std::string(
"decimal" ) )
66 _(
"Valid options are: decimal,suppressleading,suppresstrailing,keep." ) ) )
67 .metavar(
"ZEROS_FORMAT" );
70 .default_value( std::string(
"alternate" ) )
72 .metavar(
"OVAL_FORMAT" );
75 .default_value( std::string(
"mm" ) )
88 .
help(
UTF8STDSTR(
_(
"Generate independent files for NPTH and PTH holes" ) ) )
100 .default_value( std::string(
"" ) )
102 .metavar(
"REPORT_FILE" );
109 .default_value( std::string(
"pdf" ) )
111 .metavar(
"MAP_FORMAT" );
127 if( !drillJob->GetConfiguredOutputPath().IsEmpty() )
129 wxFileName fn( drillJob->GetConfiguredOutputPath(), wxEmptyString );
133 wxFprintf( stderr,
_(
"Output must be a directory\n" ) );
140 if( format == wxS(
"excellon" ) )
144 else if( format == wxS(
"gerber" ) )
150 wxFprintf( stderr,
_(
"Invalid drill format\n" ) );
156 if( units == wxS(
"mm" ) )
160 else if( units == wxS(
"in" ) )
166 wxFprintf( stderr,
_(
"Invalid units specified\n" ) );
172 if( zeroFormat == wxS(
"decimal" ) )
176 else if( zeroFormat == wxS(
"suppressleading" ) )
180 else if( zeroFormat == wxS(
"suppresstrailing" ) )
184 else if( zeroFormat == wxS(
"keep" ) )
190 wxFprintf( stderr,
_(
"Invalid zeros format specified\n" ) );
194 wxString drillFormat =
197 if( drillFormat == wxS(
"route" ) )
199 drillJob->m_excellonOvalDrillRoute =
true;
201 else if( drillFormat == wxS(
"alternate" ) )
203 drillJob->m_excellonOvalDrillRoute =
false;
207 wxFprintf( stderr,
_(
"Invalid oval drill format specified\n" ) );
213 if( mapFormat == wxS(
"pdf" ) )
217 else if( mapFormat == wxS(
"ps" ) )
221 else if( mapFormat == wxS(
"gerberx2" ) )
225 else if( mapFormat == wxS(
"dxf" ) )
229 else if( mapFormat == wxS(
"svg" ) )
235 wxFprintf( stderr,
_(
"Invalid map format specified\n" ) );
241 if( origin == wxS(
"absolute" ) )
245 else if( origin == wxS(
"plot" ) )
251 wxFprintf( stderr,
_(
"Invalid origin mode specified\n" ) );
263 if( drillJob->m_gerberPrecision != 5 && drillJob->m_gerberPrecision != 6 )
265 wxFprintf( stderr,
_(
"Gerber coordinate precision should be either 5 or 6\n" ) );
269 wxString reportPath = drillJob->m_reportPath =
271 if( drillJob->m_generateReport )
273 drillJob->m_reportPath = reportPath;
275 else if( !reportPath.IsEmpty() )
277 wxFprintf( stderr,
_(
"Warning: Report path supplied without --generate-report, no report will be generated\n" ) );
argparse::ArgumentParser m_argParser
wxString m_argOutput
Value of the output arg if configured.
wxString m_argInput
Value of the common input arg if configured.
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, PROGRESS_REPORTER *aProgressReporter=nullptr)
#define ARG_EXCELLON_SEPARATE_TH
#define ARG_GENERATE_TENTING
#define ARG_EXCELLON_MINIMALHEAD
#define ARG_EXCELLON_ZEROS_FORMAT
#define ARG_EXCELLON_UNITS
#define ARG_EXCELLON_MIRRORY
#define ARG_GENERATE_REPORT
#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)
PCB_EXPORT_BASE_COMMAND(const std::string &aName, bool aInputCanBeDir=false, bool aOutputIsDir=false)