Close this search box.

Converting GCode to STL


As 3D printing become more prominent, concerns about security issues related to the 3D printing process arise, specifically, the issue of intellectual property theft of 3D models. In the 3D Printing Process, a 3D model, typically, represented in the STL format, is converted to a sequence of instructions in GCode, which are interpretable by the 3D printer. The conversion process is referred to as Slicing, as it cuts the model into horizontal slices (layers), generates toolpaths to fill them and calculates the amount of material to be extruded. A plausible scenario follows.  In a large firm, a 3D printer is connected with a cable to a controller PC. In order to protect the firm’s intellectual property (STL models), the models undergo slicing and the GCode commands are sent over the cable for printing. A hacker has gained access to the network, and intends to steal the models. The goal of this project is: Given a file that contains printing instructions of a model in GCode (.gcode), recover the closest possible copy of the original model, represented in the STL format.  In the slicing process, a continuous 3D model (polyhedron) is converted to printing instructions using discrete sampling. As a consequence, there is a loss of information in the slicing process; thus, the reverse process cannot obtain the exact original model.

First, we parse the GCode instructions provided as input in a file and extract the toolpath. Then we sample a point cloud along the toolpath. Finally, we reconstruct the model using \(\alpha\)-shapes

Converting GCode to STL
The Flow
Converting GCode to STL
A plausible Scenario

A bit about \(\alpha\)-shapes (from the referenced article)

A bit about α-shapes (from the referenced article)

Original Model Reconstructed Model
1 2 3 4
GCode to STL GCode to STL
GCode to STL GCode to STL
GCode to STL GCode to STL

Models reconstructed using the α value chosen by the algorithm

Side Top Front




Yair Karin
Efi Fogel
Dan Halperin

Yair Oz - Webcreator


Skip to content