From b588c1902a86c83a6cd82aeb217b74ca758f2ba7 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 27 Nov 2017 21:46:53 +1100 Subject: [PATCH] Write "offset" only if non-zero - Use "at" if all offset dimensions are zero - Use "offset" otherwise --- pcbnew/kicad_plugin.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 1314864d56..518e1c6dcc 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -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() );