View Full Version : Help learning G&M Code???
atomicjoe23
01-26-2012, 10:36 PM
I'm a Tool & Die Maker apprentice with no CNC experience whatsoever. . .we learn CNC machining during our apprenticeship, but I still have another year before I get there (we don't touch a CNC machine until our 3rd year and I'm fine with that. . .I really enjoy running the manual machines) and I would like to get a head start learning about G&M code.
Also, most of the machines we have in our shop are conversational, but I would like to learn both methods to round out my education (we have G&M code machines downstairs in the regular machine shop).
Could anyone suggest a good book to learn the basics so that I can start familiarizing myself with the code?
Thanks!
macona
01-27-2012, 05:27 AM
Honestly, learning g-code now will not gain you anything. For the most part people don't program manually any more. And unless you have a machine that you can mess with it just does not sink in.
Weston Bye
01-27-2012, 07:25 AM
.... it just does not sink in.
I found this to be the case also. Even the CNC software like Mach, unconnected to a machine was meaningless to me. I needed to be able to give a command and watch the resulting machine motion to gain true understanding.
Stepside
01-27-2012, 10:02 AM
I agree with the previous posts as to it "sinking in" or not. Without actually using what you have "coded" you won't know if it works. It is kind of like taking a math test and the teacher neither corrects it nor gives you the score.
I diagree with the statement that "nobody writes code anymore". You need to be able to read the generated code so you can make adjustments when "fine tuning" the program. If you are good at writing code, quite often it is quicker to hand write the code than to use a CAM software. When you start out you will be at the bottom of the "pecking order" and probably get to use the oldest machinery which might require you to do a bit of code work.
So read a bunch so you can ask decent questions and then find someone that will let you at the least "aircut" parts on their machines.
Steve Seebold
01-27-2012, 10:15 AM
For the most part people don't program manually any more.
As stated above, FOR THE MOST PART, that's true. BUT you need to know your G&M codes so you can make manual edits at the machine.
moldmonkey
01-27-2012, 08:51 PM
I would recommend the Peter Smid books. IIRC, they are all Fanuc based but
all G-code is similiar. IMHO, you are doing it right learn manual, then hand code and then CAM. The ability to Gcode will always be good on your resume and it is still used.
http://www.amazon.com/s/ref=nb_sb_ss_c_1_10?url=search-alias%3Dstripbooks&field-keywords=peter+smid&sprefix=Peter+Smid%2Caps%2C193 (peter smid)
atomicjoe23
01-27-2012, 09:08 PM
Thanks MoldMonkey. . .G-code is still used on quite a few of the machines in our shop; we have more G-code machines than conversational machines.
Steve Seebold
01-28-2012, 01:23 PM
I have seen situations where someone who was a good CNC operator was given a piece of material and told to take it to the lathe and face one end. The poor guy hardly knew which side of the machine to stand on.
I have always said, for someone to be good on a CNC, he/she needs to have 10 years on a conventional machine.
gundog
01-28-2012, 06:30 PM
I have checked out CNC programing by Peter Smid from my local library and I think it is pretty good.
In a since I agree writing programs from scratch with G code alone is a waist of time unless your cad program won't do something that you can write by hand or edit a file and add a command. For example my Cad/Cam program was designed for router tables and does not have some of the commands for turning on coolant or doing a few other things that escape me right now for my milling machine. learning G code is helping me to understand the necessary commands that I can edit and add in.
Many of my simple programs run 14000 lines or more of code I can't imagine trying to write that by hand. My router table when cutting a full sheet will reach over 100,000 lines and run for 7 hours to cut some of the parts I make. Knowing the code can help trouble shoot problems when they arise.
Mike
macona
01-28-2012, 06:59 PM
I have seen situations where someone who was a good CNC operator was given a piece of material and told to take it to the lathe and face one end. The poor guy hardly knew which side of the machine to stand on.
I have always said, for someone to be good on a CNC, he/she needs to have 10 years on a conventional machine.
I dont agree with that at all. What happens in a manual machine often had little relevance in the CNC world. Especially with modern cam software. Give it parameters for the material and tooling and it will handle feeds and speeds. And simulation will show you what you will get.
John Stevenson
01-29-2012, 04:48 AM
Gotta agree with Macona on this one.
A few years ago I would have said the same but what brought it home to me was that just up the road from me is an Aerospace company full of all singing, all dancing very, very expensive CNC machines. We play well together, their customers are not mine and we have no need to poach and so we can borrow off each other.
Couple of years ago their lathe guy, one guy runs 3 lathes including programming on his own, came down to borrow a cut knurling tool.
At the time i was screwcutting and he stood at the end of the machine watching until I'd finished.
He said, "I'd love to screwcut" a bit amazed I asked him why he couldn't, his reply was he'd never run a manual lathe in his life, in fact out of the 10 operators they had only one guy had rum a manual milling machine.
So I asked him how they went on and he said when they get a new machine 2 or 3 guys usually have 1 - 3 days hands on training on the machine and that's it, they learn on the job.
Just as we mere manual guys had to, they also have to learn but it's a different learning curve.
For a start they have access to tooling we can only drool over unless we are mega rich.
Classic example, we choose speeds to suit material, and available tooling.
Because they have access to this exotic tooling their only variable is feed.
I watched a big 2 metre long travel bed mill doing wing spar brackets, as the code was ripping thru all the moves were G00, no G01 feed moves in sight. Revs were pegged on max at 15,000 and the only variable was depth of cut, bigger tools, deeper cut.
I asked Alan what he runs his lathes at and again the answer was flat out, he screwcuts everything at 3,000 revs, depending on material determines the depth per pass.
So when he said I've love to be able to screwcut, I replied I'd love to screwcut at 3,000 revs. :D
Rustybolt
01-29-2012, 08:14 AM
I dont agree with that at all. What happens in a manual machine often had little relevance in the CNC world. Especially with modern cam software. Give it parameters for the material and tooling and it will handle feeds and speeds. And simulation will show you what you will get.
true, but experience with manual machines will give a student an idea what speeds and feeds are effective for which materials. Which inserts work and why.What different amounts of coolant are effective. What a dull cutting tool looks like.
Much better for them to make mistakes on a manual lathe and learn from their mistakes, than on an expensive piece of CNC machinery. my.02
Steve Seebold
02-05-2012, 11:05 AM
I dont agree with that at all. What happens in a manual machine often had little relevance in the CNC world. Especially with modern cam software. Give it parameters for the material and tooling and it will handle feeds and speeds. And simulation will show you what you will get.
That's true, but if you have no manual machining experience, how do you know which parameters to select. The feed and speed parameters given in a modern CAM system are only a place to start.
MaxHeadRoom
02-05-2012, 11:48 AM
Although fairly standard, G codes are also specific to a particular type of machine, Mills, Lathes, Plasma, Punch all have there own versions.
In the case of M codes, these are written at the discretion of the MTB and can vary between the same machine types, so the MTB manuals are needed for the M code assignments.
+1 on the Peter Smid book.
Max.
billsnogo
02-05-2012, 12:34 PM
In my class we are using the CNC Programming Handbook, Third Edition by peter smid, and think it is a pretty good book. Something to consider. :)
macona
02-05-2012, 01:37 PM
That's true, but if you have no manual machining experience, how do you know which parameters to select. The feed and speed parameters given in a modern CAM system are only a place to start.
You can also use the manufacturers data for the tooling to fine tune it. CNC is more science and less guess work than people are lead to believe.
the Tormach sight has a m/g code section . it has about all the info you need and examples . probabaly the best /simple direction ive seen
Steve Seebold
02-08-2012, 11:20 AM
You can also Google G and M codes.
atomicjoe23
02-08-2012, 06:49 PM
Thanks JEZX!
atomicjoe23
06-21-2012, 07:07 PM
Well, Monday we started learning G&M code in class; yesterday I finished up my first three programs, and today I made two of the three parts. . .machining the third part tomorrow. The code is actually pretty easy and straight forward; there are a few intricacies as far as the order of the code or when a specific code needs to go before or after something else. I had to play with my tool offsets a little. . .especially after I figured out that the little Emco lathes we're learning on can't handle the .030 depth of cut (on the radius) and 0.010 feed rate that I thought that they could and my turret moved on me. After I figured out the offsets and the correct DOC and feed for the equipment I was getting my parts under .001"!
Pretty cool actually and I can see now why if I had the money I would want a CNC in my shop. . .frees me up to do other things while the CNC is doing it's job.
I'm starting my mill programs on Monday. . .should be just as fun, I hope!
Steve Seebold
07-09-2012, 10:05 AM
You can also use the manufacturers data for the tooling to fine tune it. CNC is more science and less guess work than people are lead to believe.
OK, your foreman comes to you and says "Hey Mike (or whoever) I have this simple part to do, but the CNC programmers are busy so I need you to manually write a program and make 50 pieces.
It's a simple part. All you have to do is flycut the top, and profile 4 sides and add a .125 radius on 2 corners and a 1/8 inch by 45 degree chamfer with no burrs on the other 2 corners. If you don't know your G and M codes, you're screwed.
BobWarfield
08-02-2012, 02:23 PM
It's great to know g-code at least well enough to use MDI. A lot of manual machinists are under the impression that to do anything at all on a CNC you have to do a CAD drawing, then run it through CAM, and finally get the g-code that you profer to the machine on bended knee. Hence, they feel CNC could only be useful if they need to make very complex parts or a great quantity of parts.
MDI is where you give the machine one line of code at a time to execute, and it does it immediately. Think manual machine with DRO's and power feeds on every axis when you operate this way. Except it is even better. A peck drill cycle is just one line of code.
With just a little familiarity with the basics of g-code, you can do all sorts of manual machining-style work through the MDI capability. When I surveyed visitors to CNCCookbook, I was surprised at how many claimed proficiency with the g-code. There is a graph at the top of the g-code tutorial page here:
http://www.cnccookbook.com/CCCNCGCodeCourse.htm
A whole lot of folks are able to get by or even do whole programs in g-code. I find lathe programming to be particularly easy.
Best,
BW
MaxHeadRoom
08-02-2012, 03:48 PM
And if you want to experiment without crashing the machine, practice on on free CNCsimulator.com
Max.