0% found this document useful (0 votes)
45 views1 page

G-Code Cheat Sheet of Common Commands

AWESDVSD

Uploaded by

s.baghaei
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views1 page

G-Code Cheat Sheet of Common Commands

AWESDVSD

Uploaded by

s.baghaei
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Connect and transact with thousands of top North American companies today

0
Find Suppliers Find Buyers Industry Insights About Claim Your Company Saved Suppliers Login Register

Insights Articles and White Papers by Keyword Industry Insights Topics White Papers Submit Content Subscribe Podcast

Guides
G-Code Cheat Sheet of Common Commands
Share: g a b d G-code is the language used to direct CNC machines. Combined with M code and a number of other Related Resources
letter-designated “words,” turning and machining centers, as well as other CNC equipment, can be
used to manufacture parts with little operator intervention. The majority of these codes are self- Daily Bite
explanatory but some require some amplification to understand their behavior. This article will sift Pentagon Spends Millions on
Language for Military Drones
through some of these common G and M codes.

G-code was originally developed to control X-Y plotters and was, for all intents and purposes, a two- Daily Bite

axis program. Despite its limitations, it is still used today for many CNC machines even as these Why Do We Think Garlic Keeps
Vampires Away?
machines have grown increasingly more sophisticated. Modern CAM programs can generate G-code
behind the scenes; however, knowledge of the basics of G-code can be helpful in understanding the Daily Bite
way in which these machines operate. G-code may still be entered manually as well through an Engineers, Contractors Build
operator interface. Sculptures Out of Canned Food

The standard for G-code is EIA-274-D. Manufactures will generally adhere to this standard but Daily Bite
variations have developed over the years from manufacturer to manufacturer. Always consult the Scientists Discover the Heaviest
Animal Ever
maker’s manual for a particular machine to ensure the correct application of the code.
Daily Bite
More information on G and M codes may be found in other related articles in this series listed at the
Fruit Flies Produce Promising
end of this article.
Antibiotic

Route commands
G00 means rapid move and is used to bring cutting tools to a start position in the fastest time
Browse by Category
possible. The move may or may not be interpolated, depending on the machine. The format is
Adhesives & Sealants
G00XxYyZz.
Automation & Electronics
-->Interested in CNC Machining Services? Try out Xometry's Instant Quoting Engine℠ to make your
project come to life. Free shipping in the USA. Calculators
G01 means linear cutting and the tool moves to the specified coordinates at the set speed along an
Chemicals
interpolated path. That is, for a given X, Y, and Z coordinate, the machine will move all axes
simultaneously. The format is G01XxYyZz. Custom Manufacturing & Fabricating

G02 and G03 produce clockwise and counterclockwise arcs, again interpolated. In addition to the end View More
points of the arc, an arc center is specified. The format is G02XxYyIiJj where I and J are the
coordinates of the center point in the X-Y plane. Moves in the other planes are similarly constructed.

Canned cycles
Canned, or fixed, programs for drilling distinguish between straight in and out, those that dwell at the
hole bottom, and those that peck the hole with a series of intermediate retractions (for chip breaking).
G81 is the code for the standard cycle, G82 pauses at the bottom of the hole, and G83 pecks through
the hole cycle. A typical format is G83XxYyZtZfZs, where t represents the total Z travel, f, the first
peck increment, and s, the subsequent peck increments. Multiple holes are drilled using a single
command and separate lines for each coordinate pair, followed by G80 which cancels the drilling
cycle. Retraction from the hole is automatically carried out at a rapid speed. Similar canned cycles
handle boring, tapping, etc.

Routines that produce several identically tapped holes can be programmed through cut-and-paste to
carry identical coordinates to chamfering, drilling, and tapping operations with only minor
modifications necessary in the code.

A number of similar cycles are available as non-modal, one-shot routines that do not require an end
command. The majority of G-code commands are modal – they remain in effect until another
command overrides the current one. Modal commands are grouped so that more than one may
appear on any line, but not from the same group. For example, the units setting commands G20 and
G21 would not be used on the same line.

Absolute/Incremental coordinates
Absolute motion is the typical default setting. Moves are made relative to the machine origin or to
another origin assigned by the G92 command. G91 changes the motion to incremental coordinates so
that moves are made from the current position with no regard to machine origin. G90 returns the
program to absolute motion.

Tool compensation
Cutter radius offsets G41 and G42 account for the geometry of the tool and permit the programming
of part dimensions, for which the program determines the path the tool takes based on the tool
dimensions. It allows for tools of different radii to be used by the same program. Likewise, CNC lathes
make use of tool-nose radius compensation. This recognizes that turning tools only come to points in
theory, but in reality, have finite dimensions at the interface between the cutting tool and the
workpiece.

Setup commands
Feed rate is set with the address Fn, where n represents the feed rate/minute or feed rate/rev.
Likewise, address S pertains to spindle speed. T calls a particular tool after a tool change command.

Although machine manufacturers vary their assignments of M codes, some are fairly standardized,
including:

M00 and M01 for program stop and optional program stop
M02 End of program
M03, M04, and M05 for spindle control
M06 Tool change
M07 and M08 for coolant on/off
M30 End of the program/return to start
M41 and M42 for spindle gear range

Other typical M codes launch and end subprograms, usually M98 for starting a subroutine and M99
for returning to the main program. Subprograms are designated with the letter P and an L specifies the
number of times the subprogram should run.

Macro variables are called up with an X followed by #n, where n represents the address of the stored
variable, such as #123. Macros can be used to change dimensions on part families of identical shapes
but with smaller or larger sizes.

Miscellany
Individual line numbers may be called out with an N although numbering lines is not necessary. The
recommended practice in numbering program lines is to increment each line by five to allow the
insertion of new lines into a program without losing the sequence. Comments may be added to any
line with opening and closing parentheses.

Summary
This article presented a few tips for understanding how G-code is used in CNC programs and the
format for the common types of commands. For more information on related products, consult our
other guides or visit the Thomas Supplier Discovery Platform to locate potential sources of supply or
view details on specific products.

Other CNC Programming Articles


An Introduction to G-Code and CNC Programming
List of Common G-Code Commands and What they Mean
An Introduction to M-Code and CNC Programming
Examples of G-Code for Common CNC Functions
Subprograms, Macros and Parametric Programming for CNC Machining

Share

Find Suppliers, Insights, Tools and More...


Become part of North America's largest and most active network of B2B buyers and industrial/commercial suppliers.

Select From Over 500,000 Receive Daily Search Over Download 2D & 3D
Industrial Suppliers Industry Updates 6 Million Products CAD Models

Start Sourcing Suppliers Claim Your Company Profile

Find Suppliers Industry Insights For Business Site Maps About

Supplier Discovery Topics Advertise Categories Thomas Brand Center


Product Catalogs Thomas Index (TMX) Content & Data Services Featured Companies Careers
CAD Daily Bite Marketing Services Featured Categories Press Room
Diversity Guides Thomasnet Reviews Featured Products Sign Up
Instant Quotes White Papers Claim Your Company Profile Featured Catalogs Sign In
Buyer & Engineer Reviews Certification Glossary Thomas WebTrax Contact
Subscribe Events & Webinars Help Center

Industry Update Podcast

Copyright© 2023 Thomas Publishing Company. All Rights Reserved. See Terms and Conditions, Privacy Statement and California Do Not Track Notice. Website Last Modified November 1, 2023.
Thomas Register® and Thomas Regional® are part of Thomasnet.com. Thomasnet Is A Registered Trademark Of Thomas Publishing Company.

You might also like