← Back to team overview

kicad-developers team mailing list archive

Fix Eagle free text rotation import bug, when using angle's other than 90, 180, 270

 

This patch fix's  the  bug in, Pcbnew, when importing Eagle PCB text.
When the imported text is not at 90,180 or 270 dregs

Patch attached.

Lachlan
diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp
index 04d8849..8e0b04a 100644
--- a/pcbnew/eagle_plugin.cpp
+++ b/pcbnew/eagle_plugin.cpp
@@ -1510,6 +1510,26 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics )
                         pcbtxt->SetTextAngle( sign * 90 * 10 );
                         align = ETEXT::TOP_RIGHT;
                     }
+                    else // Ok so text is not at 90,180 or 270 so do some funny stuf to get placement right
+                    {
+                        if( ( degrees > 0 ) &&  ( degrees < 90 ))
+                            pcbtxt->SetTextAngle( sign * t.rot->degrees * 10 );
+                        else if( ( degrees > 90 ) && ( degrees < 180 ) )
+                        {
+                            pcbtxt->SetTextAngle( sign * ( t.rot->degrees + 180 ) * 10 );
+                            align = ETEXT::TOP_RIGHT;
+                        }
+                        else if( ( degrees > 180 ) && ( degrees < 270 ) )
+                        {
+                            pcbtxt->SetTextAngle( sign * ( t.rot->degrees - 180 ) * 10 );
+                            align = ETEXT::TOP_RIGHT;
+                        }
+                        else if( ( degrees > 270 ) && ( degrees < 360 ) )
+                        {
+                            pcbtxt->SetTextAngle( sign * t.rot->degrees * 10 );
+                            align = ETEXT::BOTTOM_LEFT;
+                        }
+                    }
                 }
 
                 switch( align )

Follow ups