convert Python footprint generators to Python 3
[hw/altusmetrum] / packages / fuse345.py
1 #!/usr/bin/python3
2 # Copyright 2015 by Bdale Garbee <bdale@gag.com>.  GPLv2
3 #
4 # Program to emit PCB footprint for littlefuse 345 fuse holder
5 #
6
7 # dimensions in mils from footprint drawing at DigiKey
8 BodyWidth = 1570                # body outline (width not counting projection)
9 BodyHeight = 490
10 PinSpace1 = 700
11 PinSpace2 = 600
12
13 import sys
14
15 # we're going to use the 1/100 of a mil fundamental unit form
16 def mm2mils100( mm ):
17         return int( mm / 25.4 * 1000.0 * 100.0 + 0.5 )
18
19 print('# author: Bdale Garbee')
20 print('# email: bdale@gag.com')
21 print('# dist-license: GPL 3')
22 print('# use-license: unlimited')
23
24 print('Element[0x0 "littlefuse345" "" "" 0 0 0 0 0 100 0x0]')
25 print("(")
26 print('   Pin(',\
27         0, \
28         0, \
29         125, \
30         30, \
31         150, \
32         56, \
33         '"pin1" "1" 0x0001)')
34
35 print('   Pin(',\
36         PinSpace1, \
37         0, \
38         125, \
39         30, \
40         150, \
41         56, \
42         '"pin2" "2" 0x0001)')
43
44 print('   Pin(',\
45         PinSpace1 + PinSpace2, \
46         0, \
47         125, \
48         30, \
49         150, \
50         56, \
51         '"pin3" "3" 0x0001)')
52
53
54 print('   ElementLine(',\
55         0, \
56         -(BodyHeight/2), \
57         0, \
58         (BodyHeight/2), \
59         5, \
60         ')')
61
62 print('   ElementLine(',\
63         0, \
64         -(BodyHeight/2), \
65         BodyWidth, \
66         -(BodyHeight/2), \
67         5, \
68         ')')
69
70 print('   ElementLine(',\
71         0, \
72         (BodyHeight/2), \
73         BodyWidth, \
74         (BodyHeight/2), \
75         5, \
76         ')')
77
78 print(")")