I've been experimenting with a new G-Code viewer, with the goal of removing the rather low limit on the size of files the current viewer can handle. It seemed like an interesting and fun challenge to handle very large and complex G-Code files in the browser efficiently.
It's still a very rough prototype, but in general it can display very large G-Code files in the browser with pretty low memory usage. I haven't managed to slice a file I couldn't display so far, the largest one I successfully loaded in the browser was around 1 GB. Memory usage is typically around 40-60% of the G-Code file size.
You can try the G-Code viewer at the following address:
or view the source at
It's open sourced under the Apache 2.0 license.
There is no progress bar or any feedback yet while loading, but it's quite fast and unless you load a very large file it should be finished in a few seconds. I got a bit sidetracked trying to make the parser fast, so while the viewer is seriously lacking in features, it makes up for that by being very fast in loading G-Code.
Right now this is a standalone project, but if I can get this working well enough it I'll take a look at whether it makes sense to create a library that can be integrated into Octoprint.
There are a lot of limitations right now, it only handles a subset of G-Code commands, but enough to display the stuff I've tried. I've tested it mostly with files slices by Slic3r PE so far. On Firefox you have to reload the page to load a new file if you have one loaded already, I didn't get the drag events right yet there. And you can only change the linewidth right now, I want to add more display parameters to this. Drawing is much faster on Firefox for some reason on my computer, I'm not yet sure if this is a general issue or not.