diff --git a/eeschema/sch_eagle_plugin.cpp b/eeschema/sch_eagle_plugin.cpp index 414eccfff3..3fe2fbbcd5 100644 --- a/eeschema/sch_eagle_plugin.cpp +++ b/eeschema/sch_eagle_plugin.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -136,6 +137,34 @@ static void kicadLayer( int aEagleLayer ) } +static COMPONENT_ORIENTATION_T kicadComponentRotation( float eagleDegrees ) +{ + int roti = int(eagleDegrees); + + + switch( roti ) + { + default: + wxASSERT_MSG( false, wxString::Format( "Unhandled orientation (%d degrees)", roti ) ); + + // fall through + case 0: + return CMP_ORIENT_0; + + case 90: + return CMP_ORIENT_90; + + case 180: + return CMP_ORIENT_180; + + case 270: + return CMP_ORIENT_270; + } + + return CMP_ORIENT_0; +} + + SCH_EAGLE_PLUGIN::SCH_EAGLE_PLUGIN() { m_rootSheet = nullptr; @@ -639,6 +668,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode ) if( einstance.rot ) { + component->SetOrientation(kicadComponentRotation( einstance.rot->degrees)); if( einstance.rot->mirror ) { component->MirrorY( einstance.x * EUNIT_TO_MIL );