-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJacksloon.rb
executable file
·184 lines (168 loc) · 4.76 KB
/
Jacksloon.rb
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
176
177
178
179
180
181
182
183
184
require './Bot.rb'
class Jacksloon < Bot
attr_accessor :batdepth
def initialize(starx, stary)
@zstep = 4
@magic = 0.023
@bronk = 0.128
@depth = 0.522
super(starx, stary)
end
NUMSEGS = 32
def cutoPointDeepo(x,y,z)
if z < -@depth then z = -@depth end
printf "G1 X%5.5f Y%5.5f Z%5.5f\n", x, y, z
end
def johnson(x,y)
spyrtub(x,y,5.0/32,0.15/32)
#pipe(x,y,5.1/32,0,-@depth)
end
def yarc(x,y,z,r,s)
if $DEBUG then
printf "G2 X%5.5f Y%5.5f I%5.5f J%5.5f Z%5.5f\n",
x+s, y-r, x+s, y, z
else
printf "G2 X%5.5f Y%5.5f I%5.5f J%5.5f Z%5.5f\n",
x+s, y-r, 0, -r, z
end
end
def spyrtub(x,y,r,stretch)
r -= $halfwidth
skimtoPoint(x+stretch,y+r,0.1)
penetrate(0)
z = 0
incro = 0.075
while z > (-@depth - incro) do
z -= incro
ee = z
if (z < -@depth) then ee = -@depth end
yarc(x,y,ee,r,stretch)
#printf "G2 X%5.5f Y%5.5f I%5.5f J%5.5f Z%5.5f\n", x+stretch, y-r, 0, -r, ee, @@feedrate
cutoPointDeepo(x-stretch,y-r,ee)
z -= incro
ee = z
if (z < -@depth) then ee = -@depth end
yarc(x,y,ee,-r,-stretch)
#printf "G2 X%5.5f Y%5.5f I%5.5f J%5.5f Z%5.5f\n", x-stretch, y+r, 0, r, ee, @@feedrate
cutoPointDeepo(x+stretch,y+r,ee)
end
yarc(x,y,ee,r,stretch)
#oldspyrtub(x,y,xr,yr)
#pipe(x,y,xr,0,-@depth)
end
def oldspyrtub(x,y,xr,yr)
skimtoPoint(x,y,0.1)
xr -= $halfwidth
yr -= $halfwidth
i = 0
z = 0
incro = (Float(@depth) / Float(@zstep))
while z > -@depth - incro do
z -= incro / NUMSEGS
xx = xr * Math.sin(2 * i * Math::PI / NUMSEGS)
yy = yr * Math.cos(2 * i * Math::PI / NUMSEGS)
cutoPointDeepo(x+xx,y+yy,z)
i += 1
end
end
def kobiconn(x,y)
nowchub = (0.367/2)
box(x+nowchub,y-0.5,x+nowchub+$bitwidth,y-0.3,0,-0.211,2)
box(x-nowchub,y-0.75,x+nowchub,y+$halfwidth,0,-0.433,4)#june23 made 433 back to 4
#december 2023 made 4 back to 433
end
def adamusb(x,y)
nowchub = 0.25 #adamusb
box(x-0.25,y-0.75,x+0.25,y+0.15,0,-0.433,4)
end
def alpswitch(x,y)
nowchub = (0.222/2) #alpsSHAFT
box(x-nowchub,y-0.4,x+nowchub,y+$halfwidth+$halfwidth,0,-0.3,3)
nowchub = (0.610/2) #alpswitch
box(x-nowchub,y-0.5,x+nowchub,y-0.1,0,-0.36,3)
end
def kyconsterupsidedown(x,y)
nowchub = (0.266/2) #kyconSHAFT
box(x-nowchub,y-$bitwidth,x+nowchub,y+0.4,0,-0.3,3)
nowchub = (0.5/2) #kyconSTEREO
box(x-nowchub,y+0.1,x+nowchub,y+0.65,0,-0.351,3)
nowchub -= $halfwidth
dux(x-nowchub,y+0.1+$halfwidth,x-nowchub,y+0.5,-0.351,-0.404,1)
dux(x+nowchub,y+0.1+$halfwidth,x+nowchub,y+0.5,-0.351,-0.404,1)
end
def kyconster(x,y)
nowchub = (0.266/2) #kyconSHAFT
box(x-nowchub,y-0.4,x+nowchub,y+$halfwidth+$halfwidth,0,-0.3,3)
nowchub = (0.5/2) #kyconSTEREO
box(x-nowchub,y-0.65,x+nowchub,y-0.1,0,-0.351,3)
nowchub -= $halfwidth
dux(x-nowchub,y-0.5,x-nowchub,y-0.1-$halfwidth,-0.351,-0.404,1)
dux(x+nowchub,y-0.5,x+nowchub,y-0.1-$halfwidth,-0.351,-0.404,1)
end
def drawzarc(x,y,r,z)
cutoPoint(x+r,y)
if $DEBUG then
printf "G3 X%5.5f Y%5.5f I%5.5f J%5.5f, Z%5.5f\n",
x-r, y, x, y, z
else
printf "G3 X%5.5f Y%5.5f I%5.5f J%5.5f, Z%5.5f\n",
x-r, y, -r, 0, z
end
end
def drawzare(x,y,r)
numsegs = Integer(r*32+1)
for i in 0..NUMSEGS do
yy = r * Math.sin(i * Math::PI / NUMSEGS)
xx = r * Math.cos(i * Math::PI / NUMSEGS)
cutoPoint(x+xx,y+yy)
end
end
def drawzlun(x,y,r,z)
drawzarc(x,y,r,z)
end
def drawzrun(x,y,r,z)
if (r<0) then r += $halfwidth
else r -= $halfwidth end
drawzarc(x,y,r,z)
end
def lune(x,y,r,zstart,zdepth,step)
if (r<0) then
r += $halfwidth
else
r -= $halfwidth
end
incro = (Float(zdepth-zstart) / Float(step))
skimtoPoint(x+r,y,zstart+0.1)
for i in 1..step do
penetrate(zstart + (incro * i))
drawzlun(x,y,r,zstart + (incro * i))
end
end
def rune(x,y,r,zstart,zdepth,step)
###do LOONY STUFF HERE IN SID TET QUA
incro = (Float(zdepth-zstart) / Float(step))
skimtoPoint(x,y,zstart+0.1)
for i in 1..step do
penetrate(zstart + (incro * i))
drawzrun(x,y,r,zstart + (incro * i))
end
end
def weirdsignale(minx, miny, maxx, maxy, zstart, zdepth)
margin = 0.25
da = (Math::PI * 2) / (NUMSEGS)
centerptx = (minx + maxx) / 2
centerpty = (miny + maxy) / 2
scalex = centerptx - minx - margin
scaley = centerpty - miny - margin
for i in 0..(NUMSEGS-1) do
angle = i * da
if ((i.divmod(4)[1]) < (1.0)) then weirdscale = 1.5
else weirdscale = 1 end
cosa = (Math.cos(angle) * (i.divmod(2)[1]+1) / 2)
sina = (Math.sin(angle) * (i.divmod(2)[1]+1) / 2)
cosa = (cosa * scalex * weirdscale) + centerptx
sina = (sina * scaley * weirdscale) + centerpty
drillus(cosa,sina,zstart,zdepth)
end
end
end