CNC Post Processors & CAM for Different G-Code Dialects [ 2019 ]
Note: This article is part of CNCCookbook’s G-Code Tutorial
What is a CNC Post Processor?
We’ve seen that there are many dialects of G-Code. CAM software has to take geometry from a CAD model and convert it to g-code. Doing so obviously requires an awareness of the exact g-code dialect that is being targeted. The Post Processor is the component of your CAM software that is responsible for translating to the exact g-code dialect. We often refer to a particular instance of a translation as a “Post”. There will be a different Post for each g-code dialect your CAM software supports.
While translation to specific g-code dialects is the primary task of a Post Processor, they can do a lot more besides to customize your part programs to work using the Best Practices of your shop. For example, you might use a 4th axis in a certain way, but you don’t use the 4th axis for every job. It might make sense to have one Post for standard jobs and another for 4th Axis jobs. The Post can change the initial setup of a part program and it can change how particular operations work. Another example might be a post that automatically subsitutes a deep hole drilling cycle whenever the length to diameter ratio of the hole is too large.
We’ll talk in greater length about some of these other possibilities below. First, let’s understand the translation role better.
CNC Post Processor Schematic Overview
What is a CNC Post Processor?
CL Data, Simulators, and the Reason to Use a G-Code Simulator
You must be wondering, “Is CAM software really that buggy that we can’t trust the built-in simulator?” In most cases, it isn’t a function of major bugs but rather of little issues that go undiscovered. Perhaps the simulation looks fine but there’s something wrong in the g-code that will cause an alarm on your CNC machine so it just won’t execute. That’s time wasted running back and forth between machine and CAM trying to figure out the cause of the alarm and how to fix it.
A good g-code simulator does a lot more than just plot the toolpath–it will check for all sorts of alarm conditions.
CNC Post Processors for Shop Best Practices
While the primary role of a Post is to convert generic geometry to the particular dialect of G-Code your machine uses, the Post also gives you a lot of flexibility to tailor your CAM output to the practices your shop likes to use, so it is a handy way to customize the G-Code output of your CAM.
If you frequently are making the same hand edits over and over again to your G-Code, it’s worth investigating whether a change to your Post would eliminate that hassle. Some examples of shop-specific customization might include your standards for safety blocks or required comments.
You can even modify the Post to save your operators some time. Maybe you want the table on your mill to move as close to the enclosure door as possible at the end of a job to facilitate loading and unloading. That’s a logical thing to have the Post do for you. Depending on the CAM package and its Post capabilities, sometimes very powerful flexibility is an option. For example, the Post may be able to popup a custom menu allowing you to choose some options you’ve specifically designed for your shop’s needs on every Post.
Example Customizations of CNC Post Processors
Here are some typical kinds of customizations that go above and beyond just making a post that’ll work for your machine’s g-code dialect:
- Probing: Probes can be tremendously valuable, and the Post is a good place to enable all that power. For example, it’s possible completely automate part zero touch offs and the like.
- Simulated Tool Compensation: It’s often convenient for the toolpath to be programmed to the tip rather than the circumference of the cutter, but not all machines have g-code support for Tool Compensation. If the Post Processor is powerful enough, it can be simulated by the post.
- Right Angle Heads: It can often be advantageous to employ a right angle head but hard to program unless you have a Post that makes it easy.
- Custom Drill Cycles: We mentioned custom deep hole cycles but there are many ways to optimize drill cycles in the Post.
- Tool Life Management: Tracking and managing tool life can be done via custom post.
- Familiar Patterns: There’s more than one way to do things in g-code. Having all your part programs used the patterns you’re used to seeing and standardizing these throughout the shop is a good way to increase productivity.
- G-Code Documentation: Ensures standard comments are added to g-code so it is well documented for the CNC Operator.
- Variable Setup Options and Partial Machining: Sometimes you want to be able to manufacture fewer than the maximum number of parts in a setup without having to air cut the missing parts. In other cases, something may have happened during a previous run that requires partial machining of the parts. For an example, an endmill broke and so air was cut instead of the part. It’s possible to set this sort of thing up in the Post Processor to make it easy.
Hopefully these examples give a good idea of how you can benefit from custom posts. There are many more ways to benefit once you become aware of the possibilities.
The Ugly Secret About Closed Posts
Postprocessors can be open or closed. With a closed postprocessor, only authorized parties are allowed to customize a post. They typically won’t do it for free either, so this is a hidden expense that you’ll want to be aware of. Many CNC’ers starting out will assume this is not a big deal–after all, you only need a post that works for your machine and then you’re done, right?
The truth is that it’s absolutely critical you be able to modify your posts for maximum benefit, even if you have to pay a vendor to do it. A hobbyist will get away with one post, but production shops don’t want to miss out on the advantages of having full control over their posts. A lot can be automated in this way and you won’t know everything you want to do with the post until you’ve been at it for quite some time.
Given that the most powerful post processors have a variety of features like pop up menus or the ability to automatically generate setup sheets that go with the part program, it is easy to see why accessing all that power will require the ability to change the post.
What Does a Typical Post Look Like?
Posts are typical little programs done in a specific programming language intended for the task. The language may be proprietary to the particular CAM package, or it may be related to a 3rd party post processor that your CAM vendor has bundled in. Such third party post processors may work with multiple CAM packages, and therefore they may have a larger community of users out there who you can work with to learn and make changes to your posts.
Here’s a sample post for a 3rd party post processor called PostHaste:
O[Program#] G90 G80 G40 G17
N[Tool] T[Tool] M6
M[Direction] S[Speed] G0 G[Work] X[H] Y[V] G43 Z[D] H[LComp] M[Coolant]
Infeed (apply diam. offset)
G1 Z[D] F[Plunge] G[Side] X[H] Y[V] F[FRate] D[DComp]
G[ArcDir] X[H] Y[V] I[CtrH] J[CtrV]
One of the neat aspects of PostHaste is it looks a lot like g-code. The idea is to write example code snippets in your desired g-code dialect and using the square bracket syntax describe how the syntax works. For example, an arc will often be coded as
G02 X0 Y0 I-1.0 J-1.0
Looking at the PostHaste “ArcCode” template, we see the various substitution templates:
- [ArcDir] is the arc’s direction. 02/03 define whether the arc is clockwise or counter-clockwise.
- [H] is the horizontal positoon of the endpoint
- [V} is the vertical position of the endpoint
- [CtrH] is the horizontal position of the arc center
- [CtrV] is the vertical position of the arc center.
You can see how it would be pretty straightforward to create a post using a syntax like that.
If you’re not a software developer, you may want to enlist help when modifying something as complex as a Fusion 360 post. If you are going to modify a post, you’ll want to make sure you have a solid G-Code Simulator like our G-Wizard Editor available to help you debug the output.
Custom Post Processor Survey
Do you use a custom or off-the-shelf post processor? If you’ve customized yours, what sort of customizations did you do?
You Need a Simulator like G-Wizard Editor to Customize Posts
Customizing your CAM software’s post can radically increase your productivity. The customizations make every program you create better. But, trying to customize a post without a simulator is like trying to thread a needle with your eyes closed. It’s trial and error making changes and trying to see if they worked.
You need a powerful simulator like G-Wizard Editor to help with the job. Just make sure your simulator has a post of its own. It’s a sure sign the simulator really knows g-code dialects. Most simple g-code editors lack this critical feature, and so they miss a lot. They’re not a lot better than using your CAM Software’s simulator, we know how poorly that works.
Setting Up G-Wizard Editor’s Post Processor
Before we go too much further, let’s talk about how to set up GWE for your machine’s dialect. That will get you started down the road of using the right dialect as you use GWE as a CNC simulator (also called a g-code simulator, or a cnc or g-code verifier) for your machine.
Presumably by now you have registered for GWE and downloaded and installed it. Refer to the GWE Setup page for details.
If you’d like a free trial of G-Wizard Editor, we can help:
Now follow along with this video to get GWE set up for your g-code dialect:
The G-Wizard Editor Getting Started Tour…
Hopefully that makes sense to you.
It’s inconvenient that all CNC machines don’t use the same G-Code dialect, but it is a fact of life you may as well get used to sooner rather than later. Knowing that there are differences and having some idea what they are will make it easier for you to exchange information and g-code with other machinists.
You’ll want to make sure all of your tools are on the same page as your CNC controller in terms of having the same Post settings, otherwise you’ll have all sorts of problems getting your G-Code working right.
As we go through each G-Code area, we’ll try to go over some of the Dialect differences so you can make sure all your software is doing the right thing!
- Set up and save a machine profile using the Fanuc Mill profile so you can follow along with the examples and exercises for this tutorial.
- Set up another machine profile for your machine’s controller, assuming it is not a Fanuc. Go through each option on GWE’s Post page and set the options up as your controller calls for. This will give you a GWE machine profile to use when programming your controller.
- Go through each post option in the GWE menus and get some idea what they mean and how they can differ from one controller to the next. It’s good to have a notion in the back of your mind that these differences exist. You can use the GWE post options to look up what some of the possibilities are.
- If you have a CAM package, select the proper Post for your controller and create some G-Code with the CAM package. Load the result into GWE and see that the toolpath backplot looks like what you’d expect in GWE. If it doesn’t, there are either errors in the CAM package’s Post, or you don’t yet have GWE’s Post set up to match the same g-code dialect as your post.
- Read our article 37 Things Your CAM Won’t Do For You That GCode Programming Can. This article will give you a sense of some of the Best Practices you might try to automate through custom Post programming.
- Determine whether your CAM software’s post is open or closed. If it is open, skim through the documentation and get an idea of what it might take to modify your post.
- Make a small modification to your CAM’s post that will enhance your productivity. Find something you always wish was different about your part programs and change the post to make it happen.
Next Article:MDI: CNC For Manual Machinists
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:
100% Privacy: We will never Spam you!