234 7 Programming: Canned Cycles, sub-programs
7.4 Sub-programs
7.4 Sub-programs

Sub-program information:

Overview
Program repetitive sequences or patterns in a sub-program. Enter
sub-programs in the program after the end of the main program. Call
sub-programs from the main program.
A sub-program can use any code or move type. For example, to cut
a contour twice (one rough pass and one finish pass), program it as
a sub-program. You can call the sub-program from the main program
as many times as required, but you enter the parameters only once.
sub-program(s) must be stored in the same file as the main program
that calls them.
You can store sub-programs anywhere in the program after the main
program. They do not have to be entered in numerical order or begin
on any specific block number.
It is possible to nest Calls to sub-programs within other
sub-programs, not just from the main program.
Loop (repeat) sub-programs moving along any axis in increments
each time the loop runs.
Rotate, Mirror, and/or Scale sub-programs.
Ending the Main Program
The main program should always be defined in every program with the
EndMain command, although this is absolutely required when using a
sub-program. The EndMain command must come before any
sub-program definitions.
Select "Sub Programs" and then "EndMain" from the pop-up menu.
Conversational format: EndMain.
G-code format: M2.