Face milling G-code

Writes an example program to face the top of a rectangular block with passes along X, stepping over in Y, at one or more depths. Open it in the viewer to check the path.

Example code – check it and dry-run it, at your own risk. This program is a generic example, not written for your machine or control. Read every line against your control’s manual, simulate it, then run it above the work in single block with reduced rapids and feed before cutting. Check the work offset, tool length offset, units and clearance heights. See the terms of use.
How it works, guides and notes

How it works

Each pass runs along X from fully off one end of the stock to fully off the other, so the cutter never plunges into the work: it drops to depth in the air beside the block. Passes step over in +Y. The first and last passes hang over the edges by one stepover, so no pass cuts wider than the stepover you set. The number of passes is rounded up and the spacing evened out, so the real stepover is never bigger than asked. Depth passes are split equally the same way.

With the spindle running forwards (M3) and the uncut stock on the +Y side, cutting towards −X puts the material on the right of the direction of travel, which is climb milling; cutting towards +X is conventional. One-direction passes keep the same direction every time, lifting to safe Z and returning between passes. Zig-zag is quicker but alternates climb and conventional.

Hand check: 100 × 60 block, 50 mm cutter at 70 % (35 mm): first pass centre Y = 25 − 35 = −10, last = 60 − 25 + 35 = 70. Span 80 ÷ 35 = 2.3, rounded up to 3 steps of 26.667, so 4 passes at Y −10, 16.667, 43.333 and 70. X runs from −27 to 127 (half the cutter plus 2 mm clear each end).

Check that clamps and vice jaws are below the faced height or outside the cutter path, and that the cutter can safely take the depth per pass. Feeds and speeds are yours to set: see the milling feeds calculator.

FANUC, Haas, Siemens, Heidenhain, LinuxCNC and Grbl are names or trademarks of their respective owners. They are mentioned only to describe which controls a code format relates to. Lathe Calculator is not affiliated with or endorsed by any of them. Trademarks.

Spotted a mistake? Report an error.