Author Topic: M9999  (Read 1064 times)

0 Members and 1 Guest are viewing this topic.

Offline rcaffin

  • Active Member
  • Posts: 990
    • View Profile
M9999
« 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

Offline ger21

  • Global Moderator
  • *
  • Posts: 6,153
    • View Profile
    • The CNC Woodworker
Re: M9999
« Reply #1 on: October 20, 2015, 07:24:10 AM »
Mach3 does not support If..Then in g-code.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline BR549

  • Mach4 Alpha
  • Posts: 6,855
    • View Profile
Re: M9999
« Reply #2 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

Offline rcaffin

  • Active Member
  • Posts: 990
    • View Profile
Re: M9999
« Reply #3 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