Hello Guest it is April 23, 2024, 09:56:44 AM

Author Topic: A basic way to add conditionals to Mach3  (Read 3304 times)

0 Members and 1 Guest are viewing this topic.

A basic way to add conditionals to Mach3
« on: January 31, 2009, 08:24:20 AM »
When Mach3 (v2.63) comes across the G-code,
Code: [Select]
M98 (doOperation) L 0

it runs doOperation once, even though the number of repetitions is specified as zero. Can the behaviour of Mach3 be changed to so that the subroutine is never called if L is set to zero ? This behaviour will enable some basic conditional G-code. For example,

Code: [Select]
#1 = 0 ; CLOCKWISE = 0 , ANTICLOCKWISE = 1

#2 = [ 1 AND #1 ]
M98 (MachineAntiClockwise) L #2

#2 = [ 1 - #2 ]
M98 (MachineClockwise) L #2

On the face of it, it would seem easy to implement and not require a change to the software design.

vmax549

*
Re: A basic way to add conditionals to Mach3
« Reply #1 on: January 31, 2009, 08:06:02 PM »
I believe it was changed in later version so that L0=zero. Look at the fix log for the new versions to be sure when it was done.

You can also hop out  a macro breifly to make a condition test then redirect back inside the gcode where every you need to

M999       (  IF #3<#1  Code"M98 P100"     It will test for the condition then return to the gcode at the Oword   o100 , OR it will passthrough to the next line of Gcode after the macro call)

(;-) TP
« Last Edit: January 31, 2009, 08:11:14 PM by vmax549 »