Tool radius compensation G40, G41, G42
Tool radius compensation is correction of cutting point displacement.

Each tool has small cutting radius just like on the image above. Cutting point depends of direction of tool movement. If direction of tool movement is changed from 1 to 2 then cutting point displacement happens (blue to red point on image). G41 instruct left side tool radius compensation, G42 right side tool radius compensation and G40 clears compensation. Tool compensation must be applied just before cutting, e.g. before you use linear interpolation you must apply correct compensation. You apply left compensation if cutting point will appear on left side of circle, and clear compensation if tool moves horizontally or vertically.

