add led tower holes and position rocker switches on telefireeight top
[hw/altusmetrum] / mechanical / telebt-box.py
1 #! /usr/bin/python
2 # Copyright 2013 by Bdale Garbee <bdale@gag.com>.  GPLv3
3
4 # cut the required holes in a Hammond 1551K box to mount TeleBT
5
6 # we assume the box is standing on edge, with the bottom of the box to the
7 # "rear" (away from the front of the mill) against a reference plane, and
8 # the left edge of the box also up against a reference block.
9
10 # the Z reference plane is top surface of the box, X is the left edge of box
11
12 import math
13
14 Zfree = 0.1000          # height in Z to clear all obstructions
15 Speed = 10              # cutting speed
16 Zdepth = 0.125          # how deep we need to cut to go cleanly through the 
17                         # box wall, where the wall is 0.079 thick
18
19 CutterSize = 0.0625     # 1/16" end mill
20 RunOut = 0.0000         # how much larger slots are than desired 
21 CutterOD = CutterSize + RunOut
22
23 BoxWidth = 3.150        # measured one at 3.145, Hammond says 3.150, matters
24                         # because most dimensions are relative to center line!
25
26 X_Switch = -1.060       # switch distance from center line
27 Y_Switch = 0.185        # switch centerline above PCB top surface
28 D_Switch = 0.270        # diameter of switch hole (250 mils plus clearance)
29
30 X_USB = 0.935           # USB distance from center line
31 Y_USB = -0.049          # USB centerline below PCB bottom surface
32
33 #X_USB_slot = 0.325     # width of the USB slot
34 #Y_USB_slot = 0.125     # height of the USB slot
35 X_USB_slot = 0.350      # width of the USB slot  (account for plastic melting
36 Y_USB_slot = 0.150      # height of the USB slot  around end mill)
37
38 Y_SMA = -0.025          # SMA centerline below PCB bottom surface
39 D_SMA = 0.281           # diameter of SMA hole (doc says 0.256)
40
41 Y_Box_Bottom = 0.079    # thickness of box bottom wall
42 Y_Standoff = 0.157      # height of standoff nubs in box
43 Y_PCB = 0.063           # PCB thickness
44
45 def plunge():
46         print "(plunge)"
47         print "G01 Z",-Zdepth," F",Speed
48
49 def retract():
50         print "(retract)"
51         print "G00 Z",Zfree
52
53 def park():
54         retract()
55         print "(park)"
56         print "G00 X0 Y5 Z0.25"
57
58 print "%"
59
60 print "G17 G20 G90"
61 print "M3 S5000"
62
63 retract()
64
65 # cut power switch hole
66
67 print
68 print "(power switch hole)"
69
70 X_Pos = (BoxWidth / 2) + X_Switch
71 Y_Pos = -(Y_Box_Bottom + Y_Standoff + Y_PCB + Y_Switch)
72 CutLineRadius = (D_Switch / 2) - (CutterOD / 2)
73
74 print "G00 X",(X_Pos + CutLineRadius),"Y",Y_Pos
75 print "G01 Z",-Zdepth," F",Speed
76 print "G02 X%6.4f" % (X_Pos - CutLineRadius),"Y%6.4f" % Y_Pos,"I%6.4f" % -CutLineRadius,"J0 F",Speed
77 print "G02 X%6.4f" % (X_Pos + CutLineRadius),"Y%6.4f" % Y_Pos,"I%6.4f" % CutLineRadius,"J0 F",Speed
78 retract()
79
80 print
81 print "(SMA hole)"
82
83 X_Pos = (BoxWidth / 2)
84 Y_Pos = -(Y_Box_Bottom + Y_Standoff + Y_SMA)
85 CutLineRadius = (D_SMA / 2) - (CutterOD / 2)
86
87 print "G00 X",(X_Pos + CutLineRadius),"Y",Y_Pos
88 print "G01 Z",-Zdepth," F",Speed
89 print "G02 X%6.4f" % (X_Pos - CutLineRadius),"Y%6.4f" % Y_Pos,"I%6.4f" % -CutLineRadius,"J0 F",Speed
90 print "G02 X%6.4f" % (X_Pos + CutLineRadius),"Y%6.4f" % Y_Pos,"I%6.4f" % CutLineRadius,"J0 F",Speed
91 retract()
92
93 print
94 print "(USB slot)"
95
96 print "(first end)"
97 X_Pos = (BoxWidth / 2) + X_USB + ((X_USB_slot - Y_USB_slot)/2)
98 Y_Pos = -(Y_Box_Bottom + Y_Standoff + Y_USB)
99 CutLineRadius = (Y_USB_slot / 2) - (CutterOD / 2)
100
101 print "G00 X",X_Pos,"Y",(Y_Pos - CutLineRadius)
102 print "G01 Z",-Zdepth," F",Speed
103 print "G03 X%6.4f" % X_Pos, "Y%6.4f" % (Y_Pos + CutLineRadius),"I0 J%6.4f" % CutLineRadius," F",Speed
104
105 print "(top and second end)"
106 X_Pos = (BoxWidth / 2) + X_USB - ((X_USB_slot - Y_USB_slot)/2)
107 print "G01 X",X_Pos," F",Speed
108 print "G03 X%6.4f" % X_Pos, "Y%6.4f" % (Y_Pos - CutLineRadius),"I0 J%6.4f" % -CutLineRadius," F",Speed
109
110 print "(bottom)"
111 X_Pos = (BoxWidth / 2) + X_USB + ((X_USB_slot - Y_USB_slot)/2)
112 print "G01 X",X_Pos," F",Speed
113
114 retract()
115
116 print "(second pass - first end)"
117 X_Pos = (BoxWidth / 2) + X_USB + ((X_USB_slot - Y_USB_slot)/2)
118 Y_Pos = -(Y_Box_Bottom + Y_Standoff + Y_USB)
119 CutLineRadius = (Y_USB_slot / 2) - (CutterOD / 2)
120
121 print "G00 X",X_Pos,"Y",(Y_Pos - CutLineRadius)
122 print "G01 Z",-Zdepth," F",Speed
123 print "G03 X%6.4f" % X_Pos, "Y%6.4f" % (Y_Pos + CutLineRadius),"I0 J%6.4f" % CutLineRadius," F",Speed
124
125 print "(second pass - top and second end)"
126 X_Pos = (BoxWidth / 2) + X_USB - ((X_USB_slot - Y_USB_slot)/2)
127 print "G01 X",X_Pos," F",Speed
128 print "G03 X%6.4f" % X_Pos, "Y%6.4f" % (Y_Pos - CutLineRadius),"I0 J%6.4f" % -CutLineRadius," F",Speed
129
130 print "(second pass - bottom)"
131 X_Pos = (BoxWidth / 2) + X_USB + ((X_USB_slot - Y_USB_slot)/2)
132 print "G01 X",X_Pos," F",Speed
133
134 retract()
135
136 park()
137
138 print "M5 M2"
139 print "%"
140