32#define ARG_DRILL_ORIGIN "--drill-origin"
33#define ARG_GRID_ORIGIN "--grid-origin"
34#define ARG_NO_UNSPECIFIED "--no-unspecified"
35#define ARG_NO_DNP "--no-dnp"
36#define ARG_SUBST_MODELS "--subst-models"
37#define ARG_FORCE "--force"
38#define ARG_MIN_DISTANCE "--min-distance"
39#define ARG_USER_ORIGIN "--user-origin"
40#define ARG_BOARD_ONLY "--board-only"
41#define ARG_CUT_VIAS_IN_BODY "--cut-vias-in-body"
42#define ARG_NO_BOARD_BODY "--no-board-body"
43#define ARG_NO_COMPONENTS "--no-components"
44#define ARG_INCLUDE_TRACKS "--include-tracks"
45#define ARG_INCLUDE_PADS "--include-pads"
46#define ARG_INCLUDE_ZONES "--include-zones"
47#define ARG_INCLUDE_INNER_COPPER "--include-inner-copper"
48#define ARG_INCLUDE_SILKSCREEN "--include-silkscreen"
49#define ARG_INCLUDE_SOLDERMASK "--include-soldermask"
50#define ARG_FUSE_SHAPES "--fuse-shapes"
51#define ARG_FILL_ALL_VIAS "--fill-all-vias"
52#define ARG_NO_OPTIMIZE_STEP "--no-optimize-step"
53#define ARG_NET_FILTER "--net-filter"
54#define ARG_FORMAT "--format"
55#define ARG_VRML_UNITS "--units"
56#define ARG_VRML_MODELS_DIR "--models-dir"
57#define ARG_VRML_MODELS_RELATIVE "--models-relative"
58#define ARG_COMPONENT_FILTER "--component-filter"
60#define REGEX_QUANTITY "([\\s]*[+-]?[\\d]*[.]?[\\d]*)"
61#define REGEX_DELIMITER "(?:[\\s]*x)"
62#define REGEX_UNIT "([m]{2}|(?:in))"
65 const std::string& aDescription,
77 .default_value( std::string(
"step" ) )
78 .help(
UTF8STDSTR(
_(
"Output file format, options: step, brep, xao, glb "
79 "(binary glTF), ply, stl" ) ) );
87 .help(
UTF8STDSTR(
_(
"Exclude 3D models for components with 'Unspecified' footprint "
89 .implicit_value(
true )
90 .default_value(
false );
93 .help(
UTF8STDSTR(
_(
"Exclude 3D models for components with 'Do not populate' "
101 .help(
UTF8STDSTR(
_(
"Use Grid Origin for output origin" ) ) )
105 .help(
UTF8STDSTR(
_(
"Use Drill Origin for output origin" ) ) )
109 .help(
UTF8STDSTR(
_(
"Substitute STEP or IGS models with the same name in place "
110 "of VRML models" ) ) )
114 .help(
UTF8STDSTR(
_(
"Only generate a board with no components" ) ) )
118 .help(
UTF8STDSTR(
_(
"Cut via holes in board body even if conductor layers are "
119 "not exported." ) ) )
127 .help(
UTF8STDSTR(
_(
"Exclude 3D models for components" ) ) )
131 .help(
UTF8STDSTR(
_(
"Only include component 3D models matching this list of "
132 "reference designators (comma-separated, wildcards supported)"
134 .default_value( std::string() );
137 .help(
UTF8STDSTR(
_(
"Export tracks and vias" ) ) )
149 .help(
UTF8STDSTR(
_(
"Export elements on inner copper layers" ) ) )
153 .help(
UTF8STDSTR(
_(
"Export silkscreen graphics as a set of flat faces" ) ) )
157 .help(
UTF8STDSTR(
_(
"Export soldermask layers as a set of flat faces" ) ) )
161 .help(
UTF8STDSTR(
_(
"Fuse overlapping geometry together" ) ) )
165 .help(
UTF8STDSTR(
_(
"Don't cut via holes in conductor layers." ) ) )
169 .default_value( std::string(
"0.01mm" ) )
170 .help(
UTF8STDSTR(
_(
"Minimum distance between points to treat them as separate "
172 .metavar(
"MIN_DIST" );
175 .default_value( std::string() )
176 .help(
UTF8STDSTR(
_(
"Only include copper items belonging to nets matching this "
183 .help(
UTF8STDSTR(
_(
"Do not optimize STEP file (enables writing parametric "
189 .default_value( std::string() )
190 .help(
UTF8STDSTR(
_(
"User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm "
191 "(default unit mm)" ) ) );
196 .default_value( std::string(
"in" ) )
197 .help(
UTF8STDSTR(
_(
"Output units; valid options: mm, m, in, tenths" ) ) );
200 .default_value( std::string(
"" ) )
201 .help(
UTF8STDSTR(
_(
"Name of folder to create and store 3d models in, if not "
202 "specified or empty, the models will be embedded in main "
203 "exported VRML file" ) ) );
206 .help(
UTF8STDSTR(
_(
"Used with --models-dir to output relative paths in the "
207 "resulting file" ) ) )
249 step->SetConfiguredOutputPath( m_argOutput );
251 step->m_filename = m_argInput;
252 step->m_format = m_format;
253 step->SetVarOverrides( m_argDefineVars );
259 if( format == wxS(
"step" ) )
261 else if( format == wxS(
"brep" ) )
263 else if( format == wxS(
"xao" ) )
265 else if( format == wxS(
"glb" ) )
267 else if( format == wxS(
"ply" ) )
269 else if( format == wxS(
"stl" ) )
273 wxFprintf( stderr,
_(
"Invalid format specified\n" ) );
282 if( units == wxS(
"in" ) )
284 else if( units == wxS(
"mm" ) )
286 else if( units == wxS(
"m" ) )
288 else if( units == wxS(
"tenths" ) )
292 wxFprintf( stderr,
_(
"Invalid units specified\n" ) );
305 if( !userOrigin.IsEmpty() )
308 std::regex_constants::icase );
310 std::string str( userOrigin.ToUTF8() );
311 std::regex_search( str, sm, re_pattern );
312 step->m_3dparams.m_Origin.x = atof( sm.str( 1 ).c_str() );
313 step->m_3dparams.m_Origin.y = atof( sm.str( 2 ).c_str() );
317 step->m_3dparams.m_Origin.x =
pcbIUScale.
mmToIU( step->m_3dparams.m_Origin.x );
318 step->m_3dparams.m_Origin.y =
pcbIUScale.
mmToIU( step->m_3dparams.m_Origin.y );
320 std::string tunit( sm[3] );
322 if( tunit.size() > 0 )
324 if( ( !sm.str( 1 ).compare(
" " ) || !sm.str( 2 ).compare(
" " ) )
325 || ( sm.size() != 4 ) )
327 std::cout << m_argParser;
332 if( !tunit.compare(
"in" ) || !tunit.compare(
"inch" ) )
334 step->m_3dparams.m_Origin *= 25.4;
336 else if( tunit.compare(
"mm" ) )
338 std::cout << m_argParser;
343 step->m_hasUserOrigin =
true;
349 wxString minDistance =
352 if( !minDistance.IsEmpty() )
356 std::string str( minDistance.ToUTF8() );
357 std::regex_search( str, sm, re_pattern );
358 step->m_3dparams.m_BoardOutlinesChainingEpsilon = atof( sm.str( 1 ).c_str() );
360 std::string tunit( sm[2] );
362 if( tunit.size() > 0 )
364 if( !tunit.compare(
"in" ) || !tunit.compare(
"inch" ) )
366 step->m_3dparams.m_BoardOutlinesChainingEpsilon *= 25.4;
368 else if( tunit.compare(
"mm" ) )
370 std::cout << m_argParser;
constexpr EDA_IU_SCALE pcbIUScale
void addCommonArgs(bool aInput, bool aOutput, bool aInputCanBeDir, bool aOutputIsDir)
Set up the most common of args used across cli.
argparse::ArgumentParser m_argParser
void addDefineArg()
Set up the drawing sheet arg used by many of the export commands.
bool m_IncludeUnspecified
wxString m_ComponentFilter
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)
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
#define ARG_VRML_MODELS_DIR
#define ARG_NO_UNSPECIFIED
#define ARG_INCLUDE_SILKSCREEN
#define ARG_INCLUDE_TRACKS
#define ARG_INCLUDE_ZONES
#define ARG_INCLUDE_INNER_COPPER
#define ARG_VRML_MODELS_RELATIVE
#define ARG_NO_OPTIMIZE_STEP
#define ARG_CUT_VIAS_IN_BODY
#define ARG_INCLUDE_SOLDERMASK
#define ARG_FILL_ALL_VIAS
#define ARG_NO_BOARD_BODY
#define ARG_NO_COMPONENTS
#define ARG_COMPONENT_FILTER
This file contains miscellaneous commonly used macros and functions.
static const int ERR_ARGS
std::vector< FAB_LAYER_COLOR > dummy
wxString From_UTF8(const char *cstring)
PCB_EXPORT_3D_COMMAND(const std::string &aName, const std::string &aDescription, JOB_EXPORT_PCB_3D::FORMAT aFormat=JOB_EXPORT_PCB_3D::FORMAT::UNKNOWN)
int doPerform(KIWAY &aKiway) override
The internal handler that should be overloaded to implement command specific processing and work.
JOB_EXPORT_PCB_3D::FORMAT m_format
constexpr int mmToIU(double mm) const