Page 1 of 1
gcode Loop/Repeat script for testing.
Posted: Tue Oct 27, 2015 9:15 pm
by KAS
Anyone know of a way to repeat or loop a set of gcode instructions?
It appears M41 command is the Loop function, although not implemented in smoothie or just about any 3D print controller.
http://reprap.org/wiki/G-code/es#M41:_Loop
Re: gcode Loop/Repeat script for testing.
Posted: Tue Oct 27, 2015 9:58 pm
by bot
Copy and paste in a text editor is what I do. On a duet you could make two macros that are the same and then call each other at the end, creating an endless loop that you'd have to interrupt to stop.
Re: gcode Loop/Repeat script for testing.
Posted: Tue Oct 27, 2015 11:58 pm
by Xenocrates
Unfortunately, from the looks of it, Repetier and Marlin do not support it. And Rep-Rap, which is the only one which does, not not support recursive or looping macros. So, well, bugger. I had a hope spot that you could use M98, but unfortunately that bit of niceness from industrial G did not make the transition. It would likely be easier to just set a large number of repetitions in the G code, with nice dwells and homes between it so that you have time to make adjustments, and it can take those into account. M41 is also apparently a dead letter when it comes to that.
I also found out that a number of the features I've come to love in industrial G did not make it to printers. G13 for example. I also dislike that they changed a few other things, and think their way of explaining the parameters is kinda terrible. I'm sorry I can't be more helpful to you.
That being said, there is very much a way to loop G code on industrial controllers. M97 on haas controllers pulls a line number (N####), named in the P####, and runs that, so long as at some point there is a M99 after the called line. You can potentially set it to loop like this. You can also use M98 to call a sub-program, which can be used to have a stub program which only serves to call the main portion of it, which then calls the stub again. of course, with the sanity checking most do, you'd have to terminate both with M99, and some controllers would either eventually run out of memory, or refuse to run this abortion at all. Seeing as how this has no abort method (G has no major logical constructs such as while or for loops in common implementations) I would argue refusing to run it, unless a setting is toggled is probably the best method to deal with it.