Variables may also use complex expressions

September 2, 2017 · Posted in Uncategorised 

3750 F#9 will mean G01 X3750 F3000

Variables may also use complex expressions, for ex am ple:

#i = #j + 50, where #j is a pre vi ously de fined vari able, which should be in ter preted as –

add the value of 50 to the copper busbar bending machine cur rent value of vari able con tained in #j, and store the new re sult in

vari able #i

The vari able def i ni tion #9 = 1500 in one part of the pro gram, can be used again later, usu –

ally as a sub punch machine for Head sti tuted state ment, for ex am ple, as a def i ni tion #9 = #9 * 11 in an other part of the

macro pro gram, such as a feedrate in put F#9, with the ac tual mean ing of F1650

In all ap pli ca tions, the rule for ap ply ing the vari ables is sim ple (the cur rent ex am ple is used):


Take the stored value of variable #9 and use it as the cur rent value of the pro grammed feedrate

When ex pres sions are used in a macro, they al ways eval u ate a mul ti ple math e mat i cal or log copper busbar bending machine i cal op er a tion Ex pres sions must be en closed in square brackets [ex pres sion]:

#i = #i * [#j + #k]

High Speed Drilling Machine


where the brack ets force cal cu la tion of #j+#k to be per formed first, be fore be ing mul ti plied by #i

Any com plex cal cu la tions can be nested within square brack ets, al ways fol low ing the stan dard

math e mat i cal hi er ar chy re lat ing to the or der in which cal cu la tions will be pro cessed

Usage of Variables

Macro vari ables can only be used in a pro gram if they are de fined first Once a vari able is de –

fined, it can be used by pre ced ing it with the de sired Fanuc pro gram re lated ad dress (char ac ter),

which is a cap i tal let ter of the al pha bet, such as F, S, G, M, etc

For ex am ple, the two vari ables de fined ear lier can be used in the body of a pro gram:

Copyright 2005, Industrial Press Inc, New York, NY – wwwindustrialpresscom

FANUC CNC Custom Macros



2 Variables declared (defined) :

#19 = 1200

Spindle speed defined

#9 = 1500

Cutting feedrate

Vari ables must be de clared (de fined) be fore they can be used, as the ex am ple shows


Leave a Reply