G-Code / CNC file preview toolbox

I’m currently working a lot on my Snapmaker 2.0 A250 with the 200W CNC module for inhouse PCB fabrication and I’m using Flatcam to generate all the paths to be machined and turns out I was always a bit annoyed by the fact there was a missing preview on files not being generated directly from Luban (because of my OCDs maybe). I saw already some discussions on the Snapmaker Forum and Lightburn either but found no effective solution on this issue.

So (have to clarify this in advance before getting roasted by someone) since my programming skills are not the best, with the help of AI I’m working on this interface which lets you insert custom thumbnail previews into your G-Code/CNC files.

The development is really at the early stage, basically because I’ve been using this only for myself only and maybe there’s also someone else out there who could like this and implement in the workflow.

The working principle is simple and I tried polishing up the UI as much as user-friendly as possible.

  • The default view is made by an initial section where you can load your unprepped G-Code or CNC file, two separate windows below to (on the left for live editing it and on the right for displaying only the final result)
  • When loading a CNC file, it shows the active path (skipping all the travel move rendering) so you end up with a read view of the paths to be machined. On top of the edit window you have basic buttons for zooming in/out, reset view, fit view or change color of the path. The path can be rotated, panned and zoomed also with full 3D mouse movements if needed. Made also a switch button with two fixed views (2D & 3D)
  • If you don’t want the machined path to be displayed in the preview, you can use the top-right load button to load images or even 3D models (fully integrated and transparency is always preserved in the preview like Luban does)
  • When loading a G-Code file (in my case I’m using Snapmaker Orca and not Luban anymore), the preview settings work exactly the same as for the CNC file. You can use files generated directly from Luban if you want only to change the preview of it.
  • Last but not least, I’ve implemented also an header file check/repair mode to display the basic information when loading the file into the machine (like ETA of the job) and if the header is completely missing, it will be automatically generated grabbing the required information through the whole file.

I’ve been working on this since half a year now due to limited time and resources, I am aware that the code will still contain some bugs but it does the job in my opinion. i didn’t create a github for it but it’s completely open source
Let me know if someone would be interested maybe!

Cheers, Daniele

3 Likes