Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: rcaffin on October 20, 2015, 06:31:02 AM

Title: M9999
Post by: rcaffin on October 20, 2015, 06:31:02 AM
Way back in 2009 there was some discussion about a macro m9999 which would allow

#3=3
o100
G0 X#3
#3=[#3+1]
M9999 (If (GetVAR(3) > 6) Then Code" (END M9999)" Else code"M98 P100 " )
m30
%

But of course this gets thrown out because it has a nested comment (or two or three).
It's also recursive, which might upset Mach3 something awful!

Did this ever come to anything?

Cheers
Roger
Title: Re: M9999
Post by: ger21 on October 20, 2015, 07:24:10 AM
Mach3 does not support If..Then in g-code.
Title: Re: M9999
Post by: BR549 on October 20, 2015, 09:23:51 AM
That looks like some of my doings. The code to the right of the  M9999 would be contained inside of the M9999. It is a way of doing conditional Gcode with mach3.

That method works fine by the way.

(;-) TP
Title: Re: M9999
Post by: rcaffin on October 20, 2015, 05:15:58 PM
Hi Ger and Terry

OK, so that was a cryptic shorthand method of suggesting what should be in the macro? OK, understood. Been there and done that already.

Yes, I know Mach does not support the IF statement - at least not officially. But since Mach does support some non-linear mathematical functions, you CAN create code which implements the IF concept. Been there and done that too.

Cheers and thanks
Roger