You are on page 1of 21

Autodesk HSM – Weekly Technical Webinar

G-Code 101
With the Mike Mattera
Mike Mattera
Content Experience Developer
mike.mattera@autodesk.com
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

• Origins of NC Programming
• Alpha Numeric Codes
• Basic Motion Codes
• “Canned” Motion Codes
• Modal Conditions & Code Groups
• Arc/Circular Move Formats
• What is a Postprocessor
• Basic Requirements For Writing Postprocessors
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 Origins of NC/CNC Programming


 Early 1950’s Using Punched Cards & Paper Tape
 Faster/Better Jet Engines & Airframe Components
 Air Force Standardized Code Formats In 1956
 The First Programming System (APT) in 1957
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 G Code Programming – Why Alpha Numeric Codes?


 N#### G## X## Y## Z## F## S#### T## M##
 A simple way to define motion/function
 Declare a position
 Set a value
 Select an item
 Switch something on/off
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 G Code & Machine Motion


 There are 3 basic motion types
 Linear move to an XYZ position as fast as possible
 Linear move to an XYZ position at a defined feedrate
 Circular move to a position at a defined federate
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 G Code & Machine Motion


 Linear Rapid – G00 (G zero zero, not the letter O)
 Linear Feed – G01
 Since there are two directions for a circle
 Circular CW – G02
 Circular CCW – G03
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 Typical CNC Machine Codes


 N#### G## X## Y## Z## F## S#### T## M##
 Generally defines motion – G##
 Declare a position - X## Y## Z##
 Set a value – F## - Feedrate or S### - Spindle Speed
 Select an item – T## - Tool Selection
 Switch something on/off - M## - Miscellaneous Functions
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 Typical CNC Machine Codes


 N#### G## X## Y## Z## F## S#### T## M##
 Generally defines motion – G##
 Declare a position - X## Y## Z##
 Set a value – F## - Feedrate or S### - Spindle Speed
 Select an item – T## - Tool Selection
 Switch something on/off - M## - Miscellaneous Functions
 G01 X1. Y1. F20. T01 M03 S500
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 Miscellaneous Codes – M Functions


M00 Program stop
M01 Optional program stop
M02 End of program
M03 Spindle on clockwise
M04 Spindle on counterclockwise
M05 Spindle stop
M06 Tool change
M08 Flood Coolant on
M09 Coolant off
M30 End of program / Return to start
M41 Spindle Low Gear Range
M42 Spindle Hi Gear Range
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 Modality – If it’s on, It stays on till you turn it off


 Only 1 function can be active at any given time
 Select a new function to deactivate the previous function
 Linear Rapid – G00
 Linear Feed – G01
 Circular CW – G02
 Circular CCW – G03
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 Modality – If it’s on, It stays on till you turn it off


 Only 1 function can be active at any given time
 Select a new function to deactivate the previous function
 Linear Rapid – G00 G00 X1 Y1
X2 Y2
 Linear Feed – G01 G01 X3
 Circular CW – G02 Y3
X2
 Circular CCW – G03 Y2
G00 X1 Y1
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 Canned Cycles - Drilling (G80 thru G89)


 Incorporates all the motion of a common task
Basic Drill Peck Drill Counter Bore Tapping
G81 G83 G82 G84
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 Canned Cycles - Drilling (G80 thru G89)


 Drilling is Modal
 Once activated, only the hole
locations need to be specified

G81 X1.5 Y-1.5. R.1 Z-.25 F12.0


X3.5 Y-2.5
X2.5
G80
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 Code Groups
 Allows you to have multiple codes on a single line
 But only 1 code from each group per line
The modal groups for G-codes are:
Group 1 = {G00, G01, G02, G03, G80, G81, G82, G84, G85, G86, G87, G88, G89} Motion
Group 2 = {G17, G18, G19} Plane Selection (XY, YZ, ZX)
Group 3 = {G90, G91} Absolute / Incremental mode
Group 5 = {G93, G94} Feed Rate Mode
Group 6 = {G20, G21} Units (Inches / Millimeters)
Group 7 = {G40, G41, G42} Cutter Radius Compensation (CRC)
Group 8 = {G43, G49} Tool Length Offset (TLO)
Group 10 = {G98, G99} Return Mode in Canned Cycles
Group 12 = {G54. G55, G56, G57, G58, G59, G59.xxx} Work Coordinate System Selection (WCS)
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 All CNC Code Is Not “G Code”


 All machines require the same information
 Not all information looks the same
 That’s why we have 1000 Postprocessor
in the library
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 Creating an Arc/Circular move


 Arc Start Point (Green Dot)
 Arc Cutting Direction – CW/CCW (Blue Arrows)
 Arc End Point (Red Dot)
 Arc Center Point or Radius Size (Black Cross/Arrows)
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 Creating an Arc/Circular move


Fanuc/Haas Fanuc/Haas
G2 X4.5 Y-1.0 I0.0 J-1.5 F7.5 G2 X4.5 Y-1.0 R-1.0 F7.5

Anilam 1100/3300
Arc Cw X4.500 Y-1.000 XCenter 3.000 YCenter -1.000 Feed 7.5
or
Arc Cw X4.500 Y-1.000 Radius 1.000 Feed 7.5

Heidenhain Heidenhain Heidenhain


CC X3.0 Y-1.0 CC X3.0 Y-1.0 CR X3.0 Y-1.0 DR- R1. F7.5
CW X4.5 Y-1.0 F7.5 CP PA90 DR- F7.5
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 Postprocessors
A Postprocessor is a translator.
It translates the image of the toolpath on your screen into
the language for a specific machine/control.
O0001 N38 X3.0
N10 G20 G90 G94 G17 N40 G2 X4.5 Y-1.0 I0.0 J-1.5 F7.5
N10 G40 G80 N42 G1 Y-3.5 F6.0
N12 G28 G91 Z0 H0 N44 X4.0
N14 G28 X0 Y0 N46 G3 X3.5 Y-4.0 I0.0 J-0.5 F4.5
N18 T01 M06 (1.0 End Mill) N48 G1 Y-4.5 F6.0
N24 S1200 M3 N50 X0.75
N26 G0 X-0.75 Y0.5 N52 G2 X-0.5 Y-3.25 I0.0 J1.25 F7.5
N28 G43 H01 Z0.1 H01 M9 N54 G1 Y0.125 F6.0
N30 Z0.1 N58 G0 Z0.1
N32 X-0.625 N60 G1 Y0.75 Z-1.0 F20.0
N34 G94 G1 Z-1.0 F20.0 N62 M30
N36 X-0.125 F6.0 %
 HSM Weekly Webinar
 G - Code & Machine Motion
 Mike Mattera - Content Experience Developer (CXD) - CAM

 Creating a Postprocessor – Requirements


 Machine mfg. Name & Model, Control Name & Model
 Type, # of Axis, Axis designations (Vertical Mill, 4 Axis, X,Y,Z,A)

 List of the G-Codes / M-Codes for the machine


 Sample Program using the Post Test Part (available to all customers)
 The sample program should have been successfully
run in the machine with no errors
HSM Weekly Webinar – G Code Programming
Mike Mattera
Content Experience Developer (CXD) – CAM - mike.mattera@autodesk.com
© 2013 Autodesk, Inc. All rights reserved.

You might also like