diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index f42dcfff36..1314864d56 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -1142,7 +1142,9 @@ 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" */ + m_out->Print( aNestLevel+2, "(offset (xyz %s %s %s))\n", Double2Str( bs3D->m_Offset.x ).c_str(), Double2Str( bs3D->m_Offset.y ).c_str(), diff --git a/utils/kicad2step/pcb/kicadmodel.cpp b/utils/kicad2step/pcb/kicadmodel.cpp index 6f680e03f0..61395bae5c 100644 --- a/utils/kicad2step/pcb/kicadmodel.cpp +++ b/utils/kicad2step/pcb/kicadmodel.cpp @@ -80,12 +80,37 @@ bool KICADMODEL::Read( SEXPR::SEXPR* aEntry ) std::string name = child->GetChild( 0 )->GetSymbol(); bool ret = true; + /* + * Version 4.x and prior used 'at' parameter, + * which was specified in inches. + */ if( name == "at" ) + { ret = Get3DCoordinate( child->GetChild( 1 ), m_offset ); + + if( ret ) + { + m_offset.x *= 25.4f; + m_offset.y *= 25.4f; + m_offset.z *= 25.4f; + } + } + /* + * From 5.x onwards, 3D model is provided in 'offset', + * which is in millimetres + */ + else if( name == "offset" ) + { + ret = Get3DCoordinate( child->GetChild( 1 ), m_offset ); + } else if( name == "scale" ) + { ret = Get3DCoordinate( child->GetChild( 1 ), m_scale ); + } else if( name == "rotate" ) + { ret = GetXYZRotation( child->GetChild( 1 ), m_rotation ); + } if( !ret ) return false;