Originally Posted by
toolndie7
Im playing around with this crappy little 3 axis at work. Its running off artsoft mach2 if that means anything. Anyway, Im trying to engrave multiple parts in a fixture and I need some help modifying my G-code. Here is a sample program that does just one part, I would like to make a move in 'X' re zero and re run the job and so on and so on. Any help would be much appreciated as I am way out of date with g-code.
Thanks
Brian
Does the system you are using allow you to call a subroutine or a sub program? These are the M97 for subroutine and M98 for subprogram commands which include a target for the call. M97 P2000 tells the controller to look for line N2000 in the current program and start from there; M98 PO2000 tells the controller to look for a programe named O2000 and run that program. Note the 'P' may be replaced by an 'O' or some other letter.
If your system can handle M97 the way you can repeat the program at many locations is establish work coordinates at these locations, select the work coordinate and then do the subroutine call. You would make the first location G54, the next G55, etc and your program would be something like this:
(Some stuff)
G54
M97 P2000
G55
M97 P2000
G56
M97 P2000
etc
etc
M30
N2000
(Your program)
M99
The M99 command tells the controller to go back to the line immediately below the line with the M97.
If you are using the M98 then you have two programs; one with all the M98 commands and the other is your program.
You are using only one tool so this is a simple way to do it. If you are using multiple tools you need to break your program up into subroutines or sub programs for each tool.
Find out if your system can handle these commands and how the target is specified and if you have more questions post them.
An open mind is a virtue...so long as all the common sense has not leaked out.