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, stepz, brep, xao, glb " 
   79                                      "(binary glTF), ply, stl" ) ) );
 
   87            .help( 
UTF8STDSTR( 
_( 
"Exclude 3D models for components with 'Unspecified' footprint " 
   92            .help( 
UTF8STDSTR( 
_( 
"Exclude 3D models for components with 'Do not populate' " 
  100                .help( 
UTF8STDSTR( 
_( 
"Use Grid Origin for output origin" ) ) )
 
  104                .help( 
UTF8STDSTR( 
_( 
"Use Drill Origin for output origin" ) ) )
 
  108                .help( 
UTF8STDSTR( 
_( 
"Substitute STEP or IGS models with the same name in place " 
  109                                      "of VRML models" ) ) )
 
  113                .help( 
UTF8STDSTR( 
_( 
"Only generate a board with no components" ) ) )
 
  117                .help( 
UTF8STDSTR( 
_( 
"Cut via holes in board body even if conductor layers are " 
  118                                      "not exported." ) ) )
 
  126                .help( 
UTF8STDSTR( 
_( 
"Exclude 3D models for components" ) ) )
 
  130                .help( 
UTF8STDSTR( 
_( 
"Only include component 3D models matching this list of " 
  131                                      "reference designators (comma-separated, wildcards supported)" 
  133                .default_value( std::string() );
 
  136                .help( 
UTF8STDSTR( 
_( 
"Export tracks and vias" ) ) )
 
  148                .help( 
UTF8STDSTR( 
_( 
"Export elements on inner copper layers" ) ) )
 
  152                .help( 
UTF8STDSTR( 
_( 
"Export silkscreen graphics as a set of flat faces" ) ) )
 
  156                .help( 
UTF8STDSTR( 
_( 
"Export soldermask layers as a set of flat faces" ) ) )
 
  160                .help( 
UTF8STDSTR( 
_( 
"Fuse overlapping geometry together" ) ) )
 
  164                .help( 
UTF8STDSTR( 
_( 
"Don't cut via holes in conductor layers." ) ) )
 
  168                .default_value( std::string( 
"0.01mm" ) )
 
  169                .help( 
UTF8STDSTR( 
_( 
"Minimum distance between points to treat them as separate " 
  171                .metavar( 
"MIN_DIST" );
 
  174                .default_value( std::string() )
 
  175                .help( 
UTF8STDSTR( 
_( 
"Only include copper items belonging to nets matching this " 
  182                .help( 
UTF8STDSTR( 
_( 
"Do not optimize STEP file (enables writing parametric " 
  188            .default_value( std::string() )
 
  189            .help( 
UTF8STDSTR( 
_( 
"User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm " 
  190                                  "(default unit mm)" ) ) );
 
  195                .default_value( std::string( 
"in" ) )
 
  196                .help( 
UTF8STDSTR( 
_( 
"Output units; valid options: mm, m, in, tenths" ) ) );
 
  199                .default_value( std::string( 
"" ) )
 
  200                .help( 
UTF8STDSTR( 
_( 
"Name of folder to create and store 3d models in, if not " 
  201                                      "specified or empty, the models will be embedded in main " 
  202                                      "exported VRML file" ) ) );
 
  205                .help( 
UTF8STDSTR( 
_( 
"Used with --models-dir to output relative paths in the " 
  206                                      "resulting file" ) ) )
 
 
  258        if( format == wxS( 
"step" ) )
 
  260        else if( format == wxS( 
"stpz" ) )
 
  262        else if( format == wxS( 
"brep" ) )
 
  264        else if( format == wxS( 
"xao" ) )
 
  266        else if( format == wxS( 
"glb" ) )
 
  268        else if( format == wxS( 
"ply" ) )
 
  270        else if( format == wxS( 
"stl" ) )
 
  272        else if( format == wxS( 
"u3d" ) )
 
  274        else if( format == wxS( 
"pdf" ) )
 
  278            wxFprintf( stderr, 
_( 
"Invalid format specified\n" ) );
 
  287        if( units == wxS( 
"in" ) )
 
  289        else if( units == wxS( 
"mm" ) )
 
  291        else if( units == wxS( 
"m" ) )
 
  293        else if( units == wxS( 
"tenths" ) )
 
  297            wxFprintf( stderr, 
_( 
"Invalid units specified\n" ) );
 
  310    if( !userOrigin.IsEmpty() )
 
  313                                std::regex_constants::icase );
 
  315        std::string str( userOrigin.ToUTF8() );
 
  316        std::regex_search( str, sm, re_pattern );
 
  317        step->m_3dparams.m_Origin.x = atof( sm.str( 1 ).c_str() );
 
  318        step->m_3dparams.m_Origin.y = atof( sm.str( 2 ).c_str() );
 
  322        step->m_3dparams.m_Origin.x = 
pcbIUScale.mmToIU( step->m_3dparams.m_Origin.x );
 
  323        step->m_3dparams.m_Origin.y = 
pcbIUScale.mmToIU( step->m_3dparams.m_Origin.y );
 
  325        std::string tunit( sm[3] );
 
  327        if( tunit.size() > 0 ) 
 
  329            if( ( !sm.str( 1 ).compare( 
" " ) || !sm.str( 2 ).compare( 
" " ) )
 
  330                || ( sm.size() != 4 ) )
 
  337            if( !tunit.compare( 
"in" ) || !tunit.compare( 
"inch" ) )
 
  339                step->m_3dparams.m_Origin *= 25.4;
 
  341            else if( tunit.compare( 
"mm" ) )
 
  348        step->m_hasUserOrigin = 
true;
 
  354        wxString minDistance =
 
  357        if( !minDistance.IsEmpty() )
 
  361            std::string str( minDistance.ToUTF8() );
 
  362            std::regex_search( str, sm, re_pattern );
 
  363            step->m_3dparams.m_BoardOutlinesChainingEpsilon = atof( sm.str( 1 ).c_str() );
 
  365            std::string tunit( sm[2] );
 
  367            if( tunit.size() > 0 ) 
 
  369                if( !tunit.compare( 
"in" ) || !tunit.compare( 
"inch" ) )
 
  371                    step->m_3dparams.m_BoardOutlinesChainingEpsilon *= 25.4;
 
  373                else if( tunit.compare( 
"mm" ) )
 
 
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.
 
std::map< wxString, wxString > m_argDefineVars
Value of the drawing sheet arg if configured.
 
argparse::ArgumentParser m_argParser
 
COMMAND(const std::string &aName)
Define a new COMMAND instance.
 
void addDefineArg()
Set up the drawing sheet arg used by many of the export commands.
 
wxString m_argOutput
Value of the output arg if configured.
 
wxString m_argInput
Value of the common input arg if configured.
 
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, PROGRESS_REPORTER *aProgressReporter=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