Want to be a better CNC'er?
Get our weekly newsletter plus a package of greatest hits, special tips, and more, all for free.I'm Ready to Be a Better CNC'er, Hook Me Up!
CAM Post Processors for Different G-Code Dialects
What's a 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.
Post Processor Schematic Overview
Typically, although not always, Post Processors don't convert g-code from one dialect to the next. Instead they work from an intermediate format that captures what g-code does in a dialect-independent way. Most CAM software accomplishes this with an intermediate format that bears no resemblance to g-code called "CL Data." The "CL" stands for "Cutter Location." There are many formats for how CL Data is represented in a file but one common format is called "APT".
If you think about it, deciding cutter locations is basically what CAM does. Here's a schematic overview of what's happening:
What is a CAM Post Processor?
A CAD Model of the part is fed into the CAM software. The CAM software analyzes the CAD model, determines what the toolpaths should be, and outputs a CL Data file. Most of the time you don't see the CL Data directly, although it is accessible in many CAM packages for use by utility software such as simulators. The Post Processor grabs the CL Data and converts it to g-code. The Post is a little file that provides the "recipe" for converting CL Data to the particular g-code dialect you've targeted.
CL Data, Simulators, and the Reason to Use a G-Code Simulator
Most CAM packages include a simulator of some sort that's able to display a simulation of the tool cutting a part. These simulations are often quite impressive, and they're useful, but they also have a critical weakness: 99% of the time the simulation is based on the CL Data, not on the G-Code the CNC machine will actually be executing. What that means is that if there is a bug in the Post Processor, or if the Post doesn't quite accurately reflect your machine's g-code dialect due to a bug or omission, you'll see a perfect simulation and then you'll have a problem when you go to run the part program on your machine.
This is why the Best Practice is to run all CAM-generated g-code through a g-code simulator. It's like getting a second opinion from an alternate doctor, and it can save you a lot of time and trouble at very low cost. Our G-Wizard Editor software is a great example of a g-code simulator. And our customers tell us it frequently catches problems that otherwise would've turned up on the machine.
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.
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 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:
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:
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:
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?
1. 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.
2. 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.
3. 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.
No credit card required--just your name and email.
Next Article: MDI: CNC For Manual Machinists
Do you want to be a better CNC'er in 37 Seconds?
Get Better Tool Life, Surface Finish, and Material Removal Rates Fast.
It's that easy. You can install and get results in a matter of minutes.