-
G-Code repeat cycle
I have my lathe CNC retrofit completed and running on Mach3. I can write a basic step in step out code and the machine performs well. I would like to do a basic turning program that repeats and steps the X axis in by 0.1mm each time a cut is taken until the final depth in reached. Rather than write dozens of lines with each line giving a step in increment of 0.1mm each time. Is there a G-Code command that can be used that will allow repeating of each step giving a new X axis value each time?
How would this look?
Any help would be greatly appreciated.
Cam
-
You might have a G74 available, which is usually used as a canned drill cycle.
X10.Z1.
G74 X1. Z-10. I-.1 K-10. F.1
G80
(Check your documentation to find out the usage and wording)
-
Not easily done with Mach3. It does not support any looping or conditional execution constructs in its programming language.
The closest you can come is to put the cutting operations in a subroutine that is called with a repeat count (M98 P# L#). Make the X axis move in incremental (G91) mode.
-
Thanks for the reply's, I guess if Mach wont allow this type of turning cycle I could cheat and use the turning Wizard to create the code which has increments and cut and paste that into my own G-Code for that particular part of my program.
Cam
-
I'm pretty sure that you could do it using a subroutine call with the repeat (L) parameter. It is the only looping type construct that Mach3 supports, but it should be up to the task.
It would be nice if Mach3 supported things like DO/WHILE loops and IF statements. I use Mach3 on my desktop mill and wrote a program that allows it to run CNC programs written for over 3 dozen different CNC machines... just to get around its limitations.