-#!/usr/bin/python2
-# Copyright 2008 by Bdale Garbee <bdale@gag.com>. GPLv2
+#!/usr/bin/python3
+# Copyright 2008,2024 by Bdale Garbee <bdale@gag.com>. GPLv2
#
# Program to emit PCB footprint for
# Molex 1.25mm PicoBlade, vertical through-hole header 53047-XX10, 2-15 pins
sys.stderr.write('Must be no more than 26 pins\n')
sys.exit(1)
-print '# author: Bdale Garbee'
-print '# email: bdale@gag.com'
-print '# dist-license: GPL 2'
-print '# use-license: unlimited'
+print('# author: Bdale Garbee')
+print('# email: bdale@gag.com')
+print('# dist-license: GPL 2')
+print('# use-license: unlimited')
-print 'Element[0x0 "PicoFlex%i"' % pins,'"" "" 0 0 0 0 0 100 0x0]'
-print "("
-for col in range ((pins+1)/2):
+print('Element[0x0 "PicoFlex%i"' % pins,'"" "" 0 0 0 0 0 100 0x0]')
+print("(")
+for col in range (int((pins+1)/2)):
for row in range (2):
- if row == 1:
- offset=RowOffset
- spacing=RowSpacing
- else:
- offset=0
- spacing=0
+ if row == 1:
+ offset=RowOffset
+ spacing=RowSpacing
+ else:
+ offset=0
+ spacing=0
pinnum = (col * 2) + row + 1
if pinnum == 1:
- Flags = '0x0101'
+ Flags = '0x0101'
else:
- Flags = '0x0001'
- print ' Pin[', \
+ Flags = '0x0001'
+ print(' Pin[', \
mm2mils100(col*PinSpacing + offset), \
mm2mils100(spacing), \
mm2mils100(PinDiam*2), \
600, \
mm2mils100(PinDiam*2)+1000, \
mm2mils100(PinDiam), \
- '"pin%i"' % pinnum, '"%i"' % pinnum, Flags, ']'
+ '"pin%i"' % pinnum, '"%i"' % pinnum, Flags, ']')
-print ' Pin[', \
+print(' Pin[', \
mm2mils100(-MntX), \
mm2mils100(-MntY), \
mm2mils100(MntDiam), \
0, \
mm2mils100(MntDiam), \
mm2mils100(MntDiam), \
- '"mnt" "0"', '0x0008', ']'
+ '"mnt" "0"', '0x0008', ']')
-print ' Pin[', \
+print(' Pin[', \
mm2mils100(((pins+1)/2-1)*PinSpacing+RowOffset+MntX), \
mm2mils100(-MntY), \
mm2mils100(MntDiam), \
0, \
mm2mils100(MntDiam), \
mm2mils100(MntDiam), \
- '"mnt" "0"', '0x0008', ']'
+ '"mnt" "0"', '0x0008', ']')
BoxWidth = BoxEnd + ((pins/2-1) * PinSpacing + RowOffset);
BoxYOff = MntY + MntDiam/2 + .1524
-print ' ElementLine[', \
+print(' ElementLine[', \
mm2mils100(-BoxEnd), \
mm2mils100(-BoxYOff), \
mm2mils100(-BoxEnd), \
mm2mils100(BoxHeight-BoxYOff), \
- LineWidth, ']'
+ LineWidth, ']')
-print ' ElementLine[', \
+print(' ElementLine[', \
mm2mils100(-BoxEnd), \
mm2mils100(BoxHeight-BoxYOff), \
mm2mils100(BoxWidth), \
mm2mils100(BoxHeight-BoxYOff), \
- LineWidth, ']'
+ LineWidth, ']')
-print ' ElementLine[', \
+print(' ElementLine[', \
mm2mils100(BoxWidth), \
mm2mils100(BoxHeight-BoxYOff), \
mm2mils100(BoxWidth), \
mm2mils100(-BoxYOff), \
- LineWidth, ']'
+ LineWidth, ']')
-print ' ElementLine[', \
+print(' ElementLine[', \
mm2mils100(BoxWidth), \
mm2mils100(-BoxYOff), \
mm2mils100(-BoxEnd), \
mm2mils100(-BoxYOff), \
- LineWidth, ']'
+ LineWidth, ']')
-print ")"
+print(")")