Throughout my career programming CNC Machines (Computer Numerical Control) as well as CMMs (Coordinate Measuring Machines) I have gained a great understanding of how a machine moves in a 3D space. Many machines have their own native programming language, but the large majority of CNC mill and Lathe machines use G Code to communicate with the machine.
A 3D printer is a type of CNC machine. It runs the same type of code as most CNC mills and CNC lathes. The coding language that these types of machines use is G and M Code. G Codes control the machines motion and functions, M Codes control all the operations that are not movements.
What Makes a 3D Printer a CNC Machine?
A 3D printer is classified as a CNC because when the 3D printer is running it is the computer numerical control that is controlling the movement, not an operator. There are operator inputs that are required to start the print, but the actual functions of the printer are controlled by the computer.
Yes, I know that we are the ones who press the start button and I know that I am constantly changing and adjusting the speeds and sometimes the Z offset while printing. At the end of the day the heat, fans, machine speeds, extrusion speed, XYZ coordinates are all controlled by the program and the controller.
A good example of a machine that is not CNC machine is an automobile. You do not have to boot a program that spells out the exact speed and how much your steering wheel will turn for every second that you are on the road whenever you are going to work or to hang out with friends. You just hop in the car and the controller is you and your senses.
3D Printer G-Code Vs CNC Mill G-Code.
The main difference in CNC Machining G code and 3D printing G code is that CNC Machining uses more G codes than 3D printing because there are more complex cycles needed like peck drilling cycles and tapping cycles. 3D printers generally move in 3 axis’s and don’t require very much special tooling or strategies.
G Code can differ from machine to machine depending on the manufacturer. Generally, M Codes are the same across different machines, but they can be different as well depending on the manufacturer.
Here is a list of 3D printer G and M codes as well as their milling equivalent. There are over 100 G codes that are commonly used in CNC milling but for 3D printing there are only around 10 that are commonly used.
|3D Printer G Codes||Milling G Codes|
|G0 Non-extruding Movement||G00 Rapid Travel|
|G1 Extruding Movement||G01 Linear interpolation|
|G28 Auto Home||G28 Automatic return through reference point|
|G29 Auto Bed Level||G29 Move to a location through reference point|
|G90 Absolute Programming||G90 Absolute programming|
|G91 Incremental programming||G91 Incremental programming|
|CNC 3D Printer M Codes||Milling M Codes|
|M0 / M1 Program Stop||M00 / M01 Program Stop|
|M104 Set Hot End Temperature|
|M109 Do Nothing Until Hot End Temperature is Reached|
|M140 Set Bed Temperature|
|M109 Do Nothing Until Bed Temperature is Reached|
|M106 Turn Fan On|
|M107 Turn Fan Off|
Can I Manually Code a 3D printer with G Code?
You can manually code a 3D printer with G Code. It is a very tedious, lengthy, and uncommon process to completely program a 3D printed part from bottom to top, but it is much more common for people who are experienced with 3D printing to modify some of their code at the top of the program.
With there being so many free slicing software available I really don’t see very much need to program a 3D printer manually. I have programmed many CNC mills and lathes manually and trust me it is a lot more fun with Mastercam or any other CAM software.
If you do decide to program something manually then some advice would be to work very slowly and methodically. Draw out your design on grid paper and map out all of your coordinates before starting to type in your code. I think it would be a really good exercise and could really deepen your understanding of how a 3D printer moves and works
What is the Difference Between Machining and 3D Printing?
I am mainly referring to CNC Milling because it is more similar to 3D printing than a CNC Lathe. If someone is creating a round part on a 3D printer, they will generally create it in the same way that they would if the part was square.
The main difference between Machining and 3D printing is that Machining removes material and 3D Printing adds Material. Machining uses cutting tools to remove material from the stock required to achieve the desired shape. 3D printing adds material from the base and builds up the shape of the part layer by layer.
CNC machining uses many tools while making one part. Commonly used tools for machining are drills, taps, endmills, and spot drills. Machining also requires much more intricate setups that hold the material securely so that the force of the cutting tool does not push or pull the part out of the work holding. Also machining typically is required to hold much tighter tolerances than 3D printing.
Really the two process probably work best and most efficiently in tandem and together. A part that is completely 3D printed probably will not be accurate enough for aerospace or defense use and would require some finishing work done on a mill or lathe. if an intricate design is difficult to achieve on a mill but isn’t necessarily a tight tolerance feature then clearly it will be better suited on the 3D printer. Another issue with 3D printing materials like steel is tensile strength.
Hopefully over time 3D printing in tandem with machining will become more common and prototyping will become more readily available and much quicker.