Nesting macros
Macros may be used on the right side of the assignment (called nesting) in combination with the NC code. The maximum nesting depth is fixed [6]-6.40.
Nesting is displayed by a '\' character that precedes the delimiting quotation marks. A macro should always represent complete expressions of an NC block (NC command, mathematical expression, term). This excludes the possibility of a macro only represented by the address letter of an NC command without the related mathematical expression. This connection will be discussed in the next sections.
Syntax of Nesting macros |
"<macro_name>" = "<NC_code> \"< macro_name_i> \" <NC_code>" |
Attention
A macro may not be called by its own nested macro name. Only nesting of other macro names is permitted.
Programing Example
Nesting macros
Example 1:
N10 "POS_1" = "X500 Y200" (Macro definition)
N20 "MOVE1" = "G01 \"POS_1 \"F1000" (Macro definition with nesting)
N30 "MOVE1" (Macro call)
M30
Example 2:
N10 " STRING_1 " = " 5*12 " (Macro definitions)
N20 " STRING_2 " = " G \"STRING_1\" + 5 "
N30 " STRING_3 " = " M \" STRING_1\ " \" STRING_2 \" "
:
N200 " STRING_3 " (Call the nested macro)
: (Corresponds to: N200 M60 G65 )