From e1586484f5e405b7a6752a45d964221536a5acda Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Tue, 26 Apr 2022 12:14:24 -0300 Subject: [PATCH] Fixed KiCad 5 doesn't have LSET.Contains() --- kibot/gs.py | 6 ++++++ kibot/out_pcb_print.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/kibot/gs.py b/kibot/gs.py index dc1b822e..7b1564cc 100644 --- a/kibot/gs.py +++ b/kibot/gs.py @@ -273,6 +273,12 @@ class GS(object): def zones(): return pcbnew.ZONES() if GS.ki6() else pcbnew.ZONE_CONTAINERS() + @staticmethod + def layers_contains(layers, id): + if GS.ki6(): + return layers.Contains(id) + return id in layers.Seq() + @staticmethod def expand_text_variables(text, extra_vars=None): vars = GS.load_pro_variables() diff --git a/kibot/out_pcb_print.py b/kibot/out_pcb_print.py index 6ad9d60d..bd359169 100644 --- a/kibot/out_pcb_print.py +++ b/kibot/out_pcb_print.py @@ -532,7 +532,7 @@ class PCB_PrintOptions(VariantOptions): if dr.x: continue layers = pad.GetLayerSet() - if layers.Contains(id): + if GS.layers_contains(layers, id): layers.removeLayer(id) pad.SetLayerSet(layers) removed.append(pad) @@ -592,7 +592,7 @@ class PCB_PrintOptions(VariantOptions): moved.append(gi) for pad in m.Pads(): layers = pad.GetLayerSet() - if layers.Contains(id): + if GS.layers_contains(layers, id): layers.removeLayer(id) pad.SetLayerSet(layers) removed.append(pad)