29#include <wx/tokenzr.h>
31#define ARG_FORMAT "--format"
32#define ARG_EXCELLON_MIRRORY "--excellon-mirror-y"
33#define ARG_EXCELLON_MINIMALHEAD "--excellon-min-header"
34#define ARG_EXCELLON_SEPARATE_TH "--excellon-separate-th"
35#define ARG_EXCELLON_ZEROS_FORMAT "--excellon-zeros-format"
36#define ARG_GERBER_PRECISION "--gerber-precision"
37#define ARG_UNITS "--units"
38#define ARG_GENERATE_MAP "--generate-map"
39#define ARG_MAP_FORMAT "--map-format"
40#define ARG_DRILL_ORIGIN "--drill-origin"
41#define ARG_SEPARATE_FILES "--separate-files"
46 .default_value( std::string(
"excellon" ) )
47 .help(
UTF8STDSTR(
_(
"Valid options excellon, gerber." ) ) );
50 .default_value( std::string(
"decimal" ) )
52 _(
"Valid options are: decimal,suppressleading,suppresstrailing,keep." ) ) );
55 .default_value( std::string(
"absolute" ) )
56 .help(
UTF8STDSTR(
_(
"Valid options are: absolute,plot" ) ) );
59 .default_value( std::string(
"in" ) )
60 .help(
UTF8STDSTR(
_(
"Output units, valid options:in,mm" ) ) );
64 .implicit_value(
true )
65 .default_value(
false );
69 .implicit_value(
true )
70 .default_value(
false );
73 .help(
UTF8STDSTR(
_(
"PTH and NPTH in separate files" ) ) )
74 .implicit_value(
true )
75 .default_value(
false );
78 .help(
UTF8STDSTR(
_(
"Generate map / summary of drill hits" ) ) )
79 .implicit_value(
true )
80 .default_value(
false );
83 .default_value( std::string(
"pdf" ) )
84 .help(
UTF8STDSTR(
_(
"Valid options: pdf,gerberx2,ps,dxf,svg" ) ) );
87 .help(
UTF8STDSTR(
_(
"Generate independent files for NPTH and PTH holes" ) ) )
88 .implicit_value(
true )
89 .default_value(
false );
92 .help(
UTF8STDSTR(
_(
"Precision of gerber coordinates (5 or 6)" ) ) )
101 drillJob->m_filename =
FROM_UTF8( m_argParser.get<std::string>(
ARG_INPUT ).c_str() );
104 if( !drillJob->m_outputDir.IsEmpty() )
106 wxFileName fn( drillJob->m_outputDir );
109 wxFprintf( stderr,
_(
"Output must be a directory\n" ) );
115 if( format ==
"excellon" )
119 else if( format ==
"gerber" )
125 wxFprintf( stderr,
_(
"Invalid drill format\n" ) );
131 if( units == wxS(
"mm" ) )
135 else if( units == wxS(
"in" ) )
141 wxFprintf( stderr,
_(
"Invalid units specified\n" ) );
147 if( zeroFormat == wxS(
"decimal" ) )
151 else if( zeroFormat == wxS(
"suppressleading" ) )
155 else if( zeroFormat == wxS(
"suppresstrailing" ) )
159 else if( zeroFormat == wxS(
"keep" ) )
165 wxFprintf( stderr,
_(
"Invalid zeros format specified\n" ) );
171 if( mapFormat == wxS(
"pdf" ) )
175 else if( mapFormat == wxS(
"ps" ) )
179 else if( mapFormat == wxS(
"gerberx2" ) )
183 else if( mapFormat == wxS(
"dxf" ) )
187 else if( mapFormat == wxS(
"svg" ) )
193 wxFprintf( stderr,
_(
"Invalid map format specified\n" ) );
199 if( origin == wxS(
"absolute" ) )
203 else if( origin == wxS(
"plot" ) )
209 wxFprintf( stderr,
_(
"Invalid origin mode specified\n" ) );
218 if( drillJob->m_gerberPrecision != 5 && drillJob->m_gerberPrecision != 6 )
220 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.
EXPORT_PCB_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_SEPARATE_FILES
#define ARG_EXCELLON_MINIMALHEAD
#define ARG_EXCELLON_ZEROS_FORMAT
#define ARG_EXCELLON_MIRRORY
#define ARG_GERBER_PRECISION
This file contains miscellaneous commonly used macros and functions.
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
static const int ERR_ARGS