diff --git a/kicad/cli/command_export_pcb_step.cpp b/kicad/cli/command_export_pcb_step.cpp index 6fc6f37e0f..0cbbdca3f6 100644 --- a/kicad/cli/command_export_pcb_step.cpp +++ b/kicad/cli/command_export_pcb_step.cpp @@ -140,21 +140,17 @@ int CLI::EXPORT_PCB_STEP_COMMAND::Perform( KIWAY& aKiway ) wxString minDistance = FROM_UTF8( m_argParser.get( ARG_MIN_DISTANCE ).c_str() ); if( !minDistance.IsEmpty() ) { - std::istringstream istr; - istr.str( std::string( minDistance.ToUTF8() ) ); - istr >> step->m_minDistance; + std::regex re_pattern( REGEX_QUANTITY REGEX_UNIT, + std::regex_constants::icase ); + std::smatch sm; + std::string str( minDistance.ToUTF8() ); + std::regex_search( str, sm, re_pattern ); + step->m_minDistance = atof( sm.str( 1 ).c_str() ); - if( istr.fail() ) + std::string tunit( sm[2] ); + + if( tunit.size() > 0 ) // No unit accepted ( default = mm ) { - std::cout << m_argParser; - return CLI::EXIT_CODES::ERR_ARGS; - } - - if( !istr.eof() ) - { - std::string tunit; - istr >> tunit; - if( !tunit.compare( "in" ) || !tunit.compare( "inch" ) ) { step->m_minDistance *= 25.4; diff --git a/pcbnew/dialogs/dialog_export_step.cpp b/pcbnew/dialogs/dialog_export_step.cpp index 73d1b25614..7fa11dcc12 100644 --- a/pcbnew/dialogs/dialog_export_step.cpp +++ b/pcbnew/dialogs/dialog_export_step.cpp @@ -377,7 +377,6 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent ) } #endif - appK2S.SetName( wxT( "kicad-cli" ) ); wxString cmdK2S = wxT( "\"" ); @@ -396,7 +395,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent ) // Note: for some reason, using \" to insert a quote in a format string, under MacOS // wxString::Format does not work. So use a %c format in string - int quote = '"'; + int quote = '\''; switch( GetOriginOption() ) {