forked from LinuxCNC/simple-gcode-generators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drill-speed.py
175 lines (146 loc) · 6.99 KB
/
drill-speed.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/usr/local/bin/python
from Tkinter import *
"""
Copyright (C) <2008> <John Thornton>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
e-mail me any suggestions to "bjt 128 at gmail dot com"
If you make money using this software
you must donate $20 USD to a local food bank
or the food police will get you! Think of others from time to time...
To make it a menu item in Ubuntu use the Alacarte Menu Editor and add
the command python YourPathToThisFile/drill.py
make sure you have made the file execuatble by right
clicking and selecting properties then Permissions and Execute
To use with LinuxCNC see the instructions at:
https://github.com/linuxcnc/simple-gcode-generators
Once you find the SFM that suits your machine just change the DrillList to suit.
Enjoy and use safely
BigJohnT
"""
class Application(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.grid()
self.createFrames()
self.createWidgets()
def createFrames(self):
self.f1 = Frame(self, width=150, height=225, bd=5, relief=RIDGE)
self.f1.grid(row=0, column=0)
self.f1.grid_propagate(0)
self.f2 = Frame(self, width=150, height=225, bd=5, relief=RIDGE)
self.f2.grid(row=0, column=1)
self.f2.grid_propagate(0)
self.f3 = Frame(self, width=150, height=225, bd=5, relief=RIDGE)
self.f3.grid(row=0, column=2)
self.f3.grid_propagate(0)
self.f4 = Frame(self, width=450, height=100, bd=5, relief=RIDGE)
self.f4.grid(row=1, column=0, columnspan=3)
self.f4.grid_propagate(0)
def createWidgets(self):
# Frame 1 Widgets
self.f1st01 = Label(self.f1, text='Material', bd=5)
self.f1st01.grid(row=0, column=0)
self.Material=[('Tool Steel',1),('Cast Iron',2),('Bronzes',3),
('Mild Steel',4),('Brass',5),('Aluminum',6)]
self.f1rb1Var = IntVar()
for text, value in self.Material:
self.f1rb1 = Radiobutton(self.f1, text=text, value=value, variable=self.f1rb1Var)
self.f1rb1.grid(column=0,row=value+1, sticky=W)
self.f1rb1.bind("<ButtonRelease-1>", self.f1rb1Event)
self.f1rb1Var.set(0)
self.f1st02 = Label(self.f1, text='SFM Range', bd=5)
self.f1st02.grid(row=8, column=0)
self.f1st03Var = StringVar()
self.f1st03 = Label(self.f1, textvariable=self.f1st03Var)
self.f1st03.grid(row=9, column=0)
# Frame 2 Widgets
self.f2st01 = Label(self.f2, text='Drill Diameter')
self.f2st01.grid(row=0, column=0)
self.DiameterVar = StringVar()
self.Diameter=Entry(self.f2, width=10, textvariable=self.DiameterVar)
self.Diameter.grid(row=1, column=0)
self.f2st02 = Label(self.f2, text='RPM')
self.f2st02.grid(row=2, column=0)
self.RPMVar = StringVar()
self.RPM=Entry(self.f2, width=10, textvariable=self.RPMVar)
self.RPM.grid(row=3, column=0)
self.f2st03 = Label(self.f2, text='Chip Load per Inch')
self.f2st03.grid(row=4, column=0)
self.ChipLoadVar = StringVar()
self.ChipLoad = Entry(self.f2, width=10, textvariable=self.ChipLoadVar)
self.ChipLoad.grid(row=5, column=0)
self.ChipLoadVar.set('0.012')
self.f2st04 = Label(self.f2, text='Number of Flutes')
self.f2st04.grid(row=6, column=0)
self.FlutesVar = StringVar()
self.Flutes = Entry(self.f2, width=10, textvariable=self.FlutesVar)
self.Flutes.grid(row=7, column=0)
self.FlutesVar.set('2')
# Frame 3 Widgets
self.f3st01 = Label(self.f3, text='Feed IPM')
self.f3st01.grid(row=0, column=0)
self.f3st02Var = StringVar()
self.f3st02 = Label(self.f3, textvariable=self.f3st02Var)
self.f3st02.grid(row=1, column=0)
self.f3st03 = Label(self.f3, text='SFM')
self.f3st03.grid(row=2, column=0)
self.f3st04Var = StringVar()
self.f3st04 = Label(self.f3, textvariable=self.f3st04Var)
self.f3st04.grid(row=3, column=0)
self.f3st05 = Label(self.f3, text='Chip Load')
self.f3st05.grid(row=4, column=0)
self.f3st06Var = StringVar()
self.f3st06 = Label(self.f3, textvariable=self.f3st06Var)
self.f3st06.grid(row=5, column=0)
# Frame 4 Widgets
self.Instructions = 'Select a material to get the SFM Range' + \
'(Surface Feet per Minute)\n'+ \
'Enter the Drill Diameter and RPM\n'+ \
'Press Calculate to see the results\n'+ \
'Start with speeds that are in the low end of the SFM range\n'+ \
'Using Chip Load per Inch of Diameter of the drill bit\n' + \
'keeps the load even as you change diameters. Default is 0.012"'
self.f4st01 = Label(self.f4, text=self.Instructions)
self.f4st01.grid(row=0, column=0)
self.CalcButton = Button(self, text="Calculate", command=self.CalcFeed)
self.CalcButton.grid(row=2, column=1)
self.quitButton = Button(self, text="Quit", command=self.quit)
self.quitButton.grid(row=2, column=2)
self.DrillList = {1:'50,60',
2:'80,100',
3:'80,100',
4:'60,80',
5:'150,200',
6:'120,350'}
def f1rb1Event(self,var):
self.ms = self.DrillList[self.f1rb1Var.get()]
self.mssp = self.ms.split(',')
self.MinSFM = self.mssp[0]
self.MaxSFM = self.mssp[1]
self.f1st03Var.set(self.MinSFM + '-' + self.MaxSFM)
def CalcFeed(self):
# Calculate Chip Load
self.ChipLoadInch = float(self.ChipLoadVar.get())
self.DrillDiameter = float(self.DiameterVar.get())
self.CalcChipLoad = self.ChipLoadInch * self.DrillDiameter
self.f3st06Var.set(self.CalcChipLoad)
# Calculate Feed
self.NumberOfFlutes = int(self.FlutesVar.get())
self.DrillRPM = int(self.RPMVar.get())
self.FeedRate = (self.CalcChipLoad*self.NumberOfFlutes)*self.DrillRPM
self.f3st02Var.set(self.FeedRate)
# Calculate SFM
self.CalcSFM = int((0.262*self.DrillDiameter)*self.DrillRPM)
self.f3st04Var.set(self.CalcSFM)
app = Application()
app.master.title("Drilling Speeds & Feeds 0.1")
app.mainloop()