Featured image of STL to G-Code: How to Convert STL Files to G-Code

STL to G-Code: How to Convert STL Files to G-Code

Bill Porter
Mar 26, 2019

A stereolithography file, or STL, is a common method of expressing a 3D concept model. Most manufacturing systems, however, require G-code. To this end, you might be wondering how to convert STL to G-code. Find out in the following!

All3DP is an editorially independent publication. All product reviews and recommendations are the unbiased opinion of our editorial team, and can not be bought or influenced. To keep All3DP free and open, we finance ourselves through advertising and affiliate revenues. When you purchase using a shopping link on our site we earn an affiliate commission. Learn more.
Advertisement
Contents
STL to G-code

What Is an STL File?

3D render of a concept pig showing the triangular polygons overlaying the shape.
3D render of a concept pig showing the triangular polygons overlaying the shape. Source: All3DP

Stereolithography, or STL, is a 3D file protocol developed in 1986 by Chuck Hull of 3D Systems. Typically employed as the output model of a CAD system, STL is, in short, a means of describing a 3D object in mathematical terms.

These descriptions store and transfer data about the file model in the form of tiny geometric shapes, which join together to form the subject’s surface, much like in the image above. And while STL has become the defacto standard file format for 3D printing, few 3D printers actually interpret STL directly. Instead, the STL file must first be sliced into G-code layers.

This is the job of a slicer.

Advertisement
STL to G-code

Model Slicing

Diagram showing the steps of a model through a slicer to a 3D printer.
Diagram showing the steps of a model through a slicer to a 3D printer. Source: Shropshire3DPrinters

To understand the need for slicing, one must first understand the 3D printing process. Once a concept model is defined in the chosen CAD program, it is prepped for manufacture by being sliced into layers.

Model layers are defined bottom to top. Each layer is a 2D definition of the model’s geometry in the X-Y plane at a particular height in the model. Slicers define these layers in G-code, the positioning language of all CNC machines.

Each layer’s thickness is up to the user’s discretion, but typically runs 0.2 to 0.4 millimeters. Each layer then is built onto the 3D printer’s build surface, one atop the other. At the end of this, you get your model printed in 3D.

Advertisement
STL to G-code

Slicing is Handled by Machine-Specific Slicer Programs

Model of a dragon showing the slicer parameter settings
Model of a dragon showing the slicer parameter settings Source: All3DP

Slicers are the software that analyze the concept model and break it down into the proper machine code.  While there are several popular slicers on the market, they all share some common features:

  • Each slicer is tuned to a specific printer. The tuning is generally left up to the user. Parameters max speed, corner radius, accel & decel curves, stepper angles and the like must be defined for the slicer.
  • The slicer must know what type of filament is in use. Print head, bed temperature, and to a degree print speed must be individually adjusted to the printing material you’re using.
  • The slicer must be set to the desired final product quality. Layer height, print speed, infill percentage, and top, bottom and sidewall thickness play a huge part in the printed model’s quality and presentation.

The purpose of the model will play a part in defining these parameters. If you’re drafting, you may consider the ‘draft mode’ to save on material and time. If you’re printing a piece to show off, you may consider a slower print speed and smaller layer height to have a nicer finish. All of these factors are under control of the slicer, all becoming part of the final G-code.

Advertisement
STL to G-code

How to Choose a Slicer Program

Cura Slicer work area showing 18 Benchys on one print bed.
Cura Slicer work area showing 18 Benchys on one print bed. Source: All3DP

So, with all the slicers that are available, how do you choose the best one for you? As a rule of thumb, start with the one that comes with (or is recommended for) your 3D printer. These ‘standard issue’ slicers will come with good support and a wide user base, making it a great place to start.

But don’t get locked in. There are many slicers out there, most of which are free. Once you’re familiar with the general way a slicer works, consider branching out to one that might give you different options and capabilities.

All slicers have a similar user interface. All offer mostly the same parametric adjustment capability. However, the efficiency of the actual G-code, the way details are transported from conceptual to actual, and the overall ease of use varies greatly from program to program.

All will have a learning curve so don’t give up on the first failure! Practice on a few different slicers, then go with the one you develop the best taste for.

Lastly, you may want to join a user group for your 3D printer. If you outgrow the default slicer, or your prints tend to lean more toward the exotic, find out what others are doing to meet similar challenges.

Advertisement
STL to G-code

The Icing on the Cake

Miniaturized 3D printed model of a baby.
Miniaturized 3D printed model of a baby. Source: Studiofathom

Once you’ve designed your model in CAD and saved it as an STL, slicing is the finishing process to convert your STL to G-code.

Select the parameters that suit your needs, adjust scale and desired quality, hit “Slice” and viola, a custom G-code file ushers your new baby into the world. You just have to be ready with the cigars.

Feature image source: Bill Porter / All3DP

License: The text of "STL to G-Code: How to Convert STL Files to G-Code" 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…

Advertisement
Recommended for you
Topics
Follow us

Advertisement