CNCCookbook: Be a Better CNC'er

Want to be a better CNC'er?

Get our weekly newsletter plus a package of greatest hits, special tips, and more, all for free.

I'm Ready to Be a Better CNC'er, Hook Me Up!


One Shot G-Codes and Modal G-Codes

CNCCookbook's G-Code Tutorial

What Are G-Code Modes?

We've mentioned before that there are lots of "Modes" in G-Codes. A "Mode" simply means the CNC Controller is remembering some behavior from the last time you told it what to do. People often think modally, meaning if you don't specify every detail, they fall back to assuming you mean to do things the way you did the last time. Modes save time and make our g-code programs shorter.

When you run a G-Code program in the GWE simulator, it shows you which modes are in effect in the little box under the backplot:

G-Code Modes

The controller's state and G-Code Modes are shown Below the GWE Backplot...

There are many examples of modes in g-code, not the least of which are the coordinates of the current position. You don't always have to specify X, Y, and Z for every move. You only specify the coordinates that have actually changed.

The exact use of modes is one of the areas that differs from one G-Code Dialect to the next, so make sure you understand which things are modal in your g-code dialect and which are not.

What is a One-Shot G-Code?

Speaking of things which are not modal, we have a name for a big category of non-modal behavior which are called One-Shot G-Codes. A one-shot g-code is only in effect for the block it is used in, and then the mode goes back to whatever it was before the block was executed. Most of the one-shot g-codes are fairly advanced, so we'll save them for a later chapter.



1. Get out the programming manual for your control and find at least one example of a modal g-code and one example of a one-shot g-code.


Try the Free Trial Version of G-Wizard G-Code Editor...


No credit card required--just your name and email.


Next Article: CNC Editors




CNCCookbook's G-Code Course


Featured Articles

Step-By-Step Guide to Making CNC Parts

CNC Router Cutter Types

Why Use a Single Flute Endmill?

Step and Servo Motor Sizing

The Truth About Tool Deflection

10 TIps for Router Aluminum Cutting

2 Tools for Calculating Cut Depth and Stepover

CNC Machine Hourly Rate Calculator

Special Purpose CNC Calculators

Feeds and Speeds Guide

CNC Cutter Guide

Feeds and Speeds By Material

G-Code Tutorial

  Feed Rate Calculator

Sales, and Special Deals


GCode is complicated.
G-Wizard Editor
makes it easy.

Try It!


Feeds and Speeds:
Made Easy.

Try G-Wizard



Do you want to be a better CNC'er in 37 Seconds?

Get Better Tool Life, Surface Finish, and Material Removal Rates Fast.

It's that easy. You can install and get results in a matter of minutes.


Start Now, It's Free!