Having worked with FANUC 0i-MF and 30i-B controls for six years in aerospace manufacturing, I've compiled this definitive reference for programmers and operators. Unlike generic guides, this focuses on real-world applications and common pitfalls.
| G-Code | Function | Group | Notes |
|---|---|---|---|
G00 |
Rapid Positioning | 01 | Non-interpolated, use for positioning only |
G01 |
Linear Interpolation | 01 | Requires feed rate (F) |
G02/G03 |
Circular Interpolation | 01 | Clockwise/Counterclockwise |
G04 |
Dwell | 00 | G04 X1.0 (dwell 1 second) |
G17/G18/G19 |
Plane Selection | 02 | XY/ZX/YZ plane |
G20/G21 |
Unit Selection | 06 | Inches (G20) / Metric (G21) |
G28 |
Return to Reference | 00 | G28 G91 Z0 (safe Z return) |
G40/G41/G42 |
Cutter Compensation | 07 | Cancel/Left/Right compensation |
G43/G49 |
Tool Length Compensation | 08 | Apply/Cancel tool length |
G54-G59 |
Work Offsets | 12 | Work coordinate systems |
G91 G28 Z0 ; Return Z to home
M05 ; Spindle stop
M09 ; Coolant off
G00 G90 G54 X0 Y0 ; Move to safe position
M06 T02 ; Tool change to tool 2
M03 S2500 ; Spindle on clockwise at 2500 RPM
G43 H02 Z1.0 ; Apply tool length offset
FANUC's macro B capability allows parameterized programming. Here's a real example I use for bolt hole patterns:
#100 = 4 ; Number of holes
#101 = 50.0 ; Radius
#102 = 0 ; Starting angle
#103 = 90 ; Angle increment (360/#100)
#104 = 1 ; Counter
N10 WHILE [#104 LE #100] DO1
#105 = #101 * COS[#102]
#106 = #101 * SIN[#102]
G81 X#105 Y#106 Z-10.0 R1.0 F15.0
#102 = #102 + #103
#104 = #104 + 1
END1
G80
1. Alarm PS0001 "Program Error": Usually caused by missing decimal points in feed rates or coordinates. Always use F100.0 not F100 when in metric mode.
2. Cutter Comp Alarms (PS0041): Ensure lead-in move is > tool radius and in correct plane (G17). Use G01 approach, never G00.
3. Tool Length Comp Cancel: Always cancel G43 before M30. Use G49 or G28 G91 Z0 to avoid crashes.
FANUC 30i-B supports tool life counting via system variables:
#3000 = Tool life status (0=normal, 1=warning, 2=expired)#3001-#3020 = Life counter for tools 1-20Further Reading: Check out our FANUC Macro B Programming Guide for advanced techniques.