May 17, 2015

How to convert G-Code back into STL?

I've been researching methods to convert pure G-Code back to STL / .OBJ, and it seems that there are not many options but it can be done.

G-Code Reverser by MakePrintable

Even in its beta version it looks the most developed out solution.

Here is the Reverser description:
The Generated G-Code commands represent horizontal layers “slices” of the 3D model, sliced as the model was placed, scaled, and rotated in the slicing software’s platform, those commands are generated with user and printer-specific settings, all of which makes the G-Code almost impossible to modify in order to retarget different printers, let alone modifying the original model itself.
Our Reverser interprets the G-code, and collects the details and data needed from the commands, then it regenerates the 3D model which represents the outcome of the printing process using the respective G-code file.
This feature allows users to reuse G-code, by regenerating the G-code using the Reverser’s outcome, and simply changing the settings, or even target other printers than the one targeted in the G-code file.
Power users and 3D designers would get the chance to modify the model once more, as the outcome of the Reverser would be in .OBJ or .STL formats, which means they can import it into 3D editing software and start with their editing.

Blender GCode Reader Add-on and GCodeImport

New version:

There are some solutions that enable G-Code visualization and / or printing simulation like but not conversion or export to STL:

GCode2Vtk that displays g-code like VTK 3d model.

GCode Analyzer/Visualizer

CNCSimulator can simulate 3d printering out of g-code

Repetier Host seems to be able to simulate g-code in 3d model bu I'm not expert on it.

If you know any other methods to convert g-code back to STL let me know so I can update this post.


Could this be used to hack 3d model streaming services? A kind of a workaround?
There are services like Pinshape that use "streaming" as a sort of DRM that enable you to print an object without downloading it in order to preserve the original .stl object and prevent sharing or piracy.
Theoretically you could us a sort of custom Marlin that only reads the g-code and records it and you could use g-code reverser to make an original STL.

Here is an example of streaming service:

Source blog post about streaming function:

DRM systems always fail and punish only a paying customer.