The Importance of G-Code

Does a machine operator need to know G-code? Or are modern machines smart so we don't have to be? Opposing sides raise some dust in this thread from the CNC forum. August 30, 2005

QuestionI taught myself how to run a Morbidelli Author 430 CNC. Here at Ithaca Hardwoods we do a lot of curved walls and c-tops and I am wondering how much of the CNC world uses cad/cam programs and how much uses g-code? I know a little about g-code and wonder if I should learn more to pursue a serious career in CNC programming.

Forum Responses(CNC Forum)
From contributor I:I think that the future is software that generates G-code and machines with a PC front end. No knowledge of G-Code is required to operate machines when you have the right software.

From contributor Y:The cam software will do the math and write the code and they are getting much more user friendly. But if you donít understand g-code and how it works on your control, you will never be able to edit a program with a bad character that causes an error. If you want to go beyond the basics, you will need to learn g-code and how your control understands it.
From contributor R:Like any other profession, the more you know about what you do, the better you will be. Those who rely solely on the g-code posted from their CAD/CAM software are destined to be only mediocre.
From contributor J:The last few responses are on the money. A child can draw something on a cad/cam program and have it generate code for toolpaths. If you are serious about understanding the machine that you are learning, learn to understand the g-code. A real programmer can write or edit g-code line by line.
From Brian Personett, forum technical advisor:I'm going to go against the grain here. I used to know G-code, but have pretty much forgotten most of it. The reason is I haven't looked at it for probably 10 years. What's more is I can name a bunch of guys/companies right off the top of my head who are producing top quality products with CNC equipment, and most importantly making money, who can't spell G-code.

"But if you donít understand g-code and how it works on your control you will never be able to edit a program with a bad character that causes an error."
I think you're missing the point of CAM software. When properly set up, there are no bad characters - there's nothing to do other than run the parts.

Contributor R, I disagree. Building cabinets or whatever you use your CNC equipment for is a means to an end, hopefully making money. My truck gets me from here to there - I don't care how the engine turns the wheels. I don't need to know.

Contributor J, I won't disagree, a real programmer can do whatever he wants to do with Edlin, Wordpad, or Notepad, but why - just because he can?

From contributor C:I'm with Brian on this. I do the drafting, toolpathing and all too often the cutting with our CNC machine. I do know how to edit the code, but it's been so long since I needed to I'd have to do a lot of thinking about it. Heck, I used to speak fairly decent Russian, but not having used it for the last twenty years, I can say hello and ask for a beer but not much more! The CAD/CAM program just makes it very easy. I've got a few carving programs that top 10,000 lines of code. Anyone want to try editing that by hand?
From contributor J:Everyone makes a good point. Maybe we are overcomplicating the issue. Keep in mind that the original question came from a self-taught operator.

Any good operator needs to have enough understanding of g-code to alter feed rates, spindle speeds, etc. in order to get the best efficiency, production, and performance from the machine.

I hope we are not confusing the questioner, who seems to be relatively new to CNC machining. Start with the basics and work your way through. Don't let a bunch of us old programmers arguing methodology throw you.

From contributor D:I have been a cabinetmaker for over 25 years. Last year we purchased a Komo to start our twentieth year in business. The main reason we went with them was that I could see immediately how easy it was going to be to program. Inside of one week we were doing things in hours that would have taken weeks the old way. We are a custom shop with only short production runs. I honestly do not see a need to edit g-code directly. I review the program to check for z negatives only. If there's a problem, I can go back, erase and recut inside of one minute. We have run over 2000 programs over the past year. I needed to call tech support once. I need to do a job, not change careers.
From contributor M:I wrote thousands of programs with word processors back in the bad old days. Now I draw geometry, apply toolpaths and output code. Rarely do I ever read the resulting code. However, I always read code and make certain that there are no errors when running expensive aggregates. Just last week I caught an error that needed to be addressed in my post by the software techs. Had I run the code without a care in the world, I would have crashed an expensive aggregate due to a rapid movement and a c axis rotation without a safe Z rapid first. Although code debugging is not a daily issue, someone in the shop should know how to read code. How would you know by looking at a bad part if the problem is in the code, the setup, or the machine? Why would you put yourself at the mercy of a technical department? Not all of them even have the personnel to call you back in the same workday. Know your machine(s), how they work, and understand the code. Once you understand the basics, the mystery of CNC is suddenly no mystery at all and all the time spent on the phone asking remedial questions stops.
From contributor G:The software available today is so much better and easier to use than it used to be. Everything has been debugged so well that problems are few if your system is set up correctly. The biggest challenge is when there is a problem or a cutting situation that needs a certain strategy in order to work. The shop that has true knowledge of their machine and how it works along with all the programming skills is at a major advantage. I've said it here before. Keep in mind that the "A" in CAD and CAM stands for aided. The software is there to aid you, not to do your job for you. If you are more skillful than the next guy, you have something to sell. All others who simply let the software take over may find themselves battling price with their competitors while leaving quality and service behind.
From contributor E:Can't read the code that runs your 100K machine at breakneck speeds? I suppose software generated code can be great when all works properly, but how about those parametric G-code programs? Programs which perform multiple operations based on variables and calculations (which get re-used sometimes hundreds of times in one file) not only for depths and speeds, but part feature placement. Where just a few numerical adjustments result in a perfect fit or position or even in a different part, versus redrawing, reposting and retransferring a part file often for minor adjustments.
From contributor D:Contributor M, are you trying to tell me the only way to check a program is by reading the output file? There is a tool check option with the program. There are spindle, feedrate and traverse overrides on the controller. Did I not say I was checking for Z negatives in word?

Contributor G, my job is to build cabinets and millwork in the most efficient way possible. The cutting strategies I have seen are now accomplished using different technology. I love the fact that a Porter Cable router on a twenty foot long stick is no longer required to cut radius work.

Contributor E, parametric macros are also part of the software. You make a few numerical adjustments inside a field of the software.

You guys seemed pretty quick to jump all over me. I wonder how many of you have bothered to learn cabinetmaking and not just parts production. Everything I need to do with this machine, I've done using other methods. Why would I want something that would take three to six months to learn to operate? The machine was productive inside of one week due to simplicity of the system. The challenge has always been to make money while learning new processes. Anything that makes that easier, I'm all for.

From contributor E:Very important point. I just bought a Motionmaster CNC to replace our small stepper router. Learning it has been long and involved and there's always way more to learn. Of course we need to now how to get the most out of our investment. At this point I wish I had gotten a fast, powerful machine with a simple and limited controller, like Precix. I spend more time dinking around with this thing. A simpler controller probably is more productive unless you have a dedicated, well-trained operator.
From Brian Personett, forum technical advisor:Some of this debate may be a little skewed in that I think several of the "pro" G-coders come from a router (dumb machine) background. The machines the original poster mentioned were P2Ps (smart machines). This could explain some of the difference of opinion. It's readily apparent to me that machines are reaching the masses, as is evident by the religious type zeal that people defend what they do. Anyone ever seen or been involved in a thread regarding the proper methods of how to do anything building cabinets?

If it works for you, do it. I personally don't see the need or have the inclination to look at G-code. If you feel better doing it, or feel you have some kind of mastery of your domain, knock yourself out. My only point is it's not necessary today.

Contributor G, I take exception to your remark about battling price with my competitors. CNC equipment should give you better quality parts faster than producing with manual processes. By its very nature, your quality and service should be improved.

From contributor I:It's obvious to me that there are two groups of people here - those with new technology and those with yesterday's technology. The latter group is just one of many in today's world that have had their job simplified by computers to the point that an average mortal can fully program, operate, and maintain a "CNC machining center."

Make no mistake, "destined to be mediocre", "a real programmer can edit g-code", "a child can draw in cad and produce code" are meaningless words. The proper answer to the original question is technology has taken us to a point where editing g-code is no longer part of the equation. Not one thing has been mentioned yet that I cannot do on our Weeke BHP 200 (2005 model year) that requires the use of g-code - simple. By the way, could someone tell this programmer what a bad character is?

From contributor O:"Should I learn more about G-code to pursue a serious career in CNC programming?"
Look at it this way. You might end up in the shop with one of those "dumb" machines and if you don't know anything about G-code's various flavors, then you might find yourself in a not-so-good position. Or, you'll find a job where the shop has one of those "smart" machines, like contributor I's Weeke, where little needs to be known about CNC code but you might find a library of programs written parametrically, which is part of knowing CNC G-code. Again, not good.

My point is the more you know, the better off you are. If you want to pursue a serious career, learn as much as you can. Chances are, it will not be enough.

Brian Personett, forum technical advisor:I'm not trying to pick a fight. What goes on in your shop has no bearing on mine and vice versa. To satisfy my curiosity and help clear up the matter, here's a question for everyone. Have you programmed a P2P that was made since 1996? I don't think you guys understand how a modern controller works on a P2P or hybrid machine.

I'm not arguing that knowing G-code isn't useful information. If the questioner is interested in pursuing a serious career in CNC programming, who's G-code should he learn? AB, Fanuc, Siemens, TPA, Fagor, etc? Yes, basic G-gode is the same from machine to machine, but each control also has their own little quirks and tweaks. For example, if you try to feed Biesse's G-code to a Fanuc controller, it won't work. To be considered a serious programmer, does he just need to know one, or does he need to know multiple sets? If he needs to know multiple sets, which should he learn?

Lastly, if the questioner is in fact wanting to pursue a serious career in CNC programming, I'm guessing that he's probably going to need to know something about CAD/CAM software as well. The odds of him landing a job in a shop that is still using a text editor are slim at best. My experience is the learning curve for CAD/CAM software is a heck of a lot steeper than learning G-code. At this stage, I'm going to execute an M002.

I don't program anymore. I hire programmers and for me, a serious programmer is able to program various machines and using his/her knowledge of other CNC systems is able to quickly apply this to new systems and different industries.

If you learn 1 system and run it for 40 years and retire, good for you. But if you want to switch jobs, lose a job or maybe (gasp) switch industries, then you may want to have something those other 1000 guys don't have.

I am not saying you can't run that thingamagig one way or another, I am saying a programmer's market value increases with his/her knowledge, experience, etc and knowing more is definitely a good thing.

As I stated before, even if you learn a few CNC systems, chances are you'll come across some you don't know. But, believe me, the more you know, the easier it is to pick up on new systems.

To the original questioner: I don't know your situation, but I suggest you see what your local tech school offers. They may even have wood programs with CAD/CAM classes specifically for wood router/point-to-point machines.

From contributor V:I'm not a programmer, I just run the machine. I'm very thankful that the training I got from the factory included g-code. The guys doing the drawings and exporting the dxf files are as new at this as I am. There is the occasional bad part that I can either fix or skip over, either of which I couldn't do without g-code. I also had to write my own flycut program and one to warm up the router at the start of the day. I sometimes run a part "in the air" first, just to be sure before exposing an expensive sheet of goods to the bit. I sometimes put in a "stop" code for various reasons. The point is, with our particular machine, a 2005 model, I couldn't get along without some knowledge of g-code.
From the original questioner:I am self-taught. I do know how to use xilog plus enough to change my tool speeds and to adjust things I want. I can't sit there and write code after code and I don't know what a bad character is, but I bet it's what messes up my program until I fix it. I have been running this machine thingamabob for a year and a half and I have had no serious problems. The problems I have had were taken care of over the phone. I don't want to type code if I don't I have to (but I will). I just want to be able to do everything asked of me.

You all have good points - I just think some of us are at different levels of thinking. I don't know about the situations at your shops, but I am also the driver and carpenter first. I don't just program the Morbidelli! But I am still a dedicated programmer dude. I've checked out schools, but most of them are teaching what I already know.

From contributor P:You can do things with a text editor and knowledge of g-code that you can't do with the "smart" controllers.
From Brian Personett, forum technical advisor:Contributor O, I didn't say "don't know" as you quoted me, I said "don't understand". I stand by my statement.

I still maintain that a "serious", however that's defined, programmer better have some kind of knowledge of CAM software. No one has addressed my issue of the learning curve of CAM software vs. G-code.

There seems to be some confusion over my statement regarding a "smart" or "dumb" machine. I assure everyone I didn't coin the phrase in this thread. Briefly, routers with classic controllers are referred to as dumb machines. They typically have small amounts of memory, no PC front end, lack tool tables, etc. P2Ps are typically referred to as smart machines. They typically have a PC front end, tool tables, recognize larger files, etc. Sorry if I offended anyone by insulting their machine's intelligence.

From contributor B:You have to choose one of two options depending on your career desire:
Option 1: If you want to be a hard bred programmer/coder, go ahead and learn g-code, but don't stop there, because g-code will not fetch you enough money to keep your head above water. Why? Because g-coding will become extinct like sub-score century dinosaurs. Go further to learn graphics and GUI programming so you can design (not use) CAD/CAM and CNC machining software. Who can tell? You might soon shut down Autodesk in competition. That way, your programming career will be quite rewarding.

Option 2: If you want to retain your high paying machining job, or even spin a startup turning out marketable products in large volumes, then leave g-code alone and grab your CNC machines' CAD/CAM software like a baby does its mother's breast and suck up the details of its usage until your production/sales graph heads perpetually heavenward.

The comments below were added after this Forum discussion was archived as a Knowledge Base article (add your comment).

Comment from contributor L:I've been in the business for over 20 years. The problem with relying on cad/cam with no knowledge of code is two-fold. One, your success is only as good as your package was set up. Every cam package I've worked with can be tweaked over time to be more efficient. I've improved efficiency at all positions I've taken where a "programmer" was using cam software as is not reviewing the code.

Second, when a problem or adjustment is encountered you are stuck. This could be something as simple as a quick program shift because your sheet stock doesn't have melamine running the full sheet. Basic G-code knowledge is a plus to any programmer. What if you have to flip a sheet to do operations on top and bottom? Not many cam programs have P-stops or programmed safe zones to clear the spindle out of an operatorís way for safety. These are just a few examples of the benefit of some G-code knowledge.

Questions entered in the Knowledge Base Article comment form will not generate responses! A list of WOODWEB Forums can be found at WOODWEB's Site Map.

When you post your question at the Forum, be sure to include references to the Knowledge Base article that inspired your question. The more information you provide with your question, the better your chances are of receiving responses.

The editors, writers, and staff at WOODWEB try to promote safe practices.
What is safe for one woodworker under certain conditions may not be safe
for others in different circumstances. Readers should undertake the use
of materials and methods discussed at WOODWEB after considerate evaluation,
and at their own risk.