← Back to team overview

kicad-developers team mailing list archive

[PATCH] Refill zones after editing properties

 

Hi,

After editing zone properties in any canvas, the zone is not refilled,
leading to stale display of the zone if a geometric property like the
anti-pad clearance is changed.

https://bugs.launchpad.net/kicad/+bug/1674595

This patch refills the zone and recalculates the netlist of that zone's net.

Cheers,

John
From 4e0742bb2ed2c312970cec88b438e79a6f88e994 Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Wed, 22 Mar 2017 00:21:41 +0800
Subject: [PATCH] Refill zones after editing properties

After editing properties (in Legacy or GAL) using the dialog, zones are
not refilled.

Fixes: lp:1674595
* https://bugs.launchpad.net/kicad/+bug/1674595
---
 pcbnew/zones_by_polygon.cpp | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp
index 4f8332c8a..531973aa9 100644
--- a/pcbnew/zones_by_polygon.cpp
+++ b/pcbnew/zones_by_polygon.cpp
@@ -45,6 +45,7 @@
 #include <protos.h>
 #include <zones_functions_for_undo_redo.h>
 #include <drc_stuff.h>
+#include <ratsnest_data.h>
 
 // Outline creation:
 static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC );
@@ -934,8 +935,26 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone )
     // Redraw the real new zone outlines
     GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, UNDEFINED_LAYER );
 
-
     UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() );
+
+    // refill zones with the new properties applied
+    for( unsigned i = 0; i < s_PickedList.GetCount(); ++i )
+    {
+        auto zone = dyn_cast<ZONE_CONTAINER*>( s_PickedList.GetPickedItem( i ) );
+
+        if( zone == nullptr )
+        {
+            wxASSERT_MSG( false, "Expected a zone after zone properties edit" );
+            continue;
+        }
+
+        if( zone->IsFilled() )
+        {
+            Fill_Zone( zone );
+            GetBoard()->GetRatsnest()->Recalculate( zone->GetNetCode() );
+        }
+    }
+
     commit.Stage( s_PickedList );
     commit.Push( _( "Modify zone properties" ) );
 
-- 
2.12.0


Follow ups