G-code is the operational language behind every CNC machine movement. While many programmers memorize commands, professional machining depends on understanding modal behavior, restart safety, hidden motion logic, and real production risks.
This master encyclopedia focuses specifically on G-code behavior used in modern machining centers, aerospace manufacturing, and automated production environments.
────────────────────────────────────────
G00 — Rapid Positioning (The Most Misunderstood Command)
────────────────────────────────────────
Purpose:
Move axes at maximum machine speed.
Hidden Behavior:
Axes often move simultaneously.
Example risk:
G00 X200 Y100 Z50
Machine may travel diagonally.
Tool crosses clamp height before clearing part.
Professional Method:
G00 Z100.
G00 X200 Y100
Separate vertical clearance from horizontal travel.
────────────────────────────────────────
G01 — Linear Feed Motion
────────────────────────────────────────
Used for controlled cutting.
Common Mistake:
Restart without feedrate.
Example:
G01 Z-20
Without F value machine may reuse previous feedrate.
Professional rule:
Always define feedrate after restart.
────────────────────────────────────────
G02 / G03 — Circular Interpolation
────────────────────────────────────────
Used for arcs and bores.
Example:
G02 X50 Y0 I25 J0 F400
Common Error:
Wrong plane selection.
Arc fails or alarms.
Always verify:
G17 XY plane before milling arcs.
────────────────────────────────────────
G17 G18 G19 — Plane Selection
────────────────────────────────────────
Defines arc calculation geometry.
G17 = XY milling.
G18 = ZX turning style arcs.
Wrong plane produces unpredictable motion.
Safe practice:
Reset plane at program start.
────────────────────────────────────────
G28 — Machine Reference Return
────────────────────────────────────────
Unsafe Example:
G28 Z0
Machine may move toward part first.
Safe Professional Method:
G91 G28 Z0.
Incremental retract prevents collision.
────────────────────────────────────────
G40 — Cutter Compensation Cancel
────────────────────────────────────────
If compensation remains active during restart:
Tool jumps sideways.
Always cancel before positioning moves.
────────────────────────────────────────
G41 / G42 — Cutter Radius Compensation
────────────────────────────────────────
Allows dimensional correction.
Danger:
Entering compensation without lead-in.
Example crash:
Immediate side move into fixture.
Professional Entry:
Linear lead-in motion required.
────────────────────────────────────────
G43 — Tool Length Compensation
────────────────────────────────────────
Most common crash cause worldwide.
Without G43:
Machine calculates Z from spindle gauge line.
Difference can exceed 150 mm.
Safe Activation:
G43 H12 Z100.
Always activate above part.
────────────────────────────────────────
G49 — Cancel Tool Compensation
────────────────────────────────────────
Required before tool change or restart.
Prevents incorrect Z reference.
────────────────────────────────────────
G54 – G59 Work Coordinate Systems
────────────────────────────────────────
Defines part origin.
Wrong offset causes silent scrap production.
Professional Rule:
Call offset every tool section.
Never assume active state.
────────────────────────────────────────
G80 — Cancel Canned Cycle
────────────────────────────────────────
Forgotten drilling cycles cause repeated plunges.
Always cancel before motion.
Example:
G80
G00 Z100.
────────────────────────────────────────
G81 / G83 — Drilling Cycles
────────────────────────────────────────
Simplify hole machining.
Restart Risk:
Cycle continues unexpectedly.
Restart before canned cycle activation.
────────────────────────────────────────
G90 / G91 — Absolute vs Incremental Positioning
────────────────────────────────────────
Hidden crash source.
Incremental mode inherited from previous operation.
Example:
G91 X100
Moves relative unexpectedly.
Safe block always forces:
G90.
────────────────────────────────────────
G94 / G95 — Feedrate Mode
────────────────────────────────────────
Feed per minute vs feed per revolution.
Wrong mode destroys drills instantly.
Especially dangerous during tapping.
────────────────────────────────────────
G98 / G99 — Retract Plane Control
────────────────────────────────────────
Drilling retract height.
Incorrect selection collides with clamps.
Always confirm clearance plane.
────────────────────────────────────────
Professional Safe Start Block Example
────────────────────────────────────────
G90 G17 G40 G49 G80
G54
T08 M06
S5500 M03
G43 H08 Z100.
Machine logic rebuilt safely.
────────────────────────────────────────
Common G-Code Mistakes Operators Make
────────────────────────────────────────
- Restart below compensation activation.
- Forgetting G80.
- Wrong offset assumption.
- Rapid XY before Z clearance.
Most crashes originate here.
────────────────────────────────────────
Automation and Modern CNC Programming
────────────────────────────────────────
Lights-out machining requires deterministic G-code.
Programs must explicitly rebuild modal state.
AI CAM systems increasingly generate restart-safe headers automatically.
────────────────────────────────────────
Why This Encyclopedia Matters
────────────────────────────────────────
Operators search individual G-codes daily.
Bookmarkable references attract:
- training centers,
- forums,
- beginners,
- senior programmers.
Evergreen authority traffic grows continuously.
────────────────────────────────────────
Final Takeaway
────────────────────────────────────────
Mastering G-code means understanding machine state, modal behavior, and motion risk.
Professional machining begins long before the first tool touches material.
Leave a comment