30#define ARG_DRILL_ORIGIN "--drill-origin"
31#define ARG_GRID_ORIGIN "--grid-origin"
32#define ARG_NO_VIRTUAL "--no-virtual"
33#define ARG_SUBST_MODELS "--subst-models"
34#define ARG_FORCE "--force"
35#define ARG_OUTPUT "--output"
36#define ARG_INPUT "input"
37#define ARG_MIN_DISTANCE "--min-distance"
38#define ARG_USER_ORIGIN "--user-origin"
39#define ARG_BOARD_ONLY "--board-only"
40#define ARG_EXPORT_TRACKS "--export-tracks"
42#define REGEX_QUANTITY "([\\s]*[+-]?[\\d]*[.]?[\\d]*)"
43#define REGEX_DELIMITER "(?:[\\s]*x)"
44#define REGEX_UNIT "([m]{2}|(?:in))"
49 .help(
UTF8STDSTR(
_(
"Use Drill Origin for output origin" ) ) )
50 .implicit_value(
true )
51 .default_value(
false );
54 .help(
UTF8STDSTR(
_(
"Use Grid Origin for output origin" ) ) )
55 .implicit_value(
true )
56 .default_value(
false );
59 .help(
UTF8STDSTR(
_(
"Exclude 3D models for components with 'virtual' attribute" ) ) )
60 .implicit_value(
true )
61 .default_value(
false );
64 .help(
UTF8STDSTR(
_(
"Substitute STEP or IGS models with the same name in place of VRML models" ) ) )
65 .implicit_value(
true )
66 .default_value(
false );
70 .implicit_value(
true )
71 .default_value(
false );
74 .help(
UTF8STDSTR(
_(
"Only generate a board with no components" ) ) )
75 .implicit_value(
true )
76 .default_value(
false );
79 .help(
UTF8STDSTR(
_(
"Export tracks (extremely time consuming)" ) ) )
80 .implicit_value(
true )
81 .default_value(
false );
84 .default_value( std::string(
"0.01mm" ) )
85 .help(
UTF8STDSTR(
_(
"Minimum distance between points to treat them as separate ones" ) ) );
88 .default_value( std::string() )
89 .help(
UTF8STDSTR(
_(
"User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm (default unit mm)" ) ) );
92 .default_value( std::string() )
104 step->m_includeExcludedBom = !m_argParser.get<
bool>(
ARG_NO_VIRTUAL );
106 step->m_overwrite = m_argParser.get<
bool>(
ARG_FORCE );
116 if( !userOrigin.IsEmpty() )
119 std::regex_constants::icase );
121 std::string str( userOrigin.ToUTF8() );
122 std::regex_search( str, sm, re_pattern );
123 step->m_xOrigin = atof( sm.str( 1 ).c_str() );
124 step->m_yOrigin = atof( sm.str( 2 ).c_str() );
126 std::string tunit( sm[3] );
128 if( tunit.size() > 0 )
130 if( ( !sm.str( 1 ).compare(
" " ) || !sm.str( 2 ).compare(
" " ) )
131 || ( sm.size() != 4 ) )
133 std::cout << m_argParser;
138 if( !tunit.compare(
"in" ) || !tunit.compare(
"inch" ) )
140 step->m_xOrigin *= 25.4;
141 step->m_yOrigin *= 25.4;
143 else if( tunit.compare(
"mm" ) )
145 std::cout << m_argParser;
153 if( !minDistance.IsEmpty() )
156 std::regex_constants::icase );
158 std::string str( minDistance.ToUTF8() );
159 std::regex_search( str, sm, re_pattern );
160 step->m_BoardOutlinesChainingEpsilon = atof( sm.str( 1 ).c_str() );
162 std::string tunit( sm[2] );
164 if( tunit.size() > 0 )
166 if( !tunit.compare(
"in" ) || !tunit.compare(
"inch" ) )
168 step->m_BoardOutlinesChainingEpsilon *= 25.4;
170 else if( tunit.compare(
"mm" ) )
172 std::cout << m_argParser;
argparse::ArgumentParser m_argParser
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
int ProcessJob(KIWAY::FACE_T aFace, JOB *job)
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
#define ARG_EXPORT_TRACKS
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
std::vector< FAB_LAYER_COLOR > dummy
EXPORT_PCB_STEP_COMMAND()
int doPerform(KIWAY &aKiway) override
The internal handler that should be overloaded to implement command specific processing and work.