Pro codes · Fanuc

#5001–#5066 — Position variables (Fanuc)

Position variables. Macros can read the position of the machine at any time: #5001–#5003 are the end point of the last block (work coordinates), #5021–#5023 the current machine position…

By cnccode · Updated
On this page
  1. What it does
  2. Example
  3. Tips
  4. More: macro and system variables
  5. Frequently asked questions
PropertyValue
Code#5001–#5066
ControlFanuc
TopicMacro and system variables
Syntax#5001 X, #5002 Y, #5003 Z (block end) / #5021–#5023 machine / #5041–#5043 work / #5061–#5063 skip

What it does

Macros can read the position of the machine at any time: #5001–#5003 are the end point of the last block (work coordinates), #5021–#5023 the current machine position, #5041–#5043 the current work position, #5061–#5063 the skip (probe) position. On many controls positions that change during the motion (#5021, #5041) are read with look-ahead stopped.

Example

Fanuc
#101 = #5021 (MACHINE X NOW)
#102 = #5041 (WORK X NOW)
#103 = #101 - #102 (= ACTIVE OFFSET IN X)

Tips

  • Try them in the Macro B simulator; it fills these variables as the program runs.

Options, numbers and parameters depend on the control model, the software version and the options the machine builder installed. Check the operator and parameter manual of your machine before you use a code for the first time, and run it in single block with low overrides.

Try it without a machine

The Macro B simulator runs variables, G65 calls, #3000 alarms, G10 and system variables block by block.

Open the Macro B simulator

More: macro and system variables

Frequently asked questions

What is #5001–#5066 on Fanuc?
Position variables. Macros can read the position of the machine at any time: #5001–#5003 are the end point of the last block (work coordinates), #5021–#5023 the current machine position, #5041–#5043 the current work position, #5061–#5063 the skip (probe) position. On many…
Was this page helpful?