← Back to team overview

kicad-developers team mailing list archive

[PATCH] Fix Board.GetAllNetClasses() so it no longer creates a duplicate of the Default netclass in the design rules net classes list.

 

Fixes: lp:1803623
* https://bugs.launchpad.net/kicad/+bug/1803623
---
 pcbnew/swig/board.i | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/pcbnew/swig/board.i b/pcbnew/swig/board.i
index 91c41cc90..3bdc1e610 100644
--- a/pcbnew/swig/board.i
+++ b/pcbnew/swig/board.i
@@ -173,11 +173,10 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints)
         GetNetClasses(BOARD self) -> { wxString net_class_name : NETCLASSPTR }
         Include the "Default" netclass also.
         """
-        netclassmap = self.GetNetClasses().NetClasses()
 
-        # Add the Default one too, but this is probably modifying the NETCLASS_MAP
-        # in the BOARD.  If that causes trouble, could make a deepcopy() here first.
-        # netclassmap = deepcopy(netclassmap)
+        # Copy the NETCLASS_MAP so the one in the BOARD isn't modified
+        # when we add the Default net class.
+        netclassmap = {k:v for k,v in self.GetNetClasses().NetClasses().items()}
         netclassmap['Default'] = self.GetNetClasses().GetDefault()
         return netclassmap
     %}

Follow ups