Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: DazTheGas on June 29, 2015, 05:03:41 AM
-
In the lua examples directory there is an example of activating an output from script, is there a way to activate an input from script, I am setting up a diagnostic screen but really don't want the machine running whilst testing some of the features I am working on.
In particular I want to use mc.ISIG_JOGXN
DazTheGas
-
it think its the same as output
mc.ISIG_INPUT0
mc.OSIG_OUTPUT0
-
Got this to work in the sim, whereas the DRO's will not move and the button will let you toggle the input signal without actually moving the axis.
Button Down Script:
local inst = mc.mcGetInstance()
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGXN), 1)
mc.mcJogVelocityStop (inst, 0)
Button Up Script:
local inst = mc.mcGetInstance()
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGXN), 0)
-
Screwie to the rescue :-),
ive tried using the code from example in all different ways to no avail ended up with using mc.mcJogVelocityStart(inst, 0, -1) to start then mc.mcJogVelocityStop (inst, 0) to stop, but this then need a load of if and then statements for jog mode etc, but now its a simple as
Button down evt
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGXN), 1)
Button up evt
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGXN), 0)
as you can see theres no need to keep declaring the mach instance as my whole enviroment is now scripted in wxlua without using the editor buttons etc
cheers screwie....
DazTheGas
-
two ways to do the same thing but whats better
-
two ways to do the same thing but whats better
by using mc.ISIG_JOGXN mach4 will sort out if we are in continuous mode or step, the other way has 2 functions 1 for continuous the other for increment so extra code is needed for each axis to determine what state we are in.
DazTheGas
-
could be mach machine state....changing the state if possible? This may sound like a simple solution but everybody and every machine is different. This is a neat puzzle....
-
nevermind my last comment about changing the state...it's retarded.