Machsupport Forum
G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: AJA on May 26, 2009, 09:05:08 PM
-
I want to run this code 50 times and increment it in the Y axis in 0.100 increments. How do I accomplish this?
Thanks
AJ
G00 X0 Y0 Z1
G01 Z0 F20
G18
G02 X-4 Z0 R3.4019
G17
G00 Z1
-
#2=0
M98 P100 L50
M30
%
o100
#1=.100
G00 X0 Y#2 Z1
G01 Z0 F20
G18
G02 X-4 Z0 R3.4019
G17
G00 Z1
#2=[#2+#1]
M99
%
-
Thanks vmax549,
Will you recommend a book which provides and explains examples in line by line form for the various g codes? I use the Mach 3 user's guide but for a newbee it leaves some holes in the examples.
Thanks again
AJ
-
I can explain the above code if that helps, what you were asking for went a little above basic Gcode(;-).
A good read is PeterSmid's "CNC Programing, second edition" BUT it can be quite a read for a beginner BUT it does have a help CD encluded. I still use it as a referrnece from time to time.
He does a good job of explaining.
IF you need a BASIC learner there is one on the WEB I'll try and track it down again and let you know.
THe book is:
Easy CNC - A Beginners Guide to CNC
I have NOT read it myself but it does come recommended(;-)
(;-) TP
-
I understand the code as written, but noway would I have been able to place the lines in their correct order.
I have ordered both of the books which you recommended. Perhaps some of their knowledge will be absorbed.
Thanks again
AJ
-
I was taught to always use a % sign at the beginning & the end of the program does this hold true for mach3
-
Not required but a good habit to be in.
(;-) TP
-
In some instances, mach does indeed need the carriage return. The "%" is just a visual cue that the carriage return (or whatever it's called nowadays) is actually there. Definitely a good habit to be in.
-
...if you need help decoding G-Code....
I wrote a web based G-Code commenter. It adds plain English comments to G-Code.
http://www.eng-serve.com/cnc/gcode_comment.html (http://www.eng-serve.com/cnc/gcode_comment.html)
Input
#2=0
M98 P100 L50
M30
%
o100
#1=.100
G00 X0 Y#2 Z1
G01 Z0 F20
G18
G02 X-4 Z0 R3.4019
G17
G00 Z1
#2=[#2+#1]
M99
%
It returns...
#2=0 ( #: Variable Assignment:#2=0 )
M98 P100 L50 ( M98:Call subroutine P:Line Number:100 L:Number of repititions:50 )
M30 ( M30:End program...rewind stop )
% ( %: Start or end of program )
o100 ( O:Subroutine label number:100 )
#1=.100 ( #: Variable Assignment:#1=.100 )
G00 X0 Y#2 Z1 ( G00:Rapid positioning #: Variable Assignment:#2 Z1 )
G01 Z0 F20 ( G01:Linear interpolation F:Feedrate:20 )
G18 ( G18:X-Z plane sel )
G02 X-4 Z0 R3.4019 ( G02:CW circular interpolation R:Arc radius:3.4019 )
G17 ( G17:X-Y plane sel )
G00 Z1 ( G00:Rapid positioning )
#2=[#2+#1] ( #: Variable Assignment:#2=[#2+#1] )
M99 ( M99:Return from subroutine )
% ( %: Start or end of program )
-
Wow thanks for the commenter. That is quite helpful.
-
Thanks....
It is not perfect. There are a lot of flavors of G-Code. I was thinking of adding a "dialect" option so you could get better results for particular implementations like Mach3. Things like Mach's M10P1 don't really mean anything in regular G-Code, but mean a lot to some Mach users.
-
yes, Thanks thats neat..
-
The G-code commentor is great. Do you mind if I post some links?
Brett
-
Sure,
Link away. I'm glad that old page is finally getting some users.