symbol for Onion Omega2S SOM
[hw/altusmetrum] / mechanical / telebt-box.py
1 #! /usr/bin/python
2 # Copyright 2020 by Bdale Garbee <bdale@gag.com>.  GPLv3
3
4 # cut required holes in a Hammond 1551K box to mount TeleBT v4.0b and later
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.2500          # 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 = 0.886        # switch distance from center line
27 Y_Switch = 0.220        # switch centerline above PCB top surface (adjusted)
28 X_Switch_slot = 0.300   # width of switch slot
29 Y_Switch_slot = 0.160   # height of switch slot
30
31 X_USB = -1.143          # USB distance from center line
32 Y_USB = -0.049          # USB centerline below PCB bottom surface
33
34 X_USB_slot = 0.350      # width of the USB slot  (account for plastic melting
35 Y_USB_slot = 0.150      # height of the USB slot  around end mill)
36
37 Y_SMA = -0.025          # SMA centerline below PCB bottom surface
38 D_SMA = 0.281           # diameter of SMA hole (doc says 0.256)
39
40 Y_Box_Bottom = 0.079    # thickness of box bottom wall
41 Y_Standoff = 0.157      # height of standoff nubs in box
42 Y_PCB = 0.063           # PCB thickness
43
44 def plunge():
45         print "(plunge)"
46         print "G01 Z",-Zdepth," F",Speed
47
48 def retract():
49         print "(retract)"
50         print "G00 Z",Zfree
51
52 def park():
53         retract()
54         print "(park)"
55         print "G00 X0 Y5 Z0.25"
56
57 print "%"
58 print "(TeleBT box using 1/16 mill, box base to back, origin back/left/top edges)"
59
60 print "G17 G20 G90"
61 print "M3 S5000"
62
63 retract()
64
65 print
66 print "(SMA hole)"
67
68 X_Pos = (BoxWidth / 2)
69 Y_Pos = -(Y_Box_Bottom + Y_Standoff + Y_SMA)
70 CutLineRadius = (D_SMA / 2) - (CutterOD / 2)
71
72 print "G00 X",(X_Pos + CutLineRadius),"Y",Y_Pos
73 print "G01 Z",-Zdepth," F",Speed
74 print "G02 X%6.4f" % (X_Pos - CutLineRadius),"Y%6.4f" % Y_Pos,"I%6.4f" % -CutLineRadius,"J0 F",Speed
75 print "G02 X%6.4f" % (X_Pos + CutLineRadius),"Y%6.4f" % Y_Pos,"I%6.4f" % CutLineRadius,"J0 F",Speed
76 retract()
77
78 print
79 print "(power switch slot)"
80
81 X_Start = (BoxWidth / 2) + X_Switch + (X_Switch_slot / 2) - (CutterOD / 2)
82 X_End = (BoxWidth / 2) + X_Switch - (X_Switch_slot / 2) + (CutterOD / 2)
83 Y_Start = -(Y_Box_Bottom + Y_Standoff + Y_Switch) + (Y_Switch_slot / 2) - (CutterOD / 2)
84 Y_End = -(Y_Box_Bottom + Y_Standoff + Y_Switch) - (Y_Switch_slot / 2) + (CutterOD / 2)
85
86 print "(  first pass)"
87 print "G00 X",X_Start,"Y",Y_Start
88 print "G01 Z",-Zdepth," F",Speed
89 print "G01 X",X_End," Y",Y_Start," F",Speed
90 print "G01 X",X_End," Y",Y_End," F",Speed
91 print "G01 X",X_Start," Y",Y_End," F",Speed
92 print "G01 X",X_Start," Y",Y_Start," F",Speed
93 print
94 print "(  second pass)"
95 print "G00 X",X_Start,"Y",Y_Start
96 print "G01 Z",-Zdepth," F",Speed
97 print "G01 X",X_End," Y",Y_Start," F",Speed
98 print "G01 X",X_End," Y",Y_End," F",Speed
99 print "G01 X",X_Start," Y",Y_End," F",Speed
100 print "G01 X",X_Start," Y",Y_Start," F",Speed
101
102 retract()
103
104 print
105 print "(USB slot)"
106
107 print "(  first end)"
108 X_Pos = (BoxWidth / 2) + X_USB + ((X_USB_slot - Y_USB_slot)/2)
109 Y_Pos = -(Y_Box_Bottom + Y_Standoff + Y_USB)
110 CutLineRadius = (Y_USB_slot / 2) - (CutterOD / 2)
111
112 print "G00 X",X_Pos,"Y",(Y_Pos - CutLineRadius)
113 print "G01 Z",-Zdepth," F",Speed
114 print "G03 X%6.4f" % X_Pos, "Y%6.4f" % (Y_Pos + CutLineRadius),"I0 J%6.4f" % CutLineRadius," F",Speed
115
116 print "(  top and second end)"
117 X_Pos = (BoxWidth / 2) + X_USB - ((X_USB_slot - Y_USB_slot)/2)
118 print "G01 X",X_Pos," F",Speed
119 print "G03 X%6.4f" % X_Pos, "Y%6.4f" % (Y_Pos - CutLineRadius),"I0 J%6.4f" % -CutLineRadius," F",Speed
120
121 print "(  bottom)"
122 X_Pos = (BoxWidth / 2) + X_USB + ((X_USB_slot - Y_USB_slot)/2)
123 print "G01 X",X_Pos," F",Speed
124
125 retract()
126
127 print "(  second pass - first end)"
128 X_Pos = (BoxWidth / 2) + X_USB + ((X_USB_slot - Y_USB_slot)/2)
129 Y_Pos = -(Y_Box_Bottom + Y_Standoff + Y_USB)
130 CutLineRadius = (Y_USB_slot / 2) - (CutterOD / 2)
131
132 print "G00 X",X_Pos,"Y",(Y_Pos - CutLineRadius)
133 print "G01 Z",-Zdepth," F",Speed
134 print "G03 X%6.4f" % X_Pos, "Y%6.4f" % (Y_Pos + CutLineRadius),"I0 J%6.4f" % CutLineRadius," F",Speed
135
136 print "(  second pass - top and second end)"
137 X_Pos = (BoxWidth / 2) + X_USB - ((X_USB_slot - Y_USB_slot)/2)
138 print "G01 X",X_Pos," F",Speed
139 print "G03 X%6.4f" % X_Pos, "Y%6.4f" % (Y_Pos - CutLineRadius),"I0 J%6.4f" % -CutLineRadius," F",Speed
140
141 print "(  second pass - bottom)"
142 X_Pos = (BoxWidth / 2) + X_USB + ((X_USB_slot - Y_USB_slot)/2)
143 print "G01 X",X_Pos," F",Speed
144
145 park()
146
147 print "M5 M2"
148 print "%"
149