Here is what I came up with; I made two buttons and put the code in the Clicked Script inside the button, you can make it a function if you like, but these work to increase and decrease the jog rate by 10%. You can change that to whatever you like, or add another button to change the resolution of change.
--Jog Rate +10%
local inst = mc.mcGetInstance()
local CurrentRate = mc.mcJogGetRate(inst, 1)
local JogRate = (CurrentRate + 10)
if JogRate <= 100 then
mc.mcJogSetRate(inst, 0, JogRate)
mc.mcJogSetRate(inst, 1, JogRate)
mc.mcJogSetRate(inst, 2, JogRate)
else if JogRate > 100 then
mc.mcCntlSetLastError(inst, "Can't set Jog Rate higher")
end
end
--Jog Rate -10%
local inst = mc.mcGetInstance()
local CurrentRate = mc.mcJogGetRate(inst, 1)
local JogRate = (CurrentRate - 10)
if JogRate >= 10 then
mc.mcJogSetRate(inst, 0, JogRate)
mc.mcJogSetRate(inst, 1, JogRate)
mc.mcJogSetRate(inst, 2, JogRate)
else if JogRate < 10 then
mc.mcCntlSetLastError(inst, "Can't set Jog Rate Lower")
end
end
Also,
There is a little glitch; this occurred to someone else, I just remembered that they mentioned it happens so be aware of it.
It won't display correctly when you lower it below 50% unless you first change it to 0% and then you can freely raise and lower it from 0-100%.
I don't know why, that's the way it is. So, when you start, just manually change the jog rate to 0% and you'll be good to go.
Also, looking at your code, maybe change the Axis to an integer instead of writing out the axis, your code may work just fine.