Write "offset" only if non-zero

- Use "at" if all offset dimensions are zero
- Use "offset" otherwise
This commit is contained in:
Oliver 2017-11-27 21:46:53 +11:00 committed by jean-pierre charras
parent 76f5df8a43
commit b588c1902a
1 changed files with 14 additions and 1 deletions

View File

@ -1143,9 +1143,22 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
/* Write 3D model offset in mm
* 4.0.x wrote "at" which was actually in inches
* 5.0.x onwards, 3D model offset is written using "offset"
*
* If the offset is all zero, write "at" (fewer file changes)
* Otherwise, write "offset"
*/
m_out->Print( aNestLevel+2, "(offset (xyz %s %s %s))\n",
wxString offsetTag = "offset";
if( bs3D->m_Offset.x == 0 &&
bs3D->m_Offset.y == 0 &&
bs3D->m_Offset.z == 0 )
{
offsetTag = "at";
}
m_out->Print( aNestLevel+2, "(%s (xyz %s %s %s))\n",
offsetTag.ToStdString().c_str(),
Double2Str( bs3D->m_Offset.x ).c_str(),
Double2Str( bs3D->m_Offset.y ).c_str(),
Double2Str( bs3D->m_Offset.z ).c_str() );