Understanding G-Code

This forum is dedicated to those Hobbyists Interested in CNC machining & 3D Printing in their home shops. (Digital Read Outs are also topical, as is CAD/CAM as it relates to CNC)

Moderator: Harold_V

Post Reply
Jim_Neifert
Posts: 3
Joined: Sun Jul 31, 2005 7:02 pm
Location: BC Canada

Understanding G-Code

Post by Jim_Neifert »

Having decided to upgrade my sherline to cnc, want to try and understand G-Code and write a few small programs. Can someone point me towards a site that explains it. I have a G-Code viewer, just don't understand how they code in one line to mill a complete circle, plus a few other hunderd items I don't understand at present.
Seems this is the best site around for home cnc so thanks all who can help out.

Jim
Abbotsford, BC
JimGlass
Posts: 2281
Joined: Sat Jan 04, 2003 8:33 pm
Location: 40 Miles West of Chicago/near DeKalb
Contact:

Re: Understanding G-Code

Post by JimGlass »

Hi Jim;

I'm not an expert but I have done some G-code programming.

I'll list some G-code and explane what they mean.

G00 X0 Y0 Z2
Okay, G00 simply means go to where ever X0 Y0 Z2 is and go at full speed. All three axis with move at the same time.

G01 Z-.1 F5
G01 is a controlled speed movement.
Keep in mind Z0 is usually the surface of the workpiece in reference to the tool. Z-.1 means the tools plunges into the workpiece .100" deep at a feed rate of 5" per minute. Your machine will continue feeding a 5" per minute intill you change it some where else in the program.

G01 X1 Y0
The tool (at -.1) with now advance right from X0 Y0 to X1 Y0 at a feed rate of 5" per minute. The Y axis did not move.

G01 Y-1
Tool moves forward 1" at 5" per minute. Now the tool is at
X1 Y-1 Z-.1

G02 X2 Y-1 R.5
Move tool to right but swing a .5 radius to get to X2 Y-1
G02 is a clockwise (i think) movement.
G03 is a counterclockwise movement.

There are also "I" and "J" commands for radius moves but so far have no experience with them.
Jim
Tool & Die Maker/Electrician, Retired 2007

So much to learn and so little time.

www.outbackmachineshop.com
Jim_Neifert
Posts: 3
Joined: Sun Jul 31, 2005 7:02 pm
Location: BC Canada

Re: Understanding G-Code

Post by Jim_Neifert »

Thanks Jim
Its a place for me to start. When I find time will keep searching the net for something that helps out learning it. The software that I have will write g-code just have no idea what it all means. You might not be an expert but what you gave me helps alot.
Thanks again
Jim
Abbotsford, BC
JimGlass
Posts: 2281
Joined: Sat Jan 04, 2003 8:33 pm
Location: 40 Miles West of Chicago/near DeKalb
Contact:

Re: Understanding G-Code

Post by JimGlass »

Jim:

I would like to learn the software that writes G code. Thinking about taking a college course this fall. I'm also in the market for CNC mill.

I wrote G-code for my home built CNC machines. Good way to learn, writing the G-code then watching the results.
Jim
Tool & Die Maker/Electrician, Retired 2007

So much to learn and so little time.

www.outbackmachineshop.com
spfsnc

I , J , K

Post by spfsnc »

HI ,

I USE IN THIS WAY I J K LETTER IN CIRCLE/ARC G CODE PROGRAM

XY AXIS

_SIMPLE WAY
THE CENTRE OF THE COMPLETE CICLE IS X0 Y0 (RELATIVE ZERO G54 )

_1st EVENT WORKING INSIDE CIRCLE

G00 X0 Y0
G01 Z-........
G01 X10 Y0 F1 (MOVE FROM X0 TO X10 Y0 ISN`T IMPORTANT HERE)
G02 I-10 ( THE TOOL PATH START AT X10 LIKE 3:00AM RUN FOR
360 DEGREES CW AND STOP AT X10 )

_2nd EVENT WORKING OUTSIDE CIRCLE

G00 X20 Y0
G01 Z-........
G01 X10 Y0 F1 (MOVE FROM X20 TO X10 Y0 ISN`T IMPORTANT HERE)
G02 I-10 ( THE TOOL PATH START AT X10 LIKE 3:00AM RUN FOR
360 DEGREES CW AND STOP AT X10 )


_COMPLEX WAY
THE CENTRE OF THE ARC IS X0 Y0 (RELATIVE ZERO G54 )

_ EVENT WORKING INSIDE/OUTSIDE ARC

G00 X1 Y3
G01 Z-........
G02 X1 Y-3 I-1 J-3 ( THE TOOL PATH START AT X1 Y3 THEN STOP
AT X1 Y-3 "THE CENTER IS X0 Y0 RELATIVE G54"

_NOTE- EVERY FINAL POINT OF THE ARC CAN BE USED
BUT THE I J MUST BE THE SAME NUMBER AT START POINT
WITH SIGN CHANGED
IF THE X/Y AT START WAS +/- THE I/J MUST -/+

WHEN THE CIRCLE/ARC IS ON XZ AXIS OR YZ AXIS
K LETTER MUST BE USED

CIAO FROM ITALY

DOMENICO
Michael_Moore
Posts: 239
Joined: Wed Sep 29, 2004 1:13 pm
Location: San Francisco, CA

Post by Michael_Moore »

You could do worse than to read the intro to CNC/G code that is on the Sherline web site:

http://www.sherline.com/CNCinstructions.htm

cheers,
Michael
Guest

Post by Guest »

Try typing in 'G-code' into a search engine or similar searches, but even at that you need to look at the manual for your control because the codes will vary from control to control & even from that to specific machine builders.
gglines

Post by gglines »

I would buy a book(s), or your library may have one. I would recommend CNC PROGRAMMING, PRINCIPLES AND APPLICATIONS by Mike Mattson. ISBN 0-7668-1888-8.

Great book for teaching G-Code. I refer to it whenever I'm writing a program. Some other G-Code books are just lists of the various codes with examples. This one is a teaching text. Probably $60. Amazon will have it.
Post Reply