Hello Guest it is March 29, 2024, 08:21:13 AM

Author Topic: Change in Value Event  (Read 1388 times)

0 Members and 1 Guest are viewing this topic.

Change in Value Event
« on: February 15, 2017, 11:55:46 AM »
How would you go about capturing a change in the current jog increment?

TIA

RT

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: Change in Value Event
« Reply #1 on: February 16, 2017, 11:39:29 AM »
Possibly the simplest way

Code: [Select]
-- 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
New For 2022 - Instagram: dazthegas
Re: Change in Value Event
« Reply #2 on: February 16, 2017, 11:56:37 AM »
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