G-Codes vs. CAM / CNC Forums

Hi Everyone,

For those of you that have been exposed to both G-codes and CAM packages, which do you prefer and why?

If you prefer G-codes, have you gotten into parametric programming? Any examples of the most difficult shapes you have programmed for cutting?

Also, has anyone been on any of the forums for CNC discussions? If so, how are they?


If you prefer G-codes, have you gotten into parametric programming? Any examples of the most difficult shapes you have programmed for cutting?

G-Codes??? Do you mean Gerber… Thats the only thing I could thing of right now that begins with G.

No, he means the G and M codes that tell the CNC machine what to do and how to do it.

I have seen some people do the code out by hand and it works well for laying out holes and making things that are not very complex. For our needs on team 229 we used Mastercam 9.1. We did have some problems and sometimes the program required us to go back and repost some of our files, but in all it was pretty easy to use.

No, he means the G and M codes that tell the CNC machine what to do and how to do it.

Errr… Gerber code does do that.

I have been priviledged to watch the owner of one of our sponsors (J&F Machine ) hand code parts for our robot, directly on the machine. He used G-codes to do that. But it was mostly round holes with a particular center. OTOH most of the “real” work he does is programmed using CAM and is a lot more complicated.

It is good to remember that a CAM program is merely an automated way to produce G-code. So being able to read G-code, even a little bit, would probably be helpful, even when you use CAM for most of the work. It certainly helps figure out where the program went wrong.

I don’t think there is any substitute for CAM packages like MasterCAM for advanced features like contours and such. However, I’ve found that it is often easier to write my own NC code for simple things. For example, I was using MasterCAM to make something for my Project Lead the Way “Computer Integrated Manufacturing” class, and I wanted to make an inclined-plane shape. It was much easier for me to tell the CNC mill to make cuts from XYZ coordinates than to have MasterCAM do it. In any case, I think that having some knowledge of NC code is critical even with CAM packages, as sometimes you’ll want to change some of the code they kick out, such as unwanted tool changes.

We usually use Gibbs CAM through our CNC, and it works really well. We usually go into a CAD program and draw the part out, then export it to Gibbs. From there, we tell it where to cut, drill, counter, etc. and set the operations up. Then its a mater of a post, and hitting that green button!

We have run into a few problems here and there, but nothing serious and nothing that wasn’t our fault! Its easy to use, effective, and quick.

CAM is nice cause it can produce a program rather fast, although with G0codes you have more control over what hte machine will actually do, less problems during set-up. I know G-code very wel, but actually M-code, rather new. Some G-codes, but mostly cordinates, lots of control over what the machine will actually do, and is faster than a G-code machine.

Ah, the joys of CIM.

I’ve written my own G-code before (only simple stuff, basic lines, contours, and holes), and the hardest/most complicated part is figuring out exactly what the coordinates are.

It’s sort of like HTML with a twist. (This will be relevant, I swear.) I absolutely hate WYSIWYG programs. CAM programs are basically WYSIWYG programs for CNC stuff. So do like CAM? Not necessarily. It’s still a computer generated code that isn’t necessarily “smart.” However, unlike most of the HTML I’ve worked with, writing CNC code can get very, very tedious. This may sound dumb, but I honestly think it comes down to whether or not its worth it to draw it out in a CADD program. If it’s a simple design, figure out the coordinates yourself. If it’s very complicated or large, you have to figure out which would be easier- finding the coords yourself or drawing it out in Inventor. After you have the CADD drawing, it’s just a matter of setting a few options (most of which you would have to specify in your hand-written code anyway) and clicking OK.

Please keep in mind that a)It was only a year ago that I last did this, but that my retention span may be considerably shorter than that, feel free to correct me. b) Also keep in mind that I’ve really only ever done any of this in 2D. I’ve used Z coordinates to specify the depths of the cuts, but not to create inclines or anything like that. So everything I’m saying only refers to 2D designs (as far as I can say, anyway).

Not that I know anything about CNC, G-code, or CAM programs, But this is starting to remind me of regular programming. The difference between C and BASIC. They can get the job done, but it’s frequently easier in one or the other.

Another easy thing to use is prototrak (I think its only made for milling).You can actually program it right at the machine sort of like CNC, but no G, M, or F codes (Your only useing X,Y,Z axis off the 0,0,0 setting of the part) or put in a floppy disk off of a CAM program. My school is turning away from MasterCAM and we’re going to use aspree. I’m just curious, in robotics, what do you guys use CNC/CAM for? I major in Tool and Die makeing at my school and I was pretty much taught that CNC is only good for makeing like 10 or 15 or more of the same part. I found in robotics their wasn’t really much reason to use CNC because the most I made was 2 or 3 of the same thing.

I have used I-DEAS manufacturing for generating G-Code for two years. The program is pretty good. It’s major drawback is that it was ported to windows from a UNIX environment, and it is not always stable. If you can get by the weird user interface, the program is great. It generates pretty much any G-Code you can need, from simple geometries to very complex 3-d curves and contours. One complaint is the in-process stock feature (which basically shows your piece and what material is removed as it is being machined)… It calculates the in-process stock incorrectly sometimes, and it can really, really mess up the g-code, later on causing cuts in places that it shouldn’t cut. As a result, I don’t use this feature, and it works great. You just need need to know very accurately in your mind where there is material to cut and where there is not.

I prefer to use CAM packages, but it doesn’t hurt to know the G-codes for hand-optimizing the larger programs and making tiny ones of your own. I have mainly used Deskam, a hobby-level CAM program that does only 2 1/2-d parts, one toolpath at a time. I can’t afford the likes of Gibbs, FeatureCAM, and MasterCAM, although if I could or had access I would spend the time to learn them. The chain of Inventor drawing .dxf export -> Rhino for tweaking -> Deskam to convert to G-codes -> DeskNC for G-code interpreting has worked well for me, for both a converted Bridgeport and my own desktop Sherline mill.

Here’s a pic of the most complex part I’ve created the g-codes for and machined, to go on a formula car: http://userfs.cec.wustl.edu/~bdh4/FSAE/Img_1651small.jpg
The directory it’s in also includes pictures of machining the part:

Once you’ve spent some time with learning a CAM package, the complexity of the part should no longer be the limiter. It’s great when you reach the point where machining time is the limiter, not your imagination.

-Brandon Heller

I don’t think my team has every actually used CNC in robotics, but we did kick around the idea of using it for our electronics control panel. Sounds crazy, but basically, we wanted to make our own custom control panel. Instead of using the buttons on the joystick, we added our own rocker switches to our little control box to operate the pneumatics. The problem we ran into is that those rocker switches have a very, very small lip of maybe a few hundredths of an inch. If you make the hole too small, you have to go back and keep enlarging it, but then as soon as you overshoot, the switch will fall right through.

We ended up just using a dremel and spending what felt like half our lives filing the edges until we got to the right size. But the idea was that we could have used a caliper to get exact measurements and then written some CNC that would cut out holes the exact size we needed. So in robotics I think you could use CNC to make very precise cuts where you don’t trust human hands to be as accurate as is necessary.

Hello, i’m from R.A.G.E. and if i understand your question right you are asking if you should just use “G” codes verses a CAM program. I personally think you should learn “G” codes and get some kind of CAM program. It is so much easier if you know “G” codes if the program doesn’t send to the machine correctly. We use MasterCam software which was quite easy to learn. In a CAM program you can make a program in 10 minutes that would take you about 2 days to make with just “G” codes. See ya

Actually, I am currently doing research on the versatility of G-codes using parametric programming vs. CAM systems.

Seeing as most people prefer the CAM systems because of their “ease”, I have two new questions as I have limited exposure to CAM systems, as well as how the industry actually utilizes them:

  1. How is the versatility of the CAM system? (ie, How easy is it to change a tool path because you found the part dimensions were cut slightly different than what you needed?)

  2. How much back and forth is there between the person doing the CAM and the CNC operator? How many iterations are usually required to get the part correct?


CNC: Computerized numerical control
CAM: Computer Aided Manufacturing
G-Code: The standard machine tool language. Controls linear, circular, drilling operations, etc… Should work on any CNC machine.
M-Code: Controls actual CNC-machine specific operations (but is still standard among most CNC machines). Coolant, tool changes, spindle, etc…

I think most commonly, the term “G-Code” is also used to refer to a program with any CNC programmable commands, including “G” codes and “M” codes, among others. At least, I refer to a program with both “G” codes and “M” codes as “G-Code” Does anybody know for sure if this is correct? I can’t find anything doing a quick search of google.

Actually, the codes will not work on any CNC machine. Unfortunately, there are several versions of the language out there (ie, Macro 1, Macro 2, Fanuc, etc.). While many machines may be set up to use a variety of these, it it not guaranteed that all of them are contained in the system. From what I’ve seen on the web, there are language quirks due to the fact that the CNC manufacturers use a proprietary language along with their system integration. If this were not the case, then programs like EdgeCAM would not have a variety of G-Code converters for Fadal, Haas, etc.


Uh, from what I’ve learned through my Computer Integrated Manufacturing class I believe the proper name for this is just NC Code, with NC standing for Numerical Control. NC Code consists of G, M, and other codes necessary for CNC machine operation. A file containing an entire NC code program is often simply referred to as an NC File.

A google search yielded the following glossaries:


I know that our school has both a mill and lathe that don’t work with Cad/Cam software even thought they’re supposed to. So next year, the metals/drafting teacher (a member of our robotics team) is going to give me a crash course on G-Codes!..(she claims you can learn how to work it in 30 minutes with a piece of graph paper.)