kicad-cli, STEP export: fix incorrect unit when user origin is specifed.

They are specified in mm (inches) , but must be stored in board units in code.
This commit is contained in:
jean-pierre charras 2023-06-09 12:42:26 +02:00
parent 639da0eb5a
commit 9c1fac3e21
1 changed files with 6 additions and 1 deletions

View File

@ -130,9 +130,14 @@ int CLI::EXPORT_PCB_STEP_COMMAND::doPerform( KIWAY& aKiway )
step->m_xOrigin = atof( sm.str( 1 ).c_str() ); step->m_xOrigin = atof( sm.str( 1 ).c_str() );
step->m_yOrigin = atof( sm.str( 2 ).c_str() ); step->m_yOrigin = atof( sm.str( 2 ).c_str() );
// Default unit for m_xOrigin and m_yOrigin is mm.
// Convert in to board units. If the value is given in inches, it will be converted later
step->m_xOrigin = pcbIUScale.mmToIU( step->m_xOrigin );
step->m_yOrigin = pcbIUScale.mmToIU( step->m_yOrigin );
std::string tunit( sm[3] ); std::string tunit( sm[3] );
if( tunit.size() > 0 ) // No unit accepted ( default = mm ) if( tunit.size() > 0 ) // unit specified ( default = mm, but can be in, inch or mm )
{ {
if( ( !sm.str( 1 ).compare( " " ) || !sm.str( 2 ).compare( " " ) ) if( ( !sm.str( 1 ).compare( " " ) || !sm.str( 2 ).compare( " " ) )
|| ( sm.size() != 4 ) ) || ( sm.size() != 4 ) )