Macroprogramming (# INIT MACRO TAB)
Macros permit the assignment of an alias name (macro name) to an executable NC code (macro content). The macro content may consist of arithmetical expressions and NC commands. The related NC code is executed whenever the corresponding macro name (macro call) is specified.
Macros support the generation of low-maintenance and clear NC programs. Changes need only be made once in the macro content.
Macros may only be configured in the channel parameter list [1]-1 and also defined in the NC program.
Syntax of a macro definition |
"<macro_name>" = "<macro_content>" |
<macro_name> Name des Makros (alias)
<macro_content> Executable NC code
- Macro name and macro content must be enclosed in quotation marks "...”.
- The macro name makes a distinction between uppercase and lowercase letters.
- The redefinition of predefined macros is configurable [6]-6.39.
- Macro definition remain valid after program end (M30) or CNC reset. They are usable until the next controller start-up or #INIT MACRO TAB.
- Macro definitions that were configured in the channel parameter list cannot be deleted by #INIT MACRO TAB.
- The maximum number of macro definitions [6]-6.25 and their length [6]-6.37/-6.38 as fixed. The values can be set as of Builds V3.1.3079.17 and V3.1.3107.10
- Maximum number of expression labels P-CHAN-00509
- Maximum number of local subroutine definitions P-CHAN-00510
- Maximum number of characters in macro name P-CHAN-00511
- Maximum number of characters in macro content P-CHAN-00512
- Macro definitions and other NC commands can be combined in the same NC block.
A macro call is initiated by the macro name and can be combined in the same NC block with other NC commands.
Syntax of a macro call: |
"<macro_name>" |
Programing Example
Macro definition and use
N10 "POSITION_1" = "X200 Y200 Z300" ;Macro definition
N20 "POSITION_2" = "X300 Y100 Z50" ;Macro definition
:
N200"POSITION_1" (Macro call, X200 Y200 Z300 is executed)
:
N500"POSITION_2" (Macro call, X300 Y100 Z50 is executed)
Release Note
As of Build V2.11.2010.02 the command #INIT MACRO TAB replaces the command #INIT MAKRO TAB. For compatibility reasons, this command is still available but it recommended not to use it in new NC programs.
Syntax of Initiating the macro table: |
#INIT MACRO TAB |
This command clears all macros previously defined in the macro table. The macros pre-assigned by the channel parameters [1]-1 are retained.