Standardizing Numerical Values
One thing you might have noticed about G-Wizard on CNC machines is that sometimes numerical values include a decimal and sometimes they do not. This can affect precision and accuracy if values are not exact. Luckily Bob Warfield of CNCCookbook found a way to edit G-Wizard to fix this! Follow the steps below and you will be ready to machine precisely!
I was recently contacted by a customer who needed to solve a problem their shop had:
We have been tasked with standardizing our programs in many ways and one concerns was that we need to supply the shop with programs that include decimals. Currently many of the programs have a MIX with some of the values having decimals, but other values only numerical value with NO decimals. Would your Editor be able to correct this with ALL values showing a decimal?
The answer to the question is yes, absolutely, GW Editor is perfect for this job. In fact, its great for similar kinds of jobs where you want to standardize or update a bunch of g-code to follow some syntax norm you want to adopt.
Heres how to solve this particular problem:
Step 1 Modify GW Editors Post to Fit the Desired Numeric Syntax
To do this, I simply changed the option for X words so the Decimal mode is Required. You also need to turn off the checkbox at top that says Match any number without errors.
This change tells GWE what your desired syntax is for numbers. Note that X is a stand-in for X, Y, and Z.
Once you make that change and save it, a bunch of errors crop up:
Now you can see where the errors are.
Step 2 Use a Revision to fix the problems
GW Editor has a feature called Revisions that does powerful editing on your g-code. Its syntax-aware and often far more powerful than a simple Find and Replace (GWE does that too).
In this case, I will use a Revision called Adjust Addresses to make the change:
This Revision lets us specify a mathematical and a formatting option on a word-by-word basis. In this case, I am updating the X, Y, and Z words. I dont want to change the values, I just want them to fit the new format I set up with the post change. So, I will simply add zero to the word. And thats what you see it set up to do.
I run the Revision and suddenly most of my problems are gone!
It complains there are too many digits after the F word, but we can either ignore that or update that in the post too if desired.
There are many other revisions available to do everything from renumbering a program to letting you shift, scale and rotate the coordinates in a program.
Handy for many applications!
If you havent tried G-Wizard Editor, pop over to its page and grab the free 30-day trial:
Join 100,000+ CNC’ers! Get our latest blog posts delivered straight to your email inbox once a week for free. Plus, well give you access to some great CNC reference materials including: