2 months by cncdivi

An emu still using a text editor for gcd, utilizing the G-Wizard Editor to save time and money.

Are you still using a Text Editor to edit g-code?  Aw, c’mon.  There’s better tools for the job.  Or maybe you just don’t ever want to touch g-code with a 10 foot pole.  Part of that is because you don’t have the right tools to work on g-code.  But you’ll find that having the ability to quickly and easily modify g-code comes in really handy.

I hate having to re-run the whole CADCAM chain to make very minor changes.  Tweaking a feed or speed, or doing a minor update for something I missed at the design stage is so easy when you have good tools for the job.

CNCCookbook’s G-Wizard Editor is a full-featured g-code editor and simulator with loads of features.  But I want to call particular attention to these 6 Power Features because they have the potential for the biggest savings of time and therefore money when you’re dealing with g-code:

–  Hints and Information Tabs:  GWE will give you tons of information about your g-code that’s hard to impossible to get any other way.  You need this if you get handed a g-code program and need to figure it out fast.

–  Conversational Wizards:  Create g-code for common operations with simple point and shoot wizards.  Use them to add ops to an existing g-code program or to create quick and dirty programs for various purposes, like reworking parts or adding ops due to last minute revisions.

–  Soft Limits:  Get alarms when your toolpath exceeds the limits you set.  Who couldn’t use a simple tool to help avoid many crashes?

–  Machine Acceleration Adjustments:  Are your time estimates on code always too optimistic?  Are there moves that are never even getting up to the commanded feedrate?  Find out with GWE’s Acceleration Adjustments.

–  Revisions: Wouldn’t it be great if you had an experienced hand at g-code programming available to edit your code and make revisions to it under your guidance?

–  Naming Macro # Variables:  It’s hard to remember all those variables, #100, #112, #221, etc..  Why not give them real names like #PROBE_DIAMETER?  GWE can do this even when your control doesn’t support naming #variables.

These are 6 of GW Editor’s most powerful and unique features to save you time and money with g-code–dig into them and you’ll wonder how you ever went without them.

1.  Hints and Information Tabs

You’ve got a g-code program that somebody else wrote.  Or maybe it’s one your CAM software’s post burped out.  Either way, you didn’t write it and you haven’t really spent much time looking at it until now.  There’s a problem of some kind there and you’ve been picked (no, you didn’t volunteer for this job did you?) to figure out what the problem is and fix it.


There’s nothing worse than having to dive into someone else’s software code and try to modify or fix it.  At least if it is your own, something will be familiar.  That is unless you wrote it years ago and haven’t been down the dusty code corridors in quite some time.  It’s a struggle to look at that code (geez, they even call it “code”) and try to make heads or tails of what’s going on.  It can be even worse if your post is doing things that look stupid for obscure reasons or you have to get through seriously complex macros that seemed like a great time saver when they were written but just look like hieroglyphics now.

Fear not–G-Wizard Editor has some powerful reverse engineering tools that can help you get through it even if you’re no g-code programming expert.

First and foremost is a feature we call Hints.  They’re more than just Hints though–they spell out everything that is happening in a line of g-code in simple English.  There’s a Hint right below the backplot that always shows the Hint information for whatever line of g-code the cursor is on.  There’s also a “Hint” tab that will show you line-by-line Hints instead of listing the g-code.  You can find them on the GW Editor screen here:


There’s always a Hint for the current cursor position below the Backplot and there’s a Hint tab that shows line-by-line Hints…

Here’s what a typical Hint looks like for an arc:


A typical Hint for an arc…

At the top is the Line # and the original text of that line in bold face:

Line 43:  N400 G03 X0.5 Y0.375 I0.125 F7.0

Directly below is a breakdown of what that line does in English:

N400:  Block or sequence number

G03:  Counter-clockwise circular interpolation (move in a circular arc at feed speed)

F7.0:  Feed Rate = 7

Relative IJK resolves to absolute IJK

Arc End Point, Center Coordinates, Radius, and Angle:  There’s quite a lot of additional calculated information provided about your arc or other g-code that is often very hard to come by.

Time and Adj Time:  These are the time estimates for this line both regular and adjusted for acceleration limits.  Acceleration is often the limiting factor.

V End:  This tells you what the actual feedrate was by the end of the move.  Sometimes there’s not enough acceleration available to even get to the commanded feedrate, and it’s useful to know when this is happening.

Taken as a group, Hints not only make it easier to understand the g-code if you’re not very familiar with g-code, they also tell you all sorts of information (such as the actual location of the arc center or the acceleration adjustments) that’s very hard to come by any other way.  Even experienced g-code programmers find that information extremely convenient to have around.

It gets even better though.  Go to the File menu and you’ll find a command called “Export Hints“.  It creates a spreadsheet that has all the hints and much more:


Here in one file you get a whole bunch of useful columns that tell you:

–  The GCode line

–  GCode text

–  Time to get to the line, in seconds

–  Acceleration adjusted time to get to the line, in seconds

–  Final XYZ coordinates after executing the line

–  Speeds (S) and Feeds (F) in effect for the line

–  Tool (T) loaded for that line

–  Hint:  This is our special GCode-Explained-In-Plain-English hint seen in our Hints view.  There’s tons of additional useful information in there that you could pick apart with spreadsheet formulas if you needed to.

–  Error:  Full text of any errors associated with the line of GCode

That’s a lot of useful information in a spreadsheet format that makes it easy to manipulate.

Use it to print columnar reports as an aid to documenting your GCode.  Add formulas to do analysis of various kinds on the GCode.  Use it to make it easier to understand what the GCode is doing.  Give a copy to an Operator they can mark up while they watch the program run to give ideas how to improve it.

There’s a lot of potential for anyone who can run a spreadsheet to do creative things with the information found here.

2.  Conversational Wizards

G-Wizard Editor includes a free set of Conversational CNC Wizards:

These Conversational Wizards generate g-code on the fly after answering a few basic questions.  For example, the Hole Wizard has a comprehensive set of options available for making holes:


Hole Drilling Wizard…

Options for the Hole Wizard include:

–  Holes can be made at a particular positions, in a list of arbitrary coordinates, in a bolt circle, along an arc, in a rectangular grid, or in a line at any angle and separation.

–  Hole can be made using your machine’s canned cycles, our custom Deep Hole Cycle Wizard (pictured above), or using interpolation.

The Deep Hole Cycle is a customizable cycle that gives you access to all the special tricks of the trade when making deep holes.  You can decrease the distance between pecks as you get further down the hole, you can switch from quick chip breaking pecks to near full retracts as you get deeper (making sure the bit doesn’t clear the hole completely and let chips fall back in, you can reduce feeds and speeds with each peck, and so on.

The Conversational CNC has many uses.  If you’re manually programming, it can save you a lot of effort to crank out basic operations such as holes and face milling.  Or, you could use it to update certain parts of a CAM-generated program.  For example, perhaps you’d like to use the Deep Hole Wizard for certain things.  Or maybe you’re trying to make a simple quick and dirty part without ever having to do a drawing and run your CADCAM software.  Conversational Wizards are great for all these tasks.

3.  Soft Limits and the Info Tab

If you’ve been machining long enough, you’ve had a tool wind up where it shouldn’t have.  Hopefully you haven’t carved up your table, but the top of a vise is rarely blemish free.  Soft Limits let you quickly check a program for obvious crashes.

GW Editor captures all sorts of important summary information about your program on the Info Tab.  Part of that information is the extents for the toolpath.  You have the ability to set alarms on those extents so you can check for crashes:

You can set limit alarms on each axis…

I’ve enabled the Soft Limit Alarm for the Z axis with the checkbox, and I am just going to use 0.0 as the minimum and 100,000.0 as the maximum.  You could do more if you wanted to take the time, for example, set the maximum to be the limits of travel or some such on your machine.  I’m also not bothering with X and Y.  There’s nothing really to crash into there on this job.  If I was running a 4th axis job, I’d probably want to set those limits as well.

GW Editor will save this information across sessions, so the same alarms will be there the next time you load a file.  You won’t need to customize for each file in most cases, although not in all cases.  For example, it isn’t too hard to imagine if you do mostly sheet work, say plywood on a CNC Router, that the same Z limits would suffice for most jobs.

Every move that breaks a soft limit will now be flagged as an ERROR to be looked at.  You could even use it to help optimize your move strategy.  Perhaps you want to set the limits so they find feedrate moves that are still happening well above the workpiece that could be sped up to rapids speeds to make your program faster.

To learn more about Soft Limits, see this blog post that introduced them.

4.  Machine Acceleration Adjustments

We briefly touched on Machine Acceleration Adjustments in the section above on Hints.  Acceleration is one of the dirty little secrets of CNC.  Due to acceleration limits, it’s entirely possible that the cutter never even gets going as fast as the commanded feedrate.  Let’s say you want to accelerate from dead stop to 100 IPM.  Here’s a chart that shows how far the cutter must travel with various machine acceleration limits:

It’ll be a rare and fairly expensive machine that can hit the higher accelerations.  If you have a more modest machine that’s only capable of say, 0.2g of acceleration, the cutter needs more than half an inch to get up to speed.  The situation is even worse for arc motions, because the machine acceleration has to work not only to achieve the feedrate, but to fight the centrifugal forces an arc creates.

It’s important to understand what’s really going on with acceleration for a variety of reasons, not the least of which is getting accurate time estimates for how long an operation will take.  Another use for it is to understand which parts of your g-code are not reaching the commanded feedrate.  If you expected the cutter to survive and prosper at the commanded feedrate (perhaps because you used our G-Wizard Calculator to figure that feedrate), you’re leaving money on the table if you machine can’t go that fast.  If you need to tune that g-code up for every last ounce of productivity, you’ll need to find a way to work around the acceleration limits.  One approach would be to increase depth of cut or width of cut in areas that can’t get to full feedrate.  That way you can keep Material Removal Rates higher and still stay within the acceleration limits of your machine.

For more on Machine Acceleration and GW Editor, see our introductory post on it.

5.  Revisions

Wouldn’t it be great if you had an experienced hand at g-code programming available to edit your code and make changes to it under your guidance?  You know what you want, but some of it is just very time consuming to accomplish.  That’s why we put a feature we call “Revisions” into GW Editor.   Think of an editor as revising your code.  Revisions are for the same purpose.  They take some or all of the code in your g-code program and make an update to it of some kind.  There are lots of different Revisions available, here is what the Revisions menu looks like:


G-Code Revisions can make complex transformations on your g-code…

Let’s say for example you’ve used your CADCAM to product a program to do a part.  Now you want to be able to call that part from a subprogram, and perhaps you want to do various other transformations to it, for example rotating it so you can call the subprogram a number of times and at different rotations to cut a bunch of these parts out of a plate.  One Revision that might be handy is to change that part program to use Relative Addresses instead of Absolute.  This way, you move to where you want the part zero to be, call the subprogram, and it is perfectly happy to make a part at the new location.

That’s just one of many possible Revisions available to you for your g-code programming.

Check out some others:

6.  Naming # Variables in Macros

Speaking of Revisions, I’ve saved one of the best for last.  If you’ve ever done much g-code macro programming, your very familiar with the idea that most g-code dialects store variables using a syntax like “#100”.  The number following the “#” sign determines which variable is being used.  Unfortunately, as human beings, we’re not all that good at remembering numbers–by the time you get 10 or 20 of these things going in a program, most of us are constantly referring to a cross reference table of some kind to remember what they do.  It’s very error prone to program this way and after you set the g-code down for just a little while it becomes very hard to pick it up and understand what it’s doing again.  And if someone else wrote it a few years back, oh my, forget about it.  Easier to rewrite than to try to figure that stuff out, and rewriting is none to easy either.

Some of the more expensive higher end controls have the ability to let you assign real names to the variables.  What a relief it would be if we could use “#HOLE_DEPTH” rather than “#113”!

But what if your control doesn’t support that kind of thing?

G-Wizard Editor to the rescue!  We can let you use easily remembered symbolic names even for controls that don’t support them.  We even provide a nice cross reference to the names:

Name, #number, and value of macro variables are easily accessed in the Macros Variables tab…

The name, #number, and value of macro variables are easily accessed in the Macros Variables tab (that Macro tab is another great GW Editor time saving feature!).

How does this magic work?

You can see in the little inset view that the standard syntax for Fanuc and similar controls that support variable names is to use the “SETVN” command.  With GW Editor, we introduce what we call a “Soft SETVN”.  Basically, you put the SETVN into a comment like this:

( SETVN Test )
#500 = 0.010
#501 = 3.000
#502 = 0.0
#503 = 1.0
#600 = #500
#601 = #501
#602 = #502
#603 = #503

Any control will read that because it’s just a comment.  But here is the sneaky part: you can go to the Tools Revise menu and choose the “GWE Directives” choice. Make sure the “SETVN Do” radio button is selected and press “Apply”. The program is now transformed as though your controller supports SETVN:

( SETVN Test )
#PROBEDIA = 0.010
#HOLEDIA = 3.000
#XPOS = 0.0
#YPOS = 1.0
#600 = #PROBEDIA
#601 = #HOLEDIA
#602 = #XPOS
#603 = #YPOS

What’s happening is that #PROBEDIA, for example, is the same as #500.  Cool beans, eh?

You can write and debug your macros with variable names that are actually understandable. When you get ready to save, just run the “Undo” form of the same revision and it strips all the SETVN names back out and restores the correct numbers as defined in your *GWE* comments.  But here is the cool part:

Since the SETVN’s are still in the comments, you can just reload the file if you need to work on it some more and they’ll still be there.

If you’re doing g-code programming, give this feature and our new Variable tab a try.  They’ll simplify your work.

You can learn more about our fancy Soft SETVN in this post.


These are just a few of the unique and powerful features that set G-Wizard Editor apart from other similar g-code editors.  I hope you can see how helpful such features can be to almost any CNC user.  Whether you plan to do much g-coding by hand or not, g-code is a fact of life in CNC.  Why not make sure you’ve got a power tool available that will help you understand the g-code just as much as it helps you slice and dice it until it does what you need.

If you’ve never tried GW Editor, be sure to sign up for our free 30-day trial and check it out.


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 March 18th, 2024 at 03:46 pm