While modern CAM software has made the programming process much more user friendly, most CNC machines still use a universal language called G code to operate. This language largely consists of G and M codes that tell the machine which things to toggle on and off (like the spindle or coolant) or where to move, how to get there, and how fast to go. That makes it sound pretty simple, but to a human it can be hard to “read” G code to know what the machine is going to do, especially during long and complex programs.
So if you’re a new machinist (or are switching from manual to CNC), there are a few G-code references that you want in your back pocket, no matter the situation.
The Big Five Speeds and Feeds
G01: Move in a Straight Line
G01 is the most used g-code, as it makes the machine move in a straight line based on the coordinates entered by the machinist or generated by the CAM software. You’ll enter G01 and then your X, Y, and Z values. Keep in mind that g-code doesn’t see spaces, so while there is no need to enter them it can still be easier for you to read each line if you do. Take some time to familiarize yourself with the direction of movement, and make sure any testing you do is done safely with ample clearance between the spindle and any workholding on the table. Note that G00, while very similar looking, moves the machine at its rapid feedrate which is often extremely fast. Take care to enter the code you intend.
F: Feedrate
This code determines how fast the machine moves for any motion codes, like G01, that follow. If your machine uses imperial units, inputting F100 would mean that your machine would move at 100 inches per minute. This code is modal, meaning the feedrate remains set at the value it is set until it’s set to a new value. To plunge down from your last move at a rate of 4 inches per minute at a depth of 1 inch, you would enter F4. Z-1. There are a lot of tools out there that can help you determine your feedrate, giving you the best possible feed and speed guess for your project. For a deeper look at setting feeds and speeds, check out this blog post by Marti Deans that digs deeper into the topic.
S: Spindle Speed
Just like feedrate, you’ll set your spindle speed by using S, followed by a number. S1000 will give you 1000 rpm on the spindle, though it won’t automatically begin spinning. This is prep work before the action: you’re telling the machine what it will need to know once it starts running.
M07, M08, M09: Coolant
While some material can be cut dry, many materials cut best with some lubrication, so you’ll need to know what your coolant options are. Typically, M07 will turn on any mist or through-spindle coolant options your machine has while M08 will turn on the flood coolant. Mist is great for applications where you aren’t generating much heat and gives good visibility of the tool and in-process stock. Through-spindle can help with chip clearing while flood is the most coolant and gives the best results in facilitating material removal and lengthening tool life. Of course, all this depends on your machine configuration, and you should check the user manual to see what coolant types you have and which M code controls them. M09 will turn off the coolant.
M03 and M05: Starting and Stopping a Clockwise Spindle
Now that you know the other basics, you’re ready to get your spindle up and running. When you enter M03, your spindle will begin to rotate clockwise; M05 stops the spindle. Unsurprisingly, these starts and stops happen right away! So make sure you are comfortable with whatever commands you’ve entered before hitting Go.
Next Steps: The Right Tools for the Right Code
Your next steps will involve selecting a tool, but these references will get every machinist through the very early stages. At the MDI prompt, you’ll be able to use these codes to begin most projects without using your CAM software for small adjustments.
For more complicated g-code, you’ll need a great tool like Fusion 360, which creates tool paths in the Manufacture (aka CAM) workspace. The process is simple, intuitive, and allows for secure collaboration, making it the perfect solution for new and experienced CNC machinists.
Download Fusion 360 today and show off all your new machinist skills.