From dfad6b79e6a8cfb7caac1edb11e32d7a368cb590 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 2 May 2014 08:28:40 +0200 Subject: [PATCH] Fix issue in bga footprint wizard. --- pcbnew/scripting/plugins/PadArray.py | 9 +++++---- pcbnew/scripting/plugins/bga_wizard.py | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pcbnew/scripting/plugins/PadArray.py b/pcbnew/scripting/plugins/PadArray.py index 99fa70e0dc..3c5d5f7cb1 100644 --- a/pcbnew/scripting/plugins/PadArray.py +++ b/pcbnew/scripting/plugins/PadArray.py @@ -75,13 +75,14 @@ class PadGridArray(PadArray): # handy utility function 1 - A, 2 - B, 26 - AA, etc # aIndex = 0 for 0 - A - def AlphaNameFromNumber(self, n, aIndex = 1): + # alphabet = set of allowable chars if not A-Z, eg ABCDEFGHJKLMNPRTUVWY for BGA + def AlphaNameFromNumber(self, n, aIndex = 1, alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"): - div, mod = divmod(n - aIndex, 26) - alpha = chr(65 + mod) + div, mod = divmod(n - aIndex, len(alphabet)) + alpha = alphabet[mod] if div > 0: - return self.AlphaNameFromNumber(div) + alpha; + return self.AlphaNameFromNumber(div, aIndex, alphabet) + alpha; return alpha; diff --git a/pcbnew/scripting/plugins/bga_wizard.py b/pcbnew/scripting/plugins/bga_wizard.py index 7fd6258f3e..9b68b48ef6 100644 --- a/pcbnew/scripting/plugins/bga_wizard.py +++ b/pcbnew/scripting/plugins/bga_wizard.py @@ -24,7 +24,7 @@ import PadArray as PA class BGAPadGridArray(PA.PadGridArray): def NamingFunction(self, x, y): - return "%s%d" % (self.AlphaNameFromNumber(y + 1), x + 1) + return "%s%d" % (self.AlphaNameFromNumber(y + 1, alphabet="ABCDEFGHJKLMNPRTUVWY"), x + 1) class BGAWizard(HFPW.HelpfulFootprintWizardPlugin): @@ -76,10 +76,10 @@ class BGAWizard(HFPW.HelpfulFootprintWizardPlugin): # add in the pads pad = PA.PadMaker(self.module).SMTRoundPad(pads["pad size"]) - pin1Pos = pcbnew.wxPoint(-((rows - 1) * pad_pitch) / 2, - -((cols - 1) * pad_pitch) / 2) + pin1Pos = pcbnew.wxPoint(-((cols - 1) * pad_pitch) / 2, + -((rows - 1) * pad_pitch) / 2) - array = BGAPadGridArray(pad, rows, cols, pad_pitch, pad_pitch, pin1Pos) + array = BGAPadGridArray(pad, cols, rows, pad_pitch, pad_pitch, pin1Pos) array.AddPadsToModule() #box