How to add a preview picture to your gcode

I have tried to figure out how the preview pictures are implemented into the gcode like when you send the gcode directly via the Snapmaker Luban software.
Because this is a VERY cool feature I want to know more about it.

Can anybody help me with this?

I want to use another slicer than Snapmaker Luban because I need some more options (and already purchased licences for Simplify3D).

I’ve tried to copy some parts of the Luban code to the S3D code and it seems to be only working if you replace the whole header.
Since I don’t know how important the header data are for the touch screen app and if it affects the print I wanted to ask the professionals here.
There has to be another way to implement pictures than slice it twice with diferent software and edit the gcode…

Maybe there would be a posibility to make a reference to an extra file (for example same file name as the gcode but with extension .png or .jpg)

Since nobody wanted to help me (or is not interested in the feature) I found a workaround (since I don’t know a detail of the SM Luban code) by myself:

Slice the file with Snapmaker Luban and export the gcode as a file (since I only want the picture there is no need to worry about the settings).
Then slice the model with your desired software.
Open both files with a text editor.
Now copy the marked parts from the Luban-created file to the other and save the file:

Now you can send the gcode to the machine and you will see a preview after the parsing (when you copy the complete header the picture is displayed earlier but the displayed values are incorrect).

PS: Since the header only contains the graphic all other values are calculated by the software on the SM2.0 - and the size is including skirt and end script.

PPS: Maybe somebody from the programmers (or anybody interested in this) can discuss with me about my “solution”.

3 Likes

According to our software engineers, the preview picture will appear when you print the G-code that is generated from Snapmaker Luban.

@Edwin This is obvious…

But since the picture is saved as part of the generated gcode it is possible to manipulate codes from other slicers. I have a workaround in my previous post.
At the moment I want to know the specifications of the thumbnail (dimension, resolution,…) and the way how to convert the picture.

PS: The picture of the preview on the TS is showing a gcode created by Simplify3D (with imported thumbnail from Snapmaker Luban).

1 Like
  • Make a screenshot of a model
  • Use PNG/JPG 2 Base64 format convertor to transform the image.
  • e.g: https://www.base64decode.org/
  • Add the characters in the G-code file so that the touchscreen can read and show the image
  • The touchscreen can parse the annotated characters and display the rendered image
2 Likes

I have just hacked up a plugin for Cura, which saves the image automatically in the exported gcode file.

I will try to make a polished version of it and then publish it here in the forum.

3 Likes