Macros are ASCII files which contain user definable command sequences.
Several examples are provided in the standard fanuc post.
For example, the CUT_CONTOUR macro is defined in the file "cut_contour" is:
RAPID: X= Xstart; Y= Ystart;
RAPID: Z= Rap_level+ Tool_clearance; Codes= Spindle;
FEED: Z= Rap_level- Finish_depth; Codes= Coolant;
ASSIGN: Pathstartpt
OUTPUT: G01G{Comp_dir}X{Xstart}Y{Ystart}D{Dia_comp}
CUTPATH:
OUTPUT: G01G{Comp_cancel}X{Xend}Y{Yend}
RAPID: Z= Rap_level+ Tool_clearance; Codes= Coolant_off;
In the macro the first block rapids the XY location defined by the variables Xstart and Ystart.
These variables are defined when the path is selected.
The next block rapids in Z to the value determined by the variables.
The Codes= Spindle; appends the spindle-on M code to the end of the block.
The next block feeds in Z to depth.
The Codes= Coolant; appends the coolant-on M code to the end of the block.
The next block calls a function Pathstartpt which is used to assign the calculated start of the path to the System Variables Xstart and Ystart.
The next block is an example of a one line template which turns on the cutter diameter compensation.
The OUTPUT command tells the program to output the block by filling in the variables.
Variables are indicated by braces {Xstart}.
The letter immediately preceding the braces specifies the word address for formatting purposes.
String variables must have a blank space before the brace.
The next block calls the system command CUTPATH which tells the program to generate the tape code for cutting the current path which is specified outside the macro.
The final two blocks cancel cutter comp via a one line template and retract the cutter in z.
Associated with this macro is the question file
| Dia_comp | default | prompt= "CUTTER DIAMETER COMP #"; |
| Finish_depth | force | prompt= "FINISH DEPTH"; |
| Zfeed | default | prompt= "Z FEED RATE"; |