Canned Cycles
Canned cycles are the G-code shorthand for a repeated machining sequence: a single cycle word that expands, in the control, into a whole fixed routine of motions — position over the hole, rapid down to a clearance plane, feed to depth, retract — so that a program can drill, tap or bore a hundred holes without writing the hundred individual moves. They are among the most used features of CNC programming, because the work they package is exactly the work that repeats: the pattern of holes in a flange, the row of drilled and tapped holes round a housing, the bores down a manifold. The cycle is written once, the holes are named as positions, and the control runs the whole sequence at every one of them. This entry sets out what canned cycles are, how they are written and used, and the care they demand.
What a canned cycle is
A canned cycle is a fixed, preprogrammed sequence of actions built into the control and called by one G-code, and it exists because holemaking is so regular. Every hole is made the same way: the tool moves above the hole, feeds down to its depth, and comes out again — the only differences are the depth, the way the tool enters and leaves, and whether the cut is interrupted to clear the chip. Instead of writing those motions for every hole, the program writes a cycle, and the cycle supplies the routine; the program supplies the hole positions, the depth and the feed. The cycle is really a small, fixed subprogram built into the control, and the block that calls it names the parameters — where the hole is, how deep it goes, how the tool returns — while the sequence of motion between those parameters is already written. The result is a program far shorter and far easier to read than the blocks it replaces, and one that carries the holemaking craft of the shop inside a single word.
The common cycles
The common cycles are named by the G-codes of the machining centre, and each packages a different way of making a hole. The plain drill cycle positions over the hole, feeds to depth in one pass and retracts — the cycle of the spot and centre drill and the ordinary hole. The dwell cycle does the same but pauses at the bottom, letting the tool clean the bottom of a blind hole or a counterbore. The peck cycle feeds down a short distance, retracts to clear the chip, and feeds again, step by step to depth — the cycle of the deep hole, where the chip must be broken and cleared. The tapping cycle drives the tap to depth and reverses it out at the synchronised feed that lets a rigid tap cut its own thread, and the boring and reaming cycles feed a single-point boring bar or a reamer to depth and withdraw it in the way the tool demands. Each cycle is one word, and the difference between them is the craft of the operation they package — a craft this wiki gives to the processes themselves.
Writing and using a cycle
A cycle is written as a line that names the cycle, its depth and its feeds, and it is then applied to hole positions. In its simplest reading the cycle block carries the Z depth and the feed, and every following block that names an X and Y position runs the whole sequence at that position — the control positions there, runs the cycle to the named depth and returns, ready for the next position block. The blocks between the cycle’s start and its cancellation are the hole list, and the program can carry one active cycle through a whole row of positions, changing the depth or the feed by rewriting the parameters in a later block. When the holes are done the cycle is cancelled, returning the control to ordinary motion, so that the moves after the hole pattern are not trapped in the cycle’s logic. Two companion words control how the tool returns at each hole — to the clearance plane just above the work between holes of a pattern, or to the original start height when the tool must clear a step or a clamp.
The cycle as program state
A canned cycle is modal, and like every modal state it stays active until it is cancelled or replaced — the subject of this group’s modal and non-modal entry. Once the control is in a drilling cycle, every XY block runs the cycle, and a rapid move that the programmer meant as a simple positioning move will instead drill a hole where no hole was wanted, if the cycle has not been cancelled. The discipline of cycles is therefore the discipline of state: the cycle is started, the hole positions are run, the cycle is cancelled with the clear intention of ending it, and the program’s structure keeps the cancelled cycle out of the moves that follow. A program that leaves a cycle active, or enters one without meaning to, is a program waiting to make a hole in the wrong place, and reading a program with the cycle’s state in mind is part of the reading skill this group teaches.
Canned cycles on the lathe
The lathe uses the same idea under different names, and its cycles package the repetitive work of turning. Where the milling machine cycles a hole, the turning centre’s cycles package the roughing and finishing of a profile: a roughing cycle takes a single description of the part’s shape and cuts it away in a series of passes, stepping along the profile and returning, until the shape is roughed to size; a finishing cycle follows the same shape in one clean pass; and a threading cycle cuts a thread by repeating the passes that deepen it, each pass following the same path a little deeper until the thread is complete. These cycles are the heart of turning centre programming, because a turned profile — the shoulders, the tapers, the radii of a shaft — is exactly the repeated, regular work a cycle can generate from one description.
Cycles in the life of a program
Canned cycles reward the programmer who uses them deliberately. They shorten the program to what matters — the hole positions and depths, the profile and its feeds — and they carry the machining logic in one place, where it can be checked and changed; a depth altered in the cycle line alters every hole that follows it. The machinist proves a cycle as programs are proved: the first hole is watched, its clearance plane and depth verified against the clamps and the part, before the cycle is trusted to run the rest of the pattern. In the economy of the language, the canned cycle is the highest form of the packaging this group describes — a sequence of motion reduced to one word, understood by the machinist and obeyed by the machine, making the hundred holes of a flange as easy to program as one.