Subprograms
A subprogram is a block of NC code designed to be called several times from the main NC program, to reuse blocks of code (typically, XYZ rapid and cutting moves) that are repeated within an operation. For example, you might create a subprogram which cuts a contour, including lead in/out moves. Then, you could call this subprogram at different depths to cut the part with depth cuts. Subprograms reduce the size of the NC file in this case because all of the individual tool movements are not repeated at each depth, just the code to call the subprogram.
Subprograms are not supported for Auto Drill or Drill 5-axis toolpaths. Mastercam has two kinds of subprograms:
- Transform subprograms
- Non-transform subprograms
Both types support absolute or incremental positioning in the subprogram.
Transform subprograms
Transform subprograms are created by Mastercam's toolpath transform functions. Each transformation of the selected toolpaths results in a subprogram. If you select Subprogram on the Transform toolpath parameters tab, each of the instances of the translated toolpath would be a subprogram.
Non-transform subprograms
Non-transform subprograms are created when you use depth cuts. The cutting pass at each depth is a repeating pattern that can be made into a subprogram.
You can also create nested subprograms, where a toolpath that includes non-transform subprograms is transformed with subprograms. For example, a contour toolpath with depth cuts that are subprograms could be translated with subprograms.
Non-transform subprograms are not supported in Mastercam Lathe.
Drill toolpath subprograms
Drill toolpaths can also create non-transform subprograms in two ways:
- Create a subprogram for the entire drill cycle by selecting Subprogram on the Linking parameters page.
- Create a subprogram that stores just the drill hole locations. This happens when you are creating a drill toolpath and choose to use the points from an earlier operation. Choose Subprograms in the Toolpath Hole Definition function panel.
Subprograms must be enabled in the active control definition before you can use them. Use the Subprograms page in the control definition to tell Mastercam how your control supports subprograms.





