Hi Daz,
That's similar to what I ended up with, but started out with a bit of a mess. The mess was yesterday and last night, it got cleaned up and working this morning. I'm not using buttons, I have a 7 position rotary binary switch that has positions for jog types and jog increments. So the pin combination was throwing my thinking off. Until I ditched the function I started with, then things got clear.
Here's the jog portion of the screen script as it is now, and I think I'm mostly done tinkering with it as all my console functions work that I care about. Though some might get changed around down the road.
Regards
Bob
end
}
---------------------------------------------------------------
function JOG()
---------------------------------------------------------------
--Set Jogtype and jog increment from console switch
local Input14 = 0 --Clear local Input14
local Input15 = 0 --Clear local Input15
local Input17 = 0 --Clear local Input17
local hSig = 0 --Clear local hSig
local cont = mc.mcSignalGetHandle(inst, mc.OSIG_JOG_CONT)
local inc = mc.mcSignalGetHandle(inst, mc.OSIG_JOG_INC)
local mpg = mc.mcSignalGetHandle(inst, mc.OSIG_JOG_MPG)
inst = mc.mcGetInstance()
hSig = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT14)
Input14 = mc.mcSignalGetState(hSig) --Get State of Input 14
inst = mc.mcGetInstance()
hSig = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT15)
Input15 = mc.mcSignalGetState(hSig) --Get State of Input 15
inst = mc.mcGetInstance()
hSig = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT17)
Input17 = mc.mcSignalGetState(hSig) --Get State of Input 17
if ((Input14 == 1) and (Input15 == 1) and (Input17 == 1)) then
local inst = mc.mcGetInstance(); --Jog Continous
mc.mcSignalSetState(cont, 1)
mc.mcSignalSetState(inc, 0)
mc.mcSignalSetState(mpg, 0)
elseif ((Input14 == 0) and (Input15 == 1) and (Input17 == 1)) then
local inst = mc.mcGetInstance(); --Jog Incremental
mc.mcSignalSetState(cont, 0)
mc.mcSignalSetState(inc, 1)
mc.mcSignalSetState(mpg, 0)
elseif ((Input14 == 1) and (Input15 == 1) and (Input17 == 0)) then
local inst = mc.mcGetInstance()
mc.mcJogSetInc(inst, mc.X_AXIS, 0.0001)
mc.mcJogSetInc(inst, mc.Y_AXIS, 0.0001)
mc.mcJogSetInc(inst, mc.Z_AXIS, 0.0001)
mc.mcJogSetInc(inst, mc.A_AXIS, 0.0001)
elseif ((Input14 == 0) and (Input15 == 1) and (Input17 == 0)) then
local inst = mc.mcGetInstance()
mc.mcJogSetInc(inst, mc.X_AXIS, 0.001)
mc.mcJogSetInc(inst, mc.Y_AXIS, 0.001)
mc.mcJogSetInc(inst, mc.Z_AXIS, 0.001)
mc.mcJogSetInc(inst, mc.A_AXIS, 0.001)
elseif ((Input14 == 1) and (Input15 == 0) and (Input17 == 1)) then
local inst = mc.mcGetInstance()
mc.mcJogSetInc(inst, mc.X_AXIS, 0.01)
mc.mcJogSetInc(inst, mc.Y_AXIS, 0.01)
mc.mcJogSetInc(inst, mc.Z_AXIS, 0.01)
mc.mcJogSetInc(inst, mc.A_AXIS, 0.01)
elseif ((Input14 == 0) and (Input15 == 0) and (Input17 == 1)) then
local inst = mc.mcGetInstance()
mc.mcJogSetInc(inst, mc.X_AXIS, 0.1)
mc.mcJogSetInc(inst, mc.Y_AXIS, 0.1)
mc.mcJogSetInc(inst, mc.Z_AXIS, 0.1)
mc.mcJogSetInc(inst, mc.A_AXIS, 0.1)
elseif ((Input14 == 1) and (Input15 == 0) and (Input17 == 0)) then
local inst = mc.mcGetInstance()
mc.mcJogSetInc(inst, mc.X_AXIS, 1.000)
mc.mcJogSetInc(inst, mc.Y_AXIS, 1.000)
mc.mcJogSetInc(inst, mc.Z_AXIS, 1.000)
mc.mcJogSetInc(inst, mc.A_AXIS, 1.000)
end
end