Reading a Program Block
Reading a program block is the machinist’s skill of looking at a line of CNC code and knowing what the machine will do — and, just as important, what it will still be doing because of the lines before it. A CNC program is a list of blocks, each block one line, and each block is a sentence made of words built from an address letter and a value: in the word G01 the G is the address and 01 is the value, and in X25.0 the X names the axis and 25.0 the position. Reading fluently is not about memorising every code but about tracking state, because most of a block’s meaning is carried by the modes that earlier blocks left active. This entry sets out the anatomy of a block and the discipline of reading one correctly — the skill behind proving out any program in CNC machining.
The anatomy of a block
A block is read from left to right. The address letters tell the control what kind of word follows: an N word numbers the block for reference; G words set how the tool moves; X, Y, Z and the rotary axes give positions; I, J, K and R describe arc geometry; F sets the feedrate, S the spindle speed, T the tool to load; D and H name the offset registers for cutter radius and tool length; and M words switch the machine’s auxiliaries — spindle on or off, coolant, tool change, program end. A block such as N60 G01 X50.0 Y25.0 F200.0 reads plainly once the letters are known: on line sixty, feed in a straight line to the point X50 Y25 at a feedrate of 200. What is deliberately absent from that block is just as meaningful — the mode of motion, the active work offset and the tool in the spindle were all decided in earlier lines and are still in force.
Words set the state, and state is everything
The key to reading blocks is the distinction between modal and non-modal words. A modal word stays active until another word of the same kind replaces it, which is why a program can set G01 and a feedrate once and then give coordinates for line after line of cutting, each line meaning “continue in a straight feed at the same feedrate to this new point”. Modal codes belong to groups — motion, plane, distance mode, units, compensation, work offset, canned cycles — and only one code from a group can be active at a time, so each new one quietly cancels the previous. A few codes are non-modal, acting only in the block that carries them: the dwell G04, a machine-coordinate move with G53, a return home. The consequence is that a mode set thirty blocks earlier is still controlling the machine unless something replaced it — the source of the classic mistake of leaving the control in incremental mode and assuming absolute, and the reason programs open with a header that forces every critical mode to a known, safe value before any cutting starts.
Reading a cutting block step by step
The working order for reading a block follows its words. First find the motion word — G00, G01, G02 or G03 — or, if none appears, carry the motion mode forward from the last block that set it. Then read the axis words as the destination, remembering which coordinate mode is active: absolute G90 means measured from the part zero of the active work offset, while incremental G91 means measured from the current position, and the same block moves the tool to completely different places under the two. If the block is an arc, the I, J, K or R words locate its centre, the subject of this wiki’s entry on linear, circular and helical interpolation. Then apply the F feedrate and S spindle speed if present — both modal, so a number written only once governs all the cutting after it — and finally the M words that switch the machine state around the move.
The meaning lives in the modal state
Much of the depth of reading a block comes from the entries this wiki gives each topic separately: the block says G54, and the work offsets entry explains what that selects; it calls H01 and D01, and the entries on tool length offsets and cutter radius compensation explain the values they bring to bear on every coordinate in the block. Read together, a single line carries the whole context of the job — the part zero from the work offset, the tool length that turns a Z into a position of the tool tip, and the radius that stands between the programmed contour and the actual cutter centre. The block is the sentence, and the offsets and modes are the grammar that gives the sentence meaning; a machinist reads a program by carrying that grammar forward line by line.
Proving out what you read
Reading is not passive — it is the basis of proving a program before it cuts metal. The machinist walks the early blocks watching for the mistakes that reading reveals: a Z move made before tool length compensation is on, a G91 left over where the program intends G90, a rapid to a point that passes through the part, an offset that does not match the tool in the spindle. On the machine, proving uses the tools reading assumes — the rapid override turned down, the single-block mode that runs one line at a time so each motion can be checked against what the code says, the feed hold close at hand. A program that has been read properly, its modes tracked and its first moves verified, is a program that can be trusted to run; the blocks that remain are then just the same sentence repeated for every feature of the part, and the machinist who reads them well has already seen the whole job before the first chip.