top of page

Safe Index Position For CNC Machining Centers

by Steve Wood, Laconia, N.H.


I recently encountered your web site and have been reading the material therein. Eventually I encountered the comments about the amount of time lost to wasted rapid moves. Absolutely correct! To that end I would like to describe a technique that has worked well for me. The question: On a horizontal milling center, how far away from the work piece must the Z axis be positioned to allow a ³safe² pallet index?


The safest Z axis position prior to a pallet index is Z home. This can result in tool being a long way from the work after the pallet index. To save time the least amount of retract must be determined.


The following code allows the machine to calculate the safe index position based on predetermined values stored in the #500 variables and the tool length variable. This runs on a Fanuc 16MB driving a Mori SH-50 Horizontal. It should work on most Macro B systems where access to system variables are allowed. The following system conditions and variables must be known.


  • 1) The distance from the spindle gage line to the center of pallet rotation when the Z axis is at the home position. This generally found in the machine specifications or in most sales brochures.

  • 2) The maximum work piece swing diameter when the pallet indexes. This is also a machine spec and also found in the sales brochures. This method also assumes that all tool offset values are positive lengths.


Store the spindle gage line distance in one of the #500 permanent common variables. I use #529. I use this value for other applications. Store the RADIUS value of the max swing diameter plus 1 inch in variable #530. Both #529 and #530 are positive values. The CNC code is:


  • G0 G90 G53 Z-[#529-#530-#5083]


Place this line in the program after the work is completed on a particular pallet side, but before any tool length cancel codes are called. The #5083 system variable contains the currently active tool length value. G53 is a one shot G code positioning the Z axis along machine coordinates. Obviously this line of code must never be a start up line. The #5083 register is set to zero on a reset or tool length cancel. The net effect is to place any tool tip 1 inch outside the max swing radius of the pallet. After the pallet indexes, position the tool as is necessary and go back to work. The 1 inch value that I use could be more or less depending on your comfort level.


To lessen the chance of an accident I recently wrote this macro. I replace the line G0 G90 G53 Z-[#539-#530-#5083] with G153 R15. To use G153, set the G code creating parameter for program O9011 to 153.

  • O9011 (TOOL RETRACT)

  • #1=#4001 (STORE CURRENT STATE OF G0/G1)

  • #3=#4003 (STORE CURRENT STATE OF G90/G91)

  • IF[#5083 EQ 0] GOTO 99 (IF TOOL LENGTH VALUE IS ZERO.DON'T DO ANYTHING)

  • IF[#18 EQ#0] GOTO 1 (CHECK FOR R VALUE)

  • IF[#18 LT 10.] THEN #3000=99(*YIKES* R VALUE IS TO SMALL )

  • (NEVER ALLOW TOOL TIP ANY CLOSER THAN 10 INCHES TO THE PALLET CENTER)

  • G0 G90 G53 Z-[#529-#18-#5083] (RETRACT TOOL TO R RADIUS POSITION)

  • GOTO 2

  • N1G0 G90 G53 Z-[#529-#530-#5083] (RETRACT TO FIXED RADIUS POINT)

  • N2 G#1 G#3 (RESTORE GRP 1 AND 3 STATES)

  • N99M99

The R parameter is used to override the fixed retract radius position. If R is not declared then then the retract position is fixed by the #530 variable.



196 views0 comments

Recent Posts

See All

Tapping on a turning center (without canned cycles)

Unless your Fanuc controlled turning center came with live tooling, it’s likely that you don’t have canned cycles (G80-G89) like those you find on machining centers. You might have G74 and G75, the mu

Can you speed up your tool change time?

Machining centers, of course, have automatic tool changing devices to automate the tool changing process. Current models boast very fast tool changing times and you may be quite satisfied with tool ch

bottom of page