Hello Bill_O
Have an idea how I can update the G code in the script from a text, for example I have the tool change macro that I want to update from the tool preparation table.function m6()
local inst = mc.mcGetInstance()
local selectedTool = mc.mcToolGetSelected(inst)
selectedTool = math.tointeger(selectedTool)
local currentTool = mc.mcToolGetCurrent(inst)
currentTool = math.tointeger(currentTool)
if selectedTool == currentTool then
mc.mcCntlSetLastError(inst, "Current tool == Selected tool so there is nothing to do")
else
if selectedTool > 33 then
mc.mcCntlSetLastError(inst, "There is no such tool")
else
if selectedTool == 0 then
mc.mcCntlGcodeExecute(inst, "G53 G0 X0 Y0"); --T0
else
if selectedTool == 1 then
mc.mcCntlGcodeExecute(inst, "G53 G0 X60 Y552"); --T0101
else
if selectedTool == 2 then
mc.mcCntlGcodeExecute(inst, "G53 G0 X40 Y502"); --T0202
else
if selectedTool == 3 then
mc.mcCntlGcodeExecute(inst, "G53 G0 X40 Y452"); --T0303
else
if selectedTool == 4 then
mc.mcCntlGcodeExecute(inst, "G53 G0 X40 Y402"); --T0404
else
if selectedTool == 5 then
mc.mcCntlGcodeExecute(inst, "G53 G0 X40 Y352"); --T0505
else
if selectedTool == 6 then
mc.mcCntlGcodeExecute(inst, "G53 G0 X40 Y300"); --T0606
else
if selectedTool == 7 then
mc.mcCntlGcodeExecute(inst, "G53 G0 X40 Y218"); --T0707
else
if selectedTool == 8 then
mc.mcCntlGcodeExecute(inst, "G53 G0 X40 Y148"); --T0808
else
if selectedTool == 9 then
mc.mcCntlGcodeExecute(inst, "G53 G0 X74 Y56"); --T0909
else
if selectedTool == 10 then
mc.mcCntlGcodeExecute(inst, "G53 G0 X40 Y6"); --T1010
else
if selectedTool == 11 then
mc.mcCntlGcodeExecute(inst, "G53 G0 X108 Y6"); --T1111
else
if selectedTool == 21 then
mc.mcCntlGcodeExecute(inst, "G53 G0 B492"); --T2121
else
if selectedTool == 22 then
mc.mcCntlGcodeExecute(inst, "G53 G0 B432"); --T2222
else
if selectedTool == 23 then
mc.mcCntlGcodeExecute(inst, "G53 G0 B370"); --T2323
else
if selectedTool == 30 then
mc.mcCntlGcodeExecute(inst, "G53 G0 B632"); --T3030
else
if selectedTool == 31 then
mc.mcCntlGcodeExecute(inst, "G53 G0 B242"); --T3131
else
if selectedTool == 32 then
mc.mcCntlGcodeExecute(inst, "G53 G0 B162"); --T3232
else
if selectedTool == 33 then
mc.mcCntlGcodeExecute(inst, "G53 G0 B82"); --T3333
--mc.mcCntlSetLastError(inst, "Change to tool " .. tostring(selectedTool) .. " and press start to continue") --Message at beginning of tool change
--mc.mcCntlToolChangeManual(inst, true) --This will pause the tool change here and wait for a press of cycle start to continue
--mc.mcCntlSetLastError(inst, "Current tool == " .. tostring(selectedTool) .. " Previous Tool == " .. tostring(currentTool)) --Message that shows after Cycle Start
--mc.mcToolSetCurrent(inst, selectedTool)
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
if (mc.mcInEditor() == 1) then
m6()
end