10 months by cncdivi

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:

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


Like what you read on CNCCookbook?

Join 100,000+ CNC'ers!  Get our latest blog posts delivered straight to your email inbox once a week for free. Plus, we’ll give you access to some great CNC reference materials including:

  • Our Big List of over 200 CNC Tips and Techniques
  • Our Free GCode Programming Basics Course
  • And more!

Just enter your name and email address below:

Full Name
Email *
100% Privacy: We will never Spam you!

Rate this post

Recently updated on June 11th, 2023 at 08:40 am