This article is from CNCCookbook, https://www.cnccookbook.com/gcodes-every-machinist-must-learn/
in G code, there are 5 codes are very helpful and be used often . Each of these 5 g-codes is super easy to understand so let’s go through them:
Move in a Straight Line: G01
G01 is the very first g-code you should learn on cnc router machine as it is the one you’ll use the most. It causes the machine to move in a straight line based on the coordinates you enter afterward. For example, you have a piece of material, and the top left corner is at 0, 0, 0. You want to move the cutter tip to that location, but a little above the work as you’re not ready to cut yet. You could use this command:
G01 X0 Y0 Z0.8
You can see how that would move to X = 0, Y=0, and Z=0.8. Some things to take note of:
– G-Code ignores spaces. You could’ve also typed (and you will often see in programs) this: G01 X0Y0Z0.8
– The Z-axis is positive in the “up” direction. As you can imagine, it’s extremely important to get used to which way the spindle will move, up or down, based on your commands. If it moves the opposite of what you’d expect and you’re at all close to anything, you may crash into it.
– The g-code dialect will determine whether you need that leading zero or could write “G1” and whether you need a decimal point no matter what like “X0. Y0. Z0.8”. If things act odd, be sure to check on that for your machine. Many CNC’ers just always use a leading zero because the next machine they use may require it.
Helpful Tip: Use G01, not G00 to avoid high speed crashes
The experienced CNC’er reading this will wonder why I didn’t start with G00 instead of G01. After all, most g-code programs start with G00. This is a bit of extra credit, but an important bonus point. G00 is a rapids move in a straight line. It has the same syntax as G01, so that last move would be:
G00 X0 Y0 Z0.5
The difference is that G01 moves at feed rate and G00 moves at rapids, which is the fastest your machine can use.
In g-code we refer to words and addresses. The word is the letter and the address is the number that follows. “G01” is word “G” and address “01”. Hence, we call it the “F-word” because it uses the letter “F”. This is the g-code needed to set your feedrate.
For example, on a machine using Imperial units, “F100” tells the machine to move at 100 inches per minute. When I am just moving the tip around in air, I generally will use “F100” as the rate I move. I consider that to be my “rapids” speed for MDI work. It’s slow enough you have plenty of time to react and fast enough so you don’t grow too old waiting.
You specify the F-Word before the move. So, to plunge down from our last move at a feedrate of 5 inches per minute to a depth of 1/2″ after our last MDI command we’d enter something like this at the MDI prompt:
Some things to note:
– By convention, we often run our cnc router machines with Z=0.0 corresponding to top of material. So, that Z-0.5 commands the tool to feed downward half an inch into the material. Any time you enter a negative Z value, be in the habit of checking carefully that the feedrate is set properly and that you really do want to put the cutter into the material at that location.
– Not only does g-code not care about spaces, it doesn’t care about any white space. I could’ve put the F-Word on the same line:
Spindle Speed: S
It’s time to set the spindle rpm. For that, we’ll use the S-Word and follow it up with rpms. “S1000” gives 1000 rpm on the spindle.
You type that in and the spindle just sits there. All S is doing is telling the spindle that when it starts spinning, it will do so at 1000 rpm. Kind of like “F” not causing any motion, just telling the CNC that when the motion happens, that’s how fast it should move.
Clockwise Spindle: M03
As soon as you enter the “M03”, the spindle will start to rotate clockwise at its programmed speed.
Tool Changing: T+M06 (Suits to system of Syntec and Siemens)
You could certainly manually insert a tool in the cnc router machine spindle taper. That’s not hard and you need to know how to do that. But if your machine has a tool changer, there’s a bunch of them sitting there and probably several would be convenient to access.
Above is brief introduction of 5 G code. Any question, you may leave your message on our site, at the right side. Or send email to us: firstname.lastname@example.org, email@example.com.