Hi,
you need to give some thought as to when this code executes, and if it executes repeatedly every few milliseconds or
so, what prevents the movement code executing multiple times.
As it is written it looks like this ode should go in the PLC script. So you are polling the input, it works
but is inefficient.
So lets assume the signal changes state, ie the conditional MatHmLimit==1 then the movement codes execute.
Because you have not used GcodeExecuteWait() the movement codes return immediately. This could mean that
BEFORE your machine has had the time to move off the home switch the PLC script will run again the conditional
is still true so a second lot of movement codes is executed. Is that what you want?
The second issue is that you are attempting to execute Gcode, that is your motion codes, yet you have not tested to
see whether Mach is in the idle state and can accept motion codes.
I suspect that what you are hoping that will happen is that this will happen when you hit <RefAllHome>. You will
be dissapointed because when RefAllHome is running, being in the screen chunk Mach will never be in idle state
and therefore your motion codes can't run.
Please explain what you are trying to achieve and when you are trying to achieve it.
Craig