261
Mach4 General Discussion / Re: Button G code juggle
« on: September 10, 2020, 04:13:06 PM »
Try using mc.AxisGetPos instead.
Bill
Bill
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
local inst = mc.mcGetInstance()
local Tool = mc.mcToolGetSelected(inst)
--get max tools
local ATCMaxTlsReg = mc.mcRegGetHandle(inst, 'iRegs0/ATCMaxTools')
local ATCMaxTlsVal = mc.mcRegGetValue(ATCMaxTlsReg)
--if tool is in range add one to tool #
if (Tool <= (ATCMaxTlsVal - 1)) then
Tool = (Tool + 1)
mc.mcCntlSetPoundVar(inst, mc.SV_CUR_SELECTED_TOOL, Tool)
end
local inst = mc.mcGetInstance()
local Tool = mc.mcToolGetSelected(inst)
--if tool is in range subtract one from tool #
if (Tool >= 2) then
Tool = (Tool - 1)
mc.mcCntlSetPoundVar(inst, mc.SV_CUR_SELECTED_TOOL, Tool)
end
local inst = mc.mcGetInstance()
local Tool = mc.mcToolGetSelected(inst)
--get max tools
local ATCMaxTlsReg = mc.mcRegGetHandle(inst, 'iRegs0/ATCMaxTools')
local ATCMaxTlsVal = mc.mcRegGetValue(ATCMaxTlsReg)
--if tool is in range add one to tool #
if (Tool <= (ATCMaxTlsVal - 1)) then
Tool = (Tool + 1)
mc.mcCntlGcodeExecute(inst, string.format("T" .. Tool))
end