A “safe start block” is the single highest-ROI habit in CNC programming because it prevents the most common (and most expensive) crashes caused by leftover modal states from the previous job. Modal G-codes stay active until changed—meaning your program can inherit the last operator’s plane, feed mode, compensation state, cycle state, coordinate mode, or even the last work offset. A professional safe start block resets critical modes before any cutting happens, then moves the machine in a predictable, collision-resistant sequence. This guide provides crash-proof templates and real, shop-ready start blocks for Fanuc, Haas, and Siemens, plus proven safety patterns for tool changes, probing, and first-move protection.
SECTION 1 — What a Safe Start Block Must Control (Non-Negotiable)
A safe start block should explicitly define these modes so nothing is inherited: units (mm/inch), distance mode (absolute/incremental), plane selection, feed mode, cutter comp, tool length comp, canned cycles, coordinate system/work offset selection, spindle state, coolant state, and (when applicable) high-speed/smoothing modes. The big three that prevent immediate disasters are: cancel cutter comp (G40), cancel tool length comp (G49 on many controls), and cancel canned cycles (G80). After that, define plane (G17), absolute mode (G90), feed per minute (G94), and units (G21/G20). Then choose a safe retract strategy before any XY movement.
SECTION 2 — Fanuc “Gold Standard” Safe Start Template (Milling)
Use this at the top of every program (and at every restart point) to eliminate inherited modal states:
(FANUC SAFE START — MILL)
G21 G17 G90 G94
G40 G49 G80
G54
(Optional: Cancel rotation/transform modes if your machine uses them)
(G69) (Cancel coordinate rotation if used)
(G15 H0) (Cancel polar mode on controls that use it)
Critical note: do not assume Z is safe. The safest next step is a controlled Z retract in machine coordinates or a proven home routine BEFORE any XY travel.
SECTION 3 — Fanuc Crash-Proof “Z-First” Retract Patterns (Choose One)
Pattern A (Most common, simple, very safe on many Fanuc mills):
G91
G28 Z0.
G90
Why it works: in incremental mode, Z0 is a safe intermediate point, then the control goes to machine home. After homing Z, return to absolute.
Pattern B (Machine-coordinate retract without homing — safest when homing is slow or restricted):
G53 Z0.
This moves Z to machine Z0 directly (machine coordinate), ignoring work offsets. Only use if your machine’s Z0 is guaranteed safe.
Pattern C (Use a secondary home for automation clearance):
G91
G30 P2 Z0.
G90
This is common in robot cells and pallet systems where P2 is a “robot clear” position.
SECTION 4 — Fanuc Tool Change Block (Safe Sequence)
A professional tool change sequence retracts Z first, then moves XY if needed, then calls the tool:
(TOOL CHANGE SAFE SEQUENCE — FANUC)
G91
G28 Z0.
G90
T12 M06
(Spindle/coolant state should be explicit)
M05
M09
(Apply length compensation only after tool change)
G43 H12 Z100.
Never turn on G43 before the tool change is complete. Never move XY at a low Z if you don’t explicitly know clearance.
SECTION 5 — Haas Safe Start Template (Milling)
Haas is modal in the same way; use an explicit reset:
(HAAS SAFE START — MILL)
G17 G40 G49 G80 G90
G94 G20 (or G21)
G54
M05
M09
Haas operators often rely on RESET, but programs should still be self-contained. For safe retraction on Haas, many shops prefer G53 moves:
G53 Z0.
G53 X0. Y0. (Only if X0/Y0 is known safe on your machine)
SECTION 6 — Siemens Safe Start Template (Conceptual, Shop-Ready)
Siemens syntax varies by shop standard, but the concept is identical: explicitly set plane, distance mode, feed mode, cancel cycles/compensation, then safe retract. A practical Siemens start pattern typically includes resetting tool length/comp states and ensuring the correct work offset is active (e.g., G54 equivalent or workpiece coordinate system selection used in your environment). Siemens users often rely on standardized “start-up” subroutines—make yours explicit and consistent.
SECTION 7 — The #1 Crash Pattern: XY Move Before Z Clearance
The most common real crash is a rapid XY move at a low Z because the last job left the spindle near the part. Your program starts, immediately does G00 X… Y… and hits a clamp, vise jaw, probe, or the part. The fix is simple: always retract Z safely before any XY repositioning. Your program’s first motion should almost always be a safe Z move (home, G53, or a proven clearance height).
SECTION 8 — The “G00 Z-100” Trap (Why It’s Dangerous)
“G00 Z-100” is only safe if you know exactly which coordinate system and sign convention you are in at that moment. Common failure modes:
1) Wrong work offset active (G55 when you expected G54) sends Z to an unexpected physical location.
2) Incremental mode (G91) still active makes Z-100 a relative plunge, not an absolute position.
3) A tilted/rotated coordinate system (G68/G68.2, TCP, transforms) changes what “Z” means.
4) Machine is in inches (G20) and Z-100 becomes a massive move.
Professional rule: never use a large negative Z rapid unless you have explicitly set G90, units, the correct work offset, and you have verified the clearance plane physically. Prefer safe retracts (G28/G53) first, then approach in controlled feeds near the part.
SECTION 9 — A Crash-Proof Program Skeleton (Fanuc Mill Example)
This is a shop-ready structure that prevents inherited-state disasters and makes restarts safe:
%
O1001 (CRASH-PROOF SKELETON)
(SAFE START)
G21 G17 G90 G94
G40 G49 G80
G54
M05 M09
(SAFE RETRACT)
G91
G28 Z0.
G90
(TOOL CHANGE)
T6 M06
(SPINDLE/COOLANT EXPLICIT)
S12000 M03
M08
(APPLY TOOL LENGTH AFTER TOOL CHANGE)
G43 H06 Z100.
(APPROACH)
G00 X50. Y25.
G00 Z5.
(CUTTING - ALWAYS DEFINE FEED BEFORE FIRST CUT MOVE)
G01 Z-2. F300.
(… toolpath …)
(SAFE EXIT)
G00 Z50.
M09
M05
G91
G28 Z0.
G28 X0. Y0.
G90
M30
%
SECTION 10 — Pro Restart Strategy (Mid-Program Recovery Without Surprises)
If your shop restarts from a toolpath line, you must rebuild modal states before plunging back in. A professional restart block reasserts: units, plane, G90, feed mode, compensation states, correct work offset, correct tool and H/D offsets, correct spindle/coolant, then approaches from a safe Z. Never restart from a random line inside a canned cycle or with cutter comp active unless you fully understand the state required.
SECTION 11 — “Hard Stop” Safety Guards (Fanuc Macro Example)
For high-risk jobs, you can intentionally stop the machine if a required condition is not met. Example concept: if the wrong tool is loaded or spindle is not running, raise a controlled alarm. Many Fanuc systems allow custom alarms via #3000 or #3006. This is advanced, but it’s how unattended programs protect themselves. Use it to enforce: correct tool number, probing completion flags, fixture confirmation variables, or pallet ID checks.
SECTION 12 — Viral-Level Value: A Checklist You Can Turn Into a Shop Standard
If you want consistent results and fewer crashes across shifts, publish (and enforce) a shop standard:
- Every program begins with a safe start block (explicit modes).
- First motion is Z-safe retract (G28/G53/G30).
- No XY motion below a defined clearance Z.
- No tool length comp applied before tool change.
- Canned cycles always canceled (G80) before rapids or tool change.
- Cutter comp always canceled (G40) before rapids or program end.
- Units and distance mode always explicit (G21/G20, G90/G91).
- End-of-program returns to a known safe state for the next job.
This single standard prevents the majority of “mystery crashes” and makes your code portable across machines, operators, and weeks of production without relying on memory or luck.
Leave a comment