Skip to content

CNC programming | G-Code | M-Code | Linear Interpolation | Circular Interpolation



The method by which contouring machine tools move from one programmed point to the next is called interpolation. This ability to merge individual axis points into a predefined tool path is built into most of today’s MCUs.

There are five methods of interpolation:

  • linear
  • circular
  • helical
  • parabolic
  • cubic

All contouring controls provide linear interpolation, and most controls are capable of both
linear and circular interpolation. Helical, parabolic, and cubic interpolation are used by industries that manufacture parts which have complex shapes, such as aerospace parts and dies for car bodies.

Linear Interpolation

Linear Interpolation consists of any programmed points linked together by straight lines, whether the points are close together or far apart

Curves can be produced with linear interpolation by breaking them into short, straight-line segments. This method has limitations, because a very large number of points would have to be programmed to describe the curve in order to produce a contour shape. A contour programmed in linear interpolation requires the coordinate positions (XY positions in two-axis work) for the start and finish of each line segment. Therefore, the end point of one line or segment becomes the start point for the next segment, and so on, throughout the entire program.

Read More:   Slotting Machine | Mechanism of Feeding in a Slotter

01-example of Linear Interpolation-straight line motion of a cutter-2 axis-2 position

Circular Interpolation

The development of MCUs capable of circular interpolation has greatly simplified the process of programming arcs and circles. To program an arc, the MCU requires only the coordinate positions (the XY axes) of the circle center, the radius of the circle, the start point and end point of the arc being cut, and the direction in which the arc is to be cut (clockwise or counterclockwise)01-circular Interpolation

Programming Codes for CNC:

The most common codes used when programming CNC machines tools are

  • G-codes (preparatory functions), and
  • M codes (miscellaneous functions).

Other codes such as F, S, D, and T are used for machine functions such as feed, speed, cutter diameter offset, tool number, etc.


G-codes are sometimes called cycle codes because they refer to some action occurring on the X, Y, and/or Z axis of a machine tool.

01-G-Codes example-rapid transverse-Linear Interpolation-Straight line path
01-G-Codes-Circular Interpolation colockwise-Anticlockwise or Counterclockwise

Group Code Function
01 G00 Rapid Positioning
01 G01 Linear Interpolation
01 G02 Circular Interpolation  clockwise (CW)
01 G03 Circular Interpolation Counter clockwise (CCW)
06 G20* Inch input (in.)
06 G21* Metric Input (mm)
G24 Radius Programming (**)
00 G28 Return to Reference Point
00 G29 Return from Reference Point
G32 Thread Cutting (**)
07 G40 Cutter Compensation Cancel
07 G41 Cutter Compensation Left
07 G42 Cutter Compensation Right
08 G43 Tool length compensation positive
08 G44 Tool length compensation minus
08 G49 Tool Length Compensation Cancel
G84 Canned Turning Cycle (**)
03 G90 Absolute Programming
03 G91 Incremental Programming
Read More:   Metal Casting | Steel Molding

(*) – on some machines and controls, these may be G70 (inch) and G71 (metric)
(**) – refers only to CNC lathes and turning centers.


M or miscellaneous codes are used to either turn ON or OFF different functions which control certain machine tool operations.

01-M-Codes-Direction of Rotation-Clockwise-Counter clockwise-Tool Change - End of program-return to beginning

Code     Function

M00     Program stop
M02     End of program
M03     Spindle start (forward CW)
M04     Spindle start (reverse CCW)
M05     Spindle stop
M06     Tool change
M08     Coolant on
M09     Coolant off
M10     Chuck – clamping (**)
M11     Chuck – unclamping (**)
M12     Tailstock spindle out (**)
M13     Tailstock spindle in (**)
M17     Tool post rotation normal (**)
M18     Tool post rotation reverse (**)
M30     End of tape and rewind
M98     Transfer to subprogram
M99     End of subprogram

(**) – refers only to CNC lathes and turning centers.

Leave a Reply