Hello everybody,
i have wirtten a macro to compensate for backlash of my x,y,z spindle (trapezoidal thread).
On every axis I have a glass scale encoder which gives me the correct position of each axis.
What I'm doing now is checking (before a gcode execution) if the direction is changing.
If so I do a Gcode command in the corresponding direction with travel distance 1mm and feedrate
6mm/min (G01 X1 F6). Inside the "do while ismoving loop" I'm checking if the corresponding encoder
is moving (which is not the case as long as the backlash distance is not reached). When the encoder
starts moving the backlash is compensated and I exit the "do while ismoving loop".
After the loop I do a stop with DoOEMBUTTON(1003) to not move the axis any further (onyl backlash
compensation). And last but not least I update the Mach3 DRO with the actual encoder position, and also
do a G92 command with the position from the encoder.
The problem is that the DoOEMBUTTON(1003) terminates the VB-Script, what it shall not do

.
I also tried using DoOEMBUTTON(250) which disables x-axis movement to stop directly when the encoder
starts moving. This works without terminating the script, but the further script execution is halted until
the Gcode execution (G01 X1 F6) is finished, which takes some time because the movement is very slow.
Does anyone know a way(trick) to use DoOEMBUTTON(1003) without terminating the VB-Script?
Or another way to interrupt and cancel a running Gcode command from a visual basic script without terminating the script itself?
I'm searching in the forum for two hours now and could not find anything

...please help
Greetings
Thomas