Eeschema Eagle Plugin: Set Component Orientation

This commit is contained in:
Russell Oliver 2017-07-06 21:55:41 +10:00 committed by Maciej Suminski
parent 2523c6b5d7
commit 3741793f77
1 changed files with 30 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include <sch_junction.h>
#include <sch_sheet.h>
#include <schframe.h>
#include <template_fieldnames.h>
#include <wildcards_and_files_ext.h>
#include <class_sch_screen.h>
@ -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 );