update to python3
[hw/altusmetrum] / packages / molex / ufl.py
1 #!/usr/bin/python3
2 # Copyright 2009,2024 by Bdale Garbee <bdale@gag.com>.  GPLv2
3 #
4 # Program to emit PCB footprint for Molex version of U.FL micro coax connector
5 #
6
7 # dimensions in mm from 734120110_sd.pdf datasheet
8 PinWidth =   1.00
9 PinHeight =  1.05
10 PinOffset =  1.00
11 GndHeight =  2.20
12 GndInside =  1.90
13 GndOutside = 4.00
14 GndWidth = (GndOutside - GndInside) / 2
15
16 import sys
17
18 # we're going to use the 1/100 of a mil fundamental unit form
19 def mm2mils100( mm ):
20         return int( mm / 25.4 * 1000.0 * 100.0 + 0.5 )
21
22 print('# author: Bdale Garbee')
23 print('# email: bdale@gag.com')
24 print('# dist-license: GPL 2')
25 print('# use-license: unlimited')
26
27 print('Element[0x0 "UFL" "" "" 0 0 0 0 0 100 0x0]')
28 print("(")
29
30 print('   Pad[',\
31         mm2mils100(-(GndOutside - GndInside)/4 - (GndInside / 2) ), \
32         mm2mils100(-(GndHeight / 2) + (GndWidth / 2)), \
33         mm2mils100(-(GndOutside - GndInside)/4 - (GndInside / 2) ), \
34         mm2mils100((GndHeight / 2) - (GndWidth / 2)), \
35         mm2mils100(GndWidth), \
36         mm2mils100(0.1), \
37         mm2mils100(GndWidth+0.2), \
38         '"pin2"', '"2"', '0x0100]')
39
40 print('   Pad[',\
41         0, \
42         mm2mils100(PinOffset + PinWidth/2), \
43         0, \
44         mm2mils100(PinOffset + PinHeight - PinWidth/2), \
45         mm2mils100(PinWidth), \
46         mm2mils100(0.1), \
47         mm2mils100(PinWidth+0.2), \
48         '"pin1"', '"1"', '0x0100]')
49
50 print('   Pad[',\
51         mm2mils100((GndOutside - GndInside)/4 + (GndInside / 2) ), \
52         mm2mils100(-(GndHeight / 2) + (GndWidth / 2)), \
53         mm2mils100((GndOutside - GndInside)/4 + (GndInside / 2) ), \
54         mm2mils100((GndHeight / 2) - (GndWidth / 2)), \
55         mm2mils100(GndWidth), \
56         mm2mils100(0.1), \
57         mm2mils100(GndWidth+0.2), \
58         '"pin2"', '"2"', '0x0100]')
59
60
61 print(")")