-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvcutter.py
executable file
·95 lines (74 loc) · 2.6 KB
/
vcutter.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
#!/usr/bin/python
#
# 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 2
# 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# You will find the latest version of this code at the following address:
# http://hugomatic.ca/source/cncOnline
#
# You can contact me at the following email address:
# hugo@hugomatic.ca
#
import math
import hugomatic.toolkit # UI and cmdline stuff
import hugomatic.code # gcode routines
def depth(degrees, width):
radians = math.radians(angle * 0.5)
tangeant = math.tan(radians)
opposed = 0.5 * width
# tangeant = opposed / adjacent
adjacent = opposed / tangeant
return adjacent
def width(degrees, depth):
radians = math.radians(angle * 0.5)
tangeant = math.tan(radians)
adjacent = depth
# tangeant = opposed / adjacent
opposed = tangeant / adjacent
return 2. * opposed
########################################
# Global variables definition
#
# remember: 1 inch = 25.4 millimeters
########################################
# Program GUI
#
params = hugomatic.toolkit.Parameters('Vcutter',
'Cut Depth/Width calculator for conical end mills (V bits)',
picture_file="vcutter.gif")
angle = 60.
params.addArgument(angle, 'V bit end mill cutting angle in degrees')
calc = "depth"
params.addArgument(calc, 'Type of calculation', choices = ('depth','width'))
value = 1.0
params.addArgument(value, 'Value of known width/depth')
#
# Generation
#
if params.loadParams():
print
if calc == "depth":
f = depth(angle, value)
print
print "(For a trace width of %f)" % value
print "The depth of the cutter is: " + str(f)
if calc == "width":
f = width(angle, value)
print
print "(For a cut depth of %f)" % value
print "The width of the trace is: " + str(f)
print
print "(Please adjust for tool height and spindle runnout errors)"
print
print "(remember: 1 inch = 25.4 millimeters)"