This repository has been archived by the owner on Jun 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cncpirahna.scpost
212 lines (182 loc) · 4.5 KB
/
cncpirahna.scpost
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
function OnAbout(event)
ctrl = event:GetTextCtrl()
ctrl:AppendText("Ray's Piranha post processorMinimum G-code post processor\n")
ctrl:AppendText("\n")
ctrl:AppendText("Ported from VCarve\n")
ctrl:AppendText("Non modal G-codes\n")
ctrl:AppendText("Modal coordinates\n")
ctrl:AppendText("No comments\n")
ctrl:AppendText("Incremental IJ\n")
ctrl:AppendText("G-codes used:\n")
ctrl:AppendText("G00,G01,G02,G03,G20,G21\n")
ctrl:AppendText("M-codes used:\n")
ctrl:AppendText("M03,M04,M05,M07,M08,M09\n")
end
-- revision 11/13/16
-- Ray - Make work for pirhana
-- revision 3/2/07
-- Removed final safety move. This is now done in SheetCam
-- Created 19/10/2004
-- based on Mach2.post
function OnInit()
post.SetCommentChars ("()", "[]") --make sure ( and ) characters do not appear in system text
post.Text("( ")
post.Text(fileNameOnly)
post.Text(" )\n")
post.Text("( File created ")
post.Text(date)
post.Text(" ")
post.Text(time)
post.Text(" )\n")
post.Text("( Material bottom left: X ")
post.Number (materialX1 * scale, "0.0000")
post.Text(" Y ")
post.Number(materialY1 * scale, "0.0000")
post.Text(" )\n")
post.Text("( Material top right: X ")
post.Number (materialX2 * scale, "0.0000")
post.Text(" Y ")
post.Number(materialY2 * scale, "0.0000")
post.Text(" )\n")
post.Text("G90 \n")
if(scale == metric) then
post.Text ("G21\n") --metric mode
else
post.Text ("G20\n") --inch mode
end
post.Text("F")
post.Number(feedRate * scale, "0.0")
post.Eol()
post.Text("G64 ")
if(scale == metric) then
post.Text("P.254")
else
post.Text("P.01")
end
post.Eol()
post.Text("S 2000\n")
post.Text("M3\n")
post.Text("G0 Z")
post.Number(safeZ * scale, "0.0000")
post.Eol()
bigArcs = 1 --stitch arc segments together
minArcSize = 0.05 --arcs smaller than this are converted to moves
end
function OnNewLine()
end
function OnFinish()
post.Text("G00 Z")
post.Number(safeZ * scale, "0.0000")
post.Eol()
post.Text("G00 X0.0000 Y0.0000\n")
post.Text("M02\n")
end
function OnRapid()
post.Text("F")
post.Number(feedRate * scale, "0.0")
post.Eol()
post.Text ("G00")
if(endX < 1e10) then
post.Text(" X")
post.Number (endX * scale, "0.0000")
end
if(endY < 1e10) then
post.Text(" Y")
post.Number (endY * scale, "0.0000")
end
post.Text(" Z")
post.Number ((endZ + toolOffset) * scale, "0.0000")
post.Eol()
end
function OnMove()
post.Text("F")
post.Number(feedRate * scale, "0.0")
post.Eol()
post.Text ("G01 X")
post.Number (endX * scale, "0.0000")
post.Text(" Y")
post.Number (endY * scale, "0.0000")
post.Text(" Z")
post.Number ((endZ + toolOffset) * scale, "0.0000")
post.Eol()
end
function OnArc()
post.Text("F")
post.Number(feedRate * scale, "0.0")
post.Eol()
if(arcAngle <0) then
post.Text ("G03")
else
post.Text ("G02")
end
post.Text(" X")
post.Number (endX * scale, "0.0000")
post.Text(" Y")
post.Number (endY * scale, "0.0000")
post.Text (" I")
post.Number ((arcCentreX - currentX) * scale, "0.0000")
post.Text (" J")
post.Number ((arcCentreY - currentY) * scale, "0.0000")
post.Eol()
end
function OnSpindleCW()
end
function OnSpindleCCW()
end
function OnSpindleOff()
end
function OnNewOperation()
if (plungeRate <= 0) then
post.Warning("WARNING: Plunge rate is zero")
end
if (feedRate <= 0) then
post.Warning("WARNING: Feed rate is zero")
end
end
function OnToolChange()
end
function OnSpindleChanged()
if (spindleSpeed <= 0) then
post.Warning("WARNING: Spindle speed is zero")
end
end
function OnNewPart()
end
function OnFloodOn()
end
function OnMistOn()
end
function OnCoolantOff()
end
function OnDrill()
post.Error("I don't know what to do with a drill")
OnRapid()
depth = drillStart
buffer = plungeSafety
endZ = depth + buffer
OnRapid()
if(drillRetract < buffer) then
buffer = drillRetract
end
while depth > drillZ do
OnRapid()
depth = depth - drillPeck
if (depth < drillZ) then
depth = drillZ
end
endZ = depth
OnMove()
if (depth > drillZ) then --retract if we need to take another bite
endZ = endZ + drillRetract
if (endZ > safeZ) then
endZ = safeZ
end
OnRapid()
endZ = depth + buffer
end
end
if (endZ < safeZ) then
endZ = safeZ
OnRapid()
end
end