GreatLight CNC Machining Factory logo
CNC Machining
Rapid Prototyping
Materials
Industries
News
About GL

Get Instant Quote

CNC control basics

What Does Machine Lock Do on a CNC?

This function holds the axes or the spindle while the control still executes the program, so a programmer can watch the logic without cutting metal. Below we explain each lock mode, what it actually freezes, and where the feature stops being useful. Written for engineers and programmers who need to judge when a dry run is enough and when it is not.

Axis lock vs spindle lockDry run without motion5-axis collision checks
machine lock on a cnc
Definition

What the lock switch actually holds

A lock function lets the program run while one or more physical outputs are held. On a Fanuc-style control you will see separate switches for axis lock, spindle lock, and sometimes turret or magazine lock. Flip one on and the control still reads every block, updates its position registers, and advances the program pointer. What changes is that the servo command is suppressed or the spindle command is ignored.

The distinction matters. A locked axis does not move, but the control behaves as if it did. That is why the position display climbs while the table sits still, and why a program that would crash into a fixture can finish a dry run without a scratch. The control has no idea anything is wrong. It is only doing arithmetic.

Most builders wire axis lock to all linear and rotary servos at once, but some let you lock X, Y, Z, and the rotary independently. On a 5-axis machine that granularity is worth knowing, because locking the rotary while the linear axes move is a quick way to check clearance on the trunnion.

The switch does not touch offset tables, work coordinates, or cutter compensation. Those stay live. If your program is wrong by 2 mm, a locked run will not tell you. It only tells you the code is syntactically executable and the tool changes work.

  • 1
    Axis lockServo output suppressed; position display still moves.
  • 2
    Spindle lockS command is ignored; the spindle stays at zero rpm.
  • 3
    Turret / magazine lockTool change sequence runs without rotating the carousel.
  • 4
    Not affectedOffsets, work coordinates, and cutter comp stay active.
Why it matters

Why a locked run catches problems a simulation cannot

CAM simulation verifies the toolpath, not the machine. It knows the stock model and the holder geometry you entered, and nothing else. A locked run exercises the real control: its look-ahead buffer, its tool change macros, its M-code sequence, and its alarm handling. Those are the places where a program that looks perfect on screen stalls at the machine.

The gap shows up in three common ways. Macro variables that were never set. A tool number that the magazine does not carry. A spindle warm-up routine that expects a specific M-code order. None of these appear in a CAM verification pass, and all of them stop a real cut.

There is also the cost argument. A locked run on a titanium or Inconel blank costs cycle time and nothing else. A crash costs a holder, an insert pack, a fixture, and possibly a spindle. On a 4,000 mm gantry part, the scrap value alone can exceed the machine-hour rate for the whole program.

The catch is that a locked run proves the code runs, not that the geometry is right. Treat it as one gate in a sequence, not as the final check before you press cycle start on a loaded vise.

  • 1
    CatchesMacro errors, missing tools, M-code order, alarm handling.
  • 2
    MissesWrong offsets, wrong stock size, holder collisions.
Modes

Which lock mode to use, and when

Axis lock is the default for a first dry run. All servos are held, the spindle is typically also inhibited on most controls, and you watch the program pointer and the block display. This is the fastest way to confirm that every tool is called, every offset exists, and the program reaches M30 without an alarm.

Spindle lock alone is useful when you want to verify axis motion and tool change positions without spinning a tool. The axes move through the actual path at feed rate. On a 5-axis machine this is how you check that the trunnion and the head do not interfere at the extremes of the rotary travel. Watch the clearance at the A and C limits, not at the middle of the path.

Single-block plus axis lock is the combination we use most in our own shop. Step block by block through the first tool, then switch to continuous locked run for the rest. It catches a bad Z clearance or a rapid move into the fixture before it becomes an insurance claim.

Do not use a locked run as a substitute for a first-article check. If the program is wrong by a tool radius, the locked run will finish clean and the first part will be scrap. The lock only proves the control can execute the code.

  • 1
    Axis lockFirst dry run. Confirm tools, offsets, and program end.
  • 2
    Spindle lock onlyVerify motion path and rotary clearance at travel limits.
  • 3
    Single block + axis lockStep the first tool, then run continuous.
  • 4
    Never rely on it forGeometric accuracy or first-article sign-off.
5-axis

Machine lock on a CNC with rotary axes

On a 3-axis mill, a locked run mostly checks the program skeleton. On a simultaneous 5-axis machine, the stakes go up. The rotary axes move the part or the head into space that the CAM model may not represent faithfully. A locked run with the rotary live and the linear axes held tells you almost nothing, because the geometry depends on both moving together.

The useful check on a 5-axis machine is to run the program with axis lock on and watch the rotary position registers. If the C-axis is asked to rotate 360 degrees in a single block while the tool is at full extension, the control will accept it. The collision will only show up when the linear axes are also live. That is a programming error, not a control error, and no lock mode will catch it.

What a locked run does catch on a 5-axis machine is the tool change sequence and the retract path. Many crashes happen not in the cut but in the move to the tool change position, where the head has to clear the trunnion. A locked run through the tool change, with the rotary live and the linear axes held, will show you the commanded positions. Compare them against the machine's travel envelope.

We run 16 simultaneous 5-axis centers, and the locked run is standard before the first cut on any new program. It is fast, it costs nothing but cycle time, and it has stopped more than one tool change crash.

  • 1
    Rotary live, linear heldCheck commanded rotary positions, not clearance.
  • 2
    Tool change pathThe most common place a 5-axis program crashes.
  • 3
    Not a substitute forFull machine simulation with holder geometry.
Limits

When a locked run will not save you

A locked run cannot detect a wrong work offset. If G54 is set to the wrong corner of the vise, the control will happily run the whole program with the axes held. The position display will look correct because it is showing the commanded position, not the physical one. The first time you see the error is when the tool is live and the part is loaded.

It also cannot detect a holder collision. The control has no model of the holder, the fixture, or the stock. It only knows the machine's own travel limits. If your tool holder is 20 mm longer than the one in the CAM model, the locked run will not care. The crash happens on the real machine, with real hardware.

Thermal growth and deflection are invisible to a locked run for the same reason. A locked run is a logic check, not a physical check. It belongs early in the setup sequence, before the first part is loaded, not at the end as a final sign-off.

One more limit: some controls disable certain M-codes when axis lock is on. Coolant, through-spindle air, and chip conveyor commands may be ignored. If your program relies on a specific M-code sequence to clear chips between tools, the locked run will not exercise it. Check the machine builder's manual for the exact list on your control.

  • 1
    Wrong work offsetPosition display shows commanded, not physical, position.
  • 2
    Holder collisionThe control has no holder or fixture geometry.
  • 3
    Thermal and deflectionNo physical cutting force is applied during a locked run.
  • 4
    Suppressed M-codesCoolant and conveyor commands may be ignored.
Comparison

Machine lock vs other dry-run methods

Each method proves something different. None of them replaces a first-article inspection.

MethodWhat movesWhat it provesWhat it misses
Axis lockNothingCode executes to M30Offsets, stock size, collisions
Spindle lock onlyLinear and rotary axesMotion path and rotary limitsSpindle load and chatter
Single blockEverythingBlock-by-block logicNothing, but it is slow
Distance-to-goEverythingRemaining travel and clearanceProgram syntax errors
CAM simulationNothing (on screen)Toolpath geometryControl macros and M-codes
Dry run at safe ZEverything, above the partFixture clearance at heightCutting forces and deflection

The verdict

Use axis lock for a fast logic check on every new program, and use spindle lock with live axes when you need to verify rotary clearance on a 5-axis job. If the part is expensive or the geometry is tight, a locked run is not enough on its own. Pair it with a full machine simulation and a first-article inspection before you commit a blank.

FAQs

Common questions

Does axis lock stop the spindle too?

On most Fanuc-style controls, axis lock and spindle lock are separate switches. Axis lock holds the servos, but the spindle may still be commanded to rotate unless you also enable spindle lock or the machine builder has linked the two.

Check the ladder or the builder's manual for your specific control. The behavior varies between machine models, even within the same control family.

Can I run a locked program at full rapid speed?

Yes, and many programmers do, because the axes are not moving and there is no mechanical risk. The control will process the blocks at the rate you set with the feed override.

If you are also checking the tool change sequence with the rotary live, drop the override. A rotary axis that is actually moving can still collide with a fixture even when the linear axes are held.

Does machine lock change the work offset?

No. The offset tables, work coordinates, and cutter compensation are unaffected. The control uses them exactly as it would during a live cut.

That is also why a locked run cannot catch a wrong offset. The control has no way to know the physical part is not where the offset says it is.

Is a locked run the same as a dry run?

Not quite. A dry run usually means the program runs with the axes moving but the tool kept clear of the part, often by raising Z or using a distance-to-go display.

A locked run holds the axes entirely. A dry run proves the motion path and the clearance. A locked run proves the code executes. They answer different questions, and a careful setup uses both.

Why did my locked run finish without an alarm but the real cut crashed?

The most common reasons are a wrong work offset, a holder that is longer than the one in the CAM model, or a fixture that was moved after the program was written.

A locked run has no model of the physical setup. It checks the code, not the geometry. Add a full machine simulation with accurate holder and fixture models before the first cut.

Do all CNC machines have a machine lock function?

Most production controls from Fanuc, Siemens, Mitsubishi, and Heidenhain include some form of axis lock or machine lock. The name and the switch layout vary.

Older or entry-level controls may only offer a distance-to-go display or a single-block mode. In that case, use a dry run at safe Z as the closest equivalent.

Send us your next 5-axis program

We run 127 high-precision CNC machines, including 16 simultaneous 5-axis centers, with 100% inspection before shipment. Upload your files and get a quotation with a free DFM analysis within 12 hours.

12-hour quote100% inspectionNDA on request

Follow us

More from the shop floor

We publish setup notes, tooling trials and inspection data from the factory floor.

FacebookTikTokYouTubeLinkedInInstagramThreadsPinterest

Trusted by engineers and manufacturers worldwide

Tesla Ford Motor Company BYD Auto Denso Magna International Boeing Airbus Medtronic KUKA FANUC