← Back to team overview

kicad-developers team mailing list archive

[PATCH] Add support for hatched zones in eagle import

 

Hi,

I made a small patch to import hatched zones from eagle.

In this patch I removed the call to ```SetHatch``` which didn't seem to
do anything, and only was used when p.spacing was defined. Can someone
tell me if this was OK? Did not noticed any changes in behavior.

Regards, Thomas
From 5df6e279c635a888a1087a11f0d24d94f3333b64 Mon Sep 17 00:00:00 2001
From: Thomas Pointhuber <thomas.pointhuber@xxxxxx>
Date: Fri, 12 Jul 2019 20:11:21 +0200
Subject: [PATCH] Add support for hatched zones in eagle import

---
 pcbnew/eagle_plugin.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp
index 55b596a51..871b90a6a 100644
--- a/pcbnew/eagle_plugin.cpp
+++ b/pcbnew/eagle_plugin.cpp
@@ -1199,12 +1199,15 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
         zone->SetDoNotAllowCopperPour( true );
         zone->SetHatchStyle( ZONE_CONTAINER::NO_HATCH );
     }
+    else if( p.pour == EPOLYGON::HATCH )
+    {
+        int spacing = p.spacing ? p.spacing->ToPcbUnits() : 50 * IU_PER_MILS;
 
-    // if spacing is set the zone should be hatched
-    // However, use the default hatch step, p.spacing value has no meaning for KiCad
-    // TODO: see if this parameter is related to a grid fill option.
-    if( p.spacing )
-        zone->SetHatch( ZONE_CONTAINER::DIAGONAL_EDGE, zone->GetDefaultHatchPitch(), true );
+        zone->SetFillMode( ZFM_HATCH_PATTERN );
+        zone->SetHatchFillTypeThickness( p.width.ToPcbUnits() );
+        zone->SetHatchFillTypeGap( spacing - p.width.ToPcbUnits() );
+        zone->SetHatchFillTypeOrientation( 0 );
+    }
 
     // We divide the thickness by half because we are tracing _inside_ the zone outline
     // This means the radius of curvature will be twice the size for an equivalent EAGLE zone
-- 
2.22.0

Attachment: signature.asc
Description: OpenPGP digital signature