364
MACROS
96-8000
June 1999
All 33 local macro variables can be assigned values with arguments by using the alternate addressing method.
The following example shows how one could send two sets of coordinate locations to a macro subroutine.
Local variables #4 through #9 would be set to .0001 through .0006 respectively.
Example 3: G65 P2000 I1 J2 K3 I4 J5 K6 ;
The following letters cannot be used to pass parameters to a macro subroutine: G, L, N, O or P.
MACRO C ONSTANTS
Constants are floating point values placed in a macro expression. They can be combined with addresses A...Z
or they can stand alone when used within an expression. Examples of constants are .0001, 5.3 or -10.
MACRO V ARIABLES
There are three categories of macro variables: system variables, global variables, and local variables.
Variable Usage
All variables are referenced with a number sign (#) followed by a positive number. Examples are: #1, #101, and
#501.
Variables are decimal values that are represented as floating point numbers. If a variable has never been used,
it can take on a special undefined value. This indicates that it has not been used. A variable can be set to
undefined with the special variable #0. #0 has the value of undefined or 0.0 depending on the context it is used
in. More about this later. Indirect references to variables can be accomplished by enclosing the variable number
in brackets.
#[<expression>]
The expression is evaluated and the result becomes the variable accessed. For example:
#1=3;
#[#1]=3.5 + #1;
This sets the variable #3 to the value 6.5.
Variables can be used in place of G-code address constants where address refers to the letters A..Z.
In the block
N1 G0 G90 X1.0 Y0 ;