Get With The Program: Making the most of macros
Using macros, which are pieces of instruction that provide shortcuts, greatly improves programming productivity, according to the Get With The Program column in the July 2017 issue of Cutting Tool Engineering magazine.
Once upon a time, G-code programs were simple. The controller read them from the tape, beginning to end, and moved the cutting tool, step-by-step, to make a finished part.
With the advent of “conditional branching” and “variables,” the controller could create complex movements using only a few lines of code. These two functions—branching and variables—enable programs to repeat themselves while overwriting their values, making the controller “Turing complete.” (Turing refers to English mathematician Alan Turing, who is credited with breaking the German Enigma Code during World War II.) “Turing completeness” describes the set of systems that can simulate each other.
In theory, Turing completeness means that a CNC can do anything any other computer can do. Want to turn a milling machine into an arcade game? It’s possible—but your boss will get mad if production stops because you ran out of tokens.

Using macros greatly improves programming productivity.
Macros are pieces of instruction that provide shortcuts. The simplest milling macro, for example, tells the machine to repeat a cutting pattern for multiple depths:
(MILL A PATTERN TO Z-0.699)
N100 VC1=[0] (INITIALIZE VARIABLE)
N110 VC1=[VAR-0.25] (1/4″DOC)
N120 G0X0Y0 (STARTING POSITION)
N130 G1Z=[VC1]
Review the print ads from this magazine to continue
This quick advertiser review unlocks the rest of the article and keeps the full-screen reader focused on the ads instead of the page chrome.


MFGAxis Discussion