##### Personal tools
You are here: Home Converting GCode to STL
« August 2019 »
August
SuMoTuWeThFrSa
123
45678910
11121314151617
18192021222324
25262728293031
Log in

Forgot your password?

# Converting GCode to STL

 The Flow A plausible Scenario

### Abstract

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 α-shapes.

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

Assume we are given a set S2 of n points in 2D or 3D and we want to have something like "the shape formed by these points." This is quite a vague notion and there are probably many possible interpretations, the α-shape being one of them. One can intuitively think of an α-shape as the following. Imagine a huge mass of ice-cream making up the 2 space and containing the points S as "hard" chocolate pieces. Using one of these sphere-formed ice-cream spoons we carve out all parts of the icecream block we can reach without bumping into chocolate pieces, thereby even carving out holes in the inside (eg. parts not reachable by simply moving the spoon from the outside). We will eventually end up with a (not necessarily convex) object bounded by caps, arcs and points. If we now straighten all “round” faces to triangles and line segments, we have an intuitive description of what is called the α-shape of S.

And what is α in the game? α is the radius of the carving spoon. A very small value will allow us to eat up all of the ice-cream except the chocolate points S themselves. Thus we already see that the α-shape of S degenerates to the point-set S for α → 0. On the other hand, a huge value of α will prevent us even from moving the spoon between two points since it’s way too large. So we will never spoon up ice-cream lying in the inside of the convex hull of S, and hence the α-shape for α → 0 is the convex hull of S.

Original Model Reconstructed Model
1 2 3 4

Models reconstructed using the α value chosen by the algorithm

Side Top Front

Models reconstructed with increasing α values.

### Contact

 Yair Karin Efi Fogel Dan Halperin