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

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

View File

@ -116,9 +116,14 @@ int CLI::EXPORT_PCB_STEP_COMMAND::doPerform( KIWAY& aKiway )
step->m_xOrigin = atof( sm.str( 1 ).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] );
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( " " ) )
|| ( sm.size() != 4 ) )