Jun 9, 2019

G-Code to STL – How to Convert G-Code Back to STL

Converting an STL to G-code can be done easily, but converting from G-code to STL can be quite a challenge. Learn how to turn your print-ready file back into a 3D model!

Converting G-code to STL From Low to High Level Representation

A slicer that converts STL to G-code. Source: smilenerd.com

An STL file, or “stereolithography” file, is a very common 3D file type. It defines a 3D object using a number of triangular shapes, collectively known as tessellation. This file type is downloadable from 3D printing repository websites such as Thingiverse, MyMiniFactory, and Repables.

On the other hand, G-code files are the commands that tell a 3D printer how to print a 3D object. G-code typically describes printer parameters, such as speed and temperature, as well as the geometry of the 3D object. Typically, STL files are converted to G-code files using a slicer like Cura. However, reversing that process, going from G-code to STL, is much less common.

Why might someone want to convert from G-code to STL?

The main reason to do this is if you have a G-code file without the original 3D STL file. This is a somewhat error prone and experimental process, and it is common to experience errors in conversion. Thus, tweaking conversion parameters is often needed to obtain ideal results.

For instance, G-code files often contain non-part-related information, such as supports. When using converters from G-code to STL, these features will remain in the resulting STL and will need to be manually removed in a 3D editing software to fully recover the original STL file.

Disregarding any STL “post-processing” that may need to be done, there are two straightforward methods that can be used to convert from a G-code file to an STL.

Converting G-code to STL MakePrintable (Online)

Converting G-code in MakePrintable. Source: makeprintable.com

MakePrintable is an online 3D printing building, repairing, printing, and publishing website. MakePrintable’s G-code reverser service takes your uploaded .gcode files and converts them to useable .stl files. To perform the conversion, you will need to register for a MakePrintable account.

Next, navigate to the Labs tab and click “Start” on the G-code reverser. After uploading your G-code file, you will be asked to select “quick repair” or “run workflow”. Quick repair is the best option for beginner users who just want to get a quick result. That said, for particularly troublesome conversions, creating a customized workflow can be used to improve conversion success.

With a credit card, you can sign up for a free month of service use. After the free month, the pricing varies depending upon your use of the services. Conveniently, MakePrintable has a “repair guarantee” for paid subscriptions. If your model doesn’t convert correctly, they will repair it and offer assistance to ensure a successful conversion.

Converting G-code to STL Voxelizer (Offline)

"Voxelizing" G-code. Source: Benjamin Goldschmidt / All3DP

Voxelizer is the slicing software used by the Z-morph line of 3D printers. Voxelizer has an integrated ability to convert G-code files to STL files. This works by converting the 3D object to “voxels”, which are 3D elements of volume that describe a 3D object. A voxel can be any size, however, the smaller the voxel, the better the resolution of your object.

To convert a G-code file to STL, open Voxelizer and select File -> Import, and then select your G-code file. Once the G-code file displays, select the voxelize icon on the upper left part of the screen and select “Voxelize”.

Next, you will need to set a voxel size for voxelization: 0.1 mm is usually a good size to use here unless you are printing layer heights smaller than 0.1 mm. Ideally, matching the layer height for your voxel size, or going even smaller, will give the best results. Once that has completed, select File to export to mesh (.stl) and save the file.

Now you know how to convert G-code files to stl files with ease.

Feature image source: All3DP

License: The text of "G-Code to STL – How to Convert G-Code Back to STL" by All3DP is licensed under a Creative Commons Attribution 4.0 International License.

Subscribe to updates from All3DP

You are subscribed to updates from All3DP

You can’t subscribe to updates from All3DP. Learn more… Subscribe

You can’t subscribe to updates from All3DP. Learn more…