1 month by cncdivi

CNCCookbook’s G-Code Tutorial

What Are G-Code Modes?

Let’s talk about G-Code “Modes.” Simply put, a Mode is the CNC Controller’s way of remembering what you told it to do last time. Think of it like muscle memory for machines. If you don’t specify every little detail, the CNC just assumes you want to do it the same way as before. It’s like the CNC’s way of saying, “Been there, done that!”

Modes are your time-saving buddies, making your g-code programs shorter and sweeter. So, instead of repeating yourself, let the Modes do the heavy lifting.

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 10th, 2024 at 02:23 pm