Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: rhtuttle on February 15, 2017, 11:55:46 AM
-
How would you go about capturing a change in the current jog increment?
TIA
RT
-
Possibly the simplest way
-- screen load script
inc = mc.mcJogGetInc(inst, 0) -- change to whatever axis
--PLC Script
if mc.mcJogGetInc(inst, 0) ~= inc then
-- Do something here when inc changed
inc = mc.mcJogGetInc(inst, 0) -- same axis as in screen load script
end
DazTheGas
-
Thanks Daz,
That's a lot more elegant than what I came up with. I haven't messed around with the PLC Script yet so it is good to see a simple example.
I use a pendant with no screen for jogging and have a button to change the increment. I'm never looking at the screen when I do this so I
wanted to play a wav file to tell me what the new selection is. I ended up creating wav files for each entry and added functions to the screen script as you did in your youtube sound example. I then swapped out the Jog increment text box for a DRO since a DRO has a onChange event and put this code in:
if scr.GetProperty('JogIncrDro','Value') == "1.000000" then
OneInch:Play()
elseif scr.GetProperty('JogIncrDro','Value')=="0.100000" then
OneTenth:Play()
elseif scr.GetProperty('JogIncrDro','Value')=="0.010000" then
OneHundredth:Play()
elseif scr.GetProperty('JogIncrDro','Value')=="0.001000" then
OneThousandth:Play()
elseif scr.GetProperty('JogIncrDro','Value')=="0.000100" then
OneTenThousandth:Play()
end
Putting it in the PLC would be quicker and cleaner.
BTW, You need to come up with a website where we can donate some beer money for all your help ;D