3 Steps on How to Make a G-Code File for a 3D Printer
G-Code files provide your 3D printer with a set of instructions on how to convert your 3D model into a physical object. But how can you make G-Code files? Don’t worry; I will walk you through making a G-Code file for your 3D printer.
To make a G-Code file for your 3D printer, you need to design your model, export it as an STL file into your chosen slicing software, adjust your slicer settings, and slice the model. After slicing the model, save it as a G-Code file and export it to your 3D printer using an SD card or USB cable.
This is just a basic explanation. I will dive into the details in this article, so keep on reading to find out more.
How to Make a G-Code File for a 3D Printer
G-Code files contain instructions on how your printer will move in the X, Y, and Z directions to create your model. You will then need to transfer these instructions to your printer using an SD Card or USB cable.
Without a G-Code file, your printer wouldn’t know where to move, how fast to extrude filament, or when to change settings. Making a G-Code file for your 3D printer is very simple; you just need to follow the process below:
- Design a 3D model or download it from Thingiverse
- Convert your STL file to G-Code using a slicing software
- Export the G-Code file to your 3D printer
1. Design a 3D Model or Download it from Thingiverse
Before making a G-Code file, you will need a 3D model that you can print. The first way to do it is to create your design using modeling / CAD (Computer Aided Design) software and save it in STL format. Some popular ones include TinkerCAD, Blender, Fusion 360, and FreeCAD.
Here is a tutorial on how to make models for 3D printing using TinkerCAD.
However, designing some objects using 3D modeling software requires a bit of skill which may not be very simple if you’re a newbie or don’t want the hassle of creating one.
The simplest way to get a 3D model is to download one online and save it in STL format. Thingiverse is a good example of a website that allows you to download 3D models for free. Below is a step-by-step procedure for getting a model from Thingiverse.
- Go to Thingiverse and use the search box to find a model. Click on the model you want to download.
- Once directed to the model page, click the “Thing Files” box.
- From the drop-down panel that appears, click the download button. Ensure you choose the model’s STL file in case other file versions are also available for download.
- Save the STL file in a folder where you can easily retrieve it later on your computer.
- You can also click the “Thing Details” box to get a summary of the model and the print settings that the designer recommends.
2. Convert Your STL File to G-Code Using a Slicing Software
After designing or downloading your 3D model and saving it in STL format on your computer, the next step is to convert the file into a format the printer can understand or G-Code format.
To do this, you need slicing software such as Cura, PrusaSlicer, Slic3r, and Simplify3D for FDM printers and Chitubox for resin 3D printers.
Here is how to convert your STL file to G-Code in Cura.
- Open Cura and configure your printer settings. You can do this by going to the Printer Preferences in the top-left corner and clicking “Add Printer”.
- Choose your printer from the list and click “Add”.
- Import your STL model by clicking the folder icon on the top-left side, selecting the file, and clicking open.
- If Cura doesn’t position the model well on the bed, rotate and drag it to ensure it sits flat and center on the bed.
- Additionally, you can scale it up or down by holding the left mouse button and scrolling up or down. You can also use the tools on the left side of your screen.
- Click the Materials Settings tab and select the brand and material type you want to use from the lists that appear.
- Next, adjust the Print Settings. Click the Print Settings tab on the right side of your screen. Adjust various settings such as wall thickness, infill density, layer height, and print speed from the drop-down list that appears. Slice your model after that.
- After slicing the model, you will get the approximate print time and weight based on the selected material.
- Preview the model to see how it will be printed and if any adjustments will be required. Use the slider on the right side to scroll through each layer.
- Once satisfied, click the “Save to Disk” button, and choose where to save it on your computer. The model will be saved as s G-Code file.
Check out Rickey Impey’s video explaining the process of converting an STL file to G-Code in Cura.
If you’re using PrusaSlicer, here’s how you can do it.
- Open PrusaSlicer and go to file > Import > Import STL/3MF/STEP/OBJ.
- Choose the file you want to upload and click open.
- Once the model is loaded onto the bed, you can scale it up or down or rotate it by adjusting the Scale factors and Rotate values on the right side of the screen.
- Click the tabs on the top-left side of your screen to adjust the print, filament, and printer settings.
- After you’re satisfied, click the “Slice now” button.
- Finally, click the “Export G-code” button and save the file on your desktop. PrusaSlicer also gives you the printing times for the first layer and the whole model after slicing.
This video perfectly explains how to import a model, slice it, export it as a G-Code, and print it in PrusaSlicer.
3. Export the G-Code File to Your Printer
The final step is to load the G-Code file onto your 3D printer and print your model. To do this, you’ll need to transfer the file from your computer to an SD card and then load the card onto the SD card slot on your printer.
Alternatively, you can use a USB cable to directly transfer the file from your computer to your 3D printer.