CAM Post Processors for G-Code Dialects

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 now.

CNC Post Processors & CAM for Different G-Code Dialects

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

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:

cnc post processor for cam

What is a CNC 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.

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:

StartCode
%
O[Program#] G90 G80 G40 G17
End

1stToolChange
N[Tool] T[Tool] M6
M[Direction] S[Speed] G0 G[Work] X[H] Y[V] G43 Z[D] H[LComp] M[Coolant]

End

Infeed (apply diam. offset)
G1 Z[D] F[Plunge] G[Side] X[H] Y[V] F[FRate] D[DComp]
End

ArcCode
G[ArcDir] X[H] Y[V] I[CtrH] J[CtrV]
End

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.

At the opposite end of the ease of use spectrum, but perhaps capable of far more powerful customization in the post, would be something like Fusion 360’s Post Processor. It uses javascript as its programming language and a relatively simple post for someting like a Tormach CNC Lathe runs to 426 lines of fairly dense code. It’s well beyond our scope to try to dig down into something like that in this article, just be aware that such things are out there.

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?

Take Our CNCCookbook Post Processor Survey

Exercises
  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.
Next Article:MDI: CNC For Manual Machinists

CAM Post Processors for G-Code Dialects
5 (100%) 1 vote

 

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.

 

Start Now, It's Free!

Home

Software

  GW Calculator

  GW Editor

  Gearotic

  Conversational

  Deals and Steals

CNC Blog

  Software

  Techniques

  Beginner

  Cool

  Projects

 

Cookbooks

     Feeds and Speeds

     G-Code Tutorial

     CNC Machining & Manufacturing

     DIY CNC Cookbook

     CNC Dictionary

CNC Projects

Resources

     Machinist's Search

     Videos

     Online Groups

     Individuals

     Reference Data

     Books

     CNC Dictionary

     Suppliers

     Tool Brands

Workshop

     Hall of Fame

     Organization: Soon!

 

About

     Customers

     Partners

     Our History

     Privacy Policy

 
All material © 2017, CNCCookbook, Inc.

Pin It on Pinterest

Share This