← Back to team overview

kicad-developers team mailing list archive

[PATCH] Fix handling of filled circle in eagle importer (was only partly fixed)

 

Hi,

I noticed that my fix for circles in the eagle import was only partial.
Namely there is something like a "plain section", where I missed to
handle the case of width=0. Now we fill those circles as well :).

Regard, Thomas
From 5cc1d5680dc70dd1aac7dc2c459ea79977e224c8 Mon Sep 17 00:00:00 2001
From: Thomas Pointhuber <thomas.pointhuber@xxxxxx>
Date: Fri, 12 Jul 2019 21:18:42 +0200
Subject: [PATCH] Fix handling of filled circle in eagle importer (was only
 partly fixed)

Partly fixed in 4fc692f04b447f77c75f4538982f6b739d08c4e8, but missed
that there is a loadPlain where I need to handle this case as well.
---
 pcbnew/eagle_plugin.cpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp
index 55b596a51..c70faf9ce 100644
--- a/pcbnew/eagle_plugin.cpp
+++ b/pcbnew/eagle_plugin.cpp
@@ -645,12 +645,22 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
                 DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
                 m_board->Add( dseg, ADD_APPEND );
 
+                int width = c.width.ToPcbUnits();
+                int radius = c.radius.ToPcbUnits();
+
+                // with == 0 means filled circle
+                if( width <= 0 )
+                {
+                    width = radius;
+                    radius = radius / 2;
+                }
+
                 dseg->SetShape( S_CIRCLE );
                 dseg->SetTimeStamp( EagleTimeStamp( gr ) );
                 dseg->SetLayer( layer );
                 dseg->SetStart( wxPoint( kicad_x( c.x ), kicad_y( c.y ) ) );
-                dseg->SetEnd( wxPoint( kicad_x( c.x + c.radius ), kicad_y( c.y ) ) );
-                dseg->SetWidth( c.width.ToPcbUnits() );
+                dseg->SetEnd( wxPoint( kicad_x( c.x ) + radius, kicad_y( c.y ) ) );
+                dseg->SetWidth( width );
             }
             m_xpath->pop();
         }
-- 
2.22.0

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups