Fix issue in bga footprint wizard.

This commit is contained in:
unknown 2014-05-02 08:28:40 +02:00 committed by jean-pierre charras
parent fca1ba6755
commit 0ff0b9b835
2 changed files with 9 additions and 8 deletions

View File

@ -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;

View File

@ -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