Commit 87d2caa4 authored by Cirilo Bbernardo's avatar Cirilo Bbernardo Committed by jean-pierre charras

IDF export: fix incorrect rotation of flipped items.

parent 544f987f
......@@ -334,7 +334,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule,
refdes = aIDFBoard.GetRefDes();
}
double rotz = modfile->m_MatRotation.z + aModule->GetOrientation()/10.0;
double rotz = aModule->GetOrientation()/10.0;
double locx = modfile->m_MatPosition.x;
double locy = modfile->m_MatPosition.y;
double locz = modfile->m_MatPosition.z;
......@@ -343,6 +343,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule,
if( top )
{
rotz += modfile->m_MatRotation.z;
locy = -locy;
RotatePoint( &locx, &locy, aModule->GetOrientation() );
locy = -locy;
......@@ -352,6 +353,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule,
RotatePoint( &locx, &locy, aModule->GetOrientation() );
locy = -locy;
rotz -= modfile->m_MatRotation.z;
rotz = 180.0 - rotz;
if( rotz >= 360.0 )
......
......@@ -1055,13 +1055,35 @@ bool IDF_COMP::substituteComponent( FILE* aLibFile )
if( parent->RegisterOutline( "NOGEOM_NOPART" ) )
return true;
// Create a star shape 5mm high with points on 5 and 2.5 mm circles
fprintf( aLibFile, ".ELECTRICAL\n" );
fprintf( aLibFile, "\"NOGEOM\" \"NOPART\" MM 5\n" );
// TODO: for now we shall use a simple cylinder; a more intricate
// and readily recognized feature (a stylistic X) would be of
// much greater value.
fprintf( aLibFile, "0 0 0 0\n" );
fprintf( aLibFile, "0 2.5 0 360\n" );
double a, da, x, y;
da = M_PI / 5.0;
a = da / 2.0;
for( int i = 0; i < 10; ++i )
{
if( i & 1 )
{
x = 2.5 * cos( a );
y = 2.5 * sin( a );
}
else
{
x = 1.5 * cos( a );
y = 1.5 * sin( a );
}
a += da;
fprintf( aLibFile, "0 %.3f %.3f 0\n", x, y );
}
a = da / 2.0;
x = 1.5 * cos( a );
y = 1.5 * sin( a );
fprintf( aLibFile, "0 %.3f %.3f 0\n", x, y );
fprintf( aLibFile, ".END_ELECTRICAL\n\n" );
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment