GCode Analyzer/Visualizer

by hudbrog, published

GCode Analyzer/Visualizer by hudbrog Nov 21, 2012


Hey everbody,

Wanted to show you a little project I've been working on for some time - gcode.ws
As you might've guessed by the topic name - it's a GCode visualizer. And I guess at that point most of you are asking why the hell anyone would write another one.

Well, mainly because I haven't found a single one that would comply with my humble list of requirements. I mean, most of them allows me to.. well.. visualize GCode file and nothing else. But when I open gcode - it's not for my estetical pleasure, it's to check that there are no problems and to see effects that recent slicer configuration changes done or for any other of several reasons. And the ones I've seen so far doesn't allow me to do that stuff effectively.
So I decided to write one myself.

Feature list:
1) Visualize GCode in 2D, layer by layer
1.1) Show retracts and restarts
1.2) Show print/move/retract speeds
1.3) Display only part of layer/animate squence of layer printing
2) Analyze GCode
2.1) Print time, amount of plastic used, layer height, etc. for whole file and for single layer
2.2) Reference visualized part to GCode file (i.e. select a certain part of 2d visalization, switch to GCode view - it will highlight list of lines responsible for visualized piece)
3) Multiplatform, available online (but works offline too), works locally (doesn't upload you gcode anywhere or download anything but application itself)
4) 3D visualization (I don't know what for, it's dull and useless.. need to rewrite it to be like in repetier host)
5) And yeah, it's slow, memory hungry and only supports modern browsers like chrome and ff of latests versions (maybe safari 6 and ie10, haven't checked)
6) Totaly open source so you can use it as you like )
Update 27 Nov 2012:
Lots of bug fixes, support for DC extruders (M101/M103), order of magnitude improvement in loading time for files with lots of Z movements (like Z-lifts)
Update 28 January 2013
Lots of bugfixes. Support for upper layer "shadowing" and setting extrusion visual thickness.
Update: spring 2013
Lots of things have changes. You can now use color differentiation based on flow rate, not speed. You can enable "extrusion width" emulation to see how well your infill should look. There is a highly experimental feature "error analysis" that is available at gcode.ws/?new
And it's migrated to another domain long time ago =)

Recent Comments

view all
Not sure if there is a PayPal donation link on your site BUT... if not please add one and I will contribute!

Thanks - Brad
Ooops, my bad, forgot to pay for services =) Should be up soon.
Great viewer but yesterday it stopped working...

403 Forbidden

Code: AllAccessDisabled
Message: All access to this object has been disabled
RequestId: C24A693136970A5D
HostId: BfyveuMoy/45DKMG/vCHJur8XVyG9xzrsD5EczFl4sW1jb0oXHPE hePnekL8xKVBAhI1yPku7mE=

More from 3D Printing

view more

Liked By

view all


Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag. Print Thing Tag


Current state it somewhat stable, at least I use it myself all the time. Easiest way to use it - just go to gcode.ws
Alternatively - you can download a snapshot of sources from attachment or go to github.com/hudbrog/gCodeViewer/
If you wish to use it locally (i.e. with sources on you local machine) - you will need to add "--allow-file-access-from-files" parameter to chrome(which is unsafe and I DO NOT RECOMMEND it), otherwise it won't work.
Great viewer but yesterday it stopped working...

403 Forbidden

Code: AllAccessDisabled
Message: All access to this object has been disabled
RequestId: C24A693136970A5D
HostId: BfyveuMoy/45DKMG/vCHJur8XVyG9xzrsD5EczFl4sW1jb0oXHPE hePnekL8xKVBAhI1yPku7mE=
Ooops, my bad, forgot to pay for services =) Should be up soon.
Not sure if there is a PayPal donation link on your site BUT... if not please add one and I will contribute!

Thanks - Brad
Really useful tool I use it pretty much before every print just to check that things are set the way I wanted
Also just came across this... nice tool.... is there a file size limit? i have to check a 40mb file... know its big... its a selfwatering flowerpot
None of the other tools I have found so far are able to visualize the gcode files onther than one layer at a time, so I was delighted to find this one -- a slicing problem I first saw after wasting an hour and lots of filament would have been completely obvious when examining the 3D view in GCode Analyzer.
Thank you for creating this, it is going right into the toolbox! :-)
Just wanted to say thank you for writing this software/website. It's used daily by me to check my g-code. Sometimes it's just cool to show it too. Friends think it's neat to be able to visualize the tool paths.
This is a great tool to help me when I'm debugging a design -- I can validate that the gcode is going to print the object correctly (or not), saving me from starting the print and discovering problems then...
nothing happen after select G code file.. maybe something wrong with my chrome browser?
Could you publish the gcode file you are trying to view somewhere? Like dropbox or mega, just so I can use it to debug.
thank you. I guess it's my broswer issue... not support HTML5
Brilliant Thank you
AWESOME!!!! I can learn what this bot is doing now!!!
That is _SERIOUSLY_ _AWESOME_! Really, I can't help, any time I slice something, coming here and checking how it will be printed... Really, great work and huge thanks!

One thing that I'm noticing is, if I use G0 (the command for the rapid movements: reprap.org/wiki/G-code#G0:_Rapid_move) for retractions, it looks like they're not showed (and I'm talking about both the red dot of the retraction and the green line of the subsequent travel move). Is that something known? Is there a plan to support it? I surely can provide some screenshots, g-code samples, or whatever you think it could be of help.

Thanks again for the amazing piece of software! :-D
It's strange about G0, it should be treated by the same code as G1. Can you create an issue on github and attach a sample gcode file that has that issue?
Best thing since sliced bread !
Very nice work. I am wondering if you could add a start and stop button for each layer to see actually where the extrusion stops. Kind of like virtual printing, but a great job indeed.
Hey, thanks! You can use two bottom sliders to to achieve kind of virtual printing effect.
Amazing job, very clear visualization! Thanks for sharing.
great! I built a rostock with a friend, and we have been printing (calibrating) about a week. And your application will be very helpfull!
Hey very cool! I think I have a whole bunch of files that do not render right. They are normal 2D cnc drawings. If you wanted to check it out for yourself they are all here in the TinyG project.

Hi, sorry, this viewer is mainly for 3d printer-specific gcode variation.. there is no support for more general cnc routers gcode planned.
This is great!
A really useful tool! Good job!

One technical difficulty though: it appears the website you are hosting it on is a bit unreliable. Sometimes it loads right away, sometimes it takes a couple minutes to load, and sometimes I get a connection timeout error. Any ideas why?

BTW the offline version works without changing "dangerous" settings in the latest version of Opera.
Hi, thanks! Basically, whole application is a static page, after you load it once - it should be stored in your browser cache for quite a long time. I've signed up for a monitoring service to check latency from different parts of the world. If it shows significant problems - I'll move it to another hosting.
Ok thanks. Basically, sometimes it loads and sometimes it doesn't. More info that might help you troubleshoot: I'm located in Central California, USA. I'm running Win 7 x64, web browser: Google Chrome Version 24.0.1312.56 m
This looks fantastic!!! Is there a way to start up this viewer with a named gcode file from the command-line rather than needing user interaction? (I currently have tatlin being invoked automatically by slic3r and skeinforge when they finish slicing to review what they've done, but wouldn't mind swapping to yours.)
Hi, unfortuantely html5 filereader api requires user to select file manualy, otherwise it would be kinda unsecure. I might get to building a standalone app for that in future thou.
Finally tried this out. Really really awesome. Thank you!
Runs better in Safari than Pleasant 3d!

Any chance we can see repeater host style 3d representation?
Being an in browser app is simply the best thing.

I wonder how long before the entire toolchain for slicing becomes a webapp.
Hey, thanks. I was looking into changing 3d representation to be more repetier host like, but every solution I came up with was either time or memory intensive, most of the time - both. Maybe I'll look some more into it, but I'm not very enthusastic about 3d view since I don't see much use for it.
You know, the only reason I even use the 3d view in Pleasant 3d is to look at how the layers overlap, i.e. how much does the current layer of a curved surface(overhang) overlap with the previous layer or the next.

Could you possibly just add a toggle for ghosting an N range of previous and next layers within the 2d view? This would be super useful for checking overlap. Sometimes if I'm really concerned, I'll screen cap a few 2d views in pleasant 3d, and overlay them in photoshop at 30% opacity. I havent seen a gcode viewer that offers this functionality. It would be useful for this user! :)

thanks again.
Hey! Finally got to work on it for a little, so implemented that function. To enable - check the lower option in "2d render options" menu. I prefer to check two lower ones. Current layer is black, higher level is magenta (and yeah, they are actually rendered first the higher one, then the lower one, so visually it lloks like black is on top of pink, but it's the other way around).
Awesome! Thanks so much for adding this feature!
That's a great idea! Certainly will implement it ) Thanks!
Well done, thanks for your hard work.
Amazing tool! Only just found it but already wouldn't be without it :-)
Just freaking awesome...i love it. Thanks so much Monsieur Hudbrog!!!
Great Mate! Awesome use of functional colouring(coloring)! 2D+3D :)
This is freaking awesome
Great work!  Runs perfekt :-)
This is excellent. What a great way to visualise the printing process! Thanks so much.
This works great on Skeinforge and Slic3r, but doesn't show me anything with MakerWare-generated gcode. Could you look into it?
Fixed ) Should work now. 
Excellent! Thank you so much!

I found a small problem though. For some models the viewer will drop either part of the topmost layer, or a few layers from the top. I know the gcode is ok because other visualizers show the whole model, and it prints completely.

Otherwise, this is a great tool and extremely useful for tweaking settings.

I wish I could make changes in the 2D interface and have it recreate the corresponding portion of GCode.
Ahh, that's a whole lot of a different tool you're requesting. I'll think about that, but for now it seems like writing one from ground up would be easier =)
Hi Hudbrog
Not sure what I'm not doing right here but I cannot get your app to view the different layers. I'm using version 17 of firefox, and in 2D view  pressing up and down arrow, also page up and page down. The scoll bar on the bottom works but not the up and down scroll bar. hmm not sure what I'm missing here. Also tried chrome version 23, same thing.
There was a bug with layer identification when Z goes up and immediately down. Should work now. 
 Try using the up and down arrow keys. These work for me. You can also click on the scroll bar, but that jumps too much, IMHO.
Wonderful tool!

3D view is blank for me on Windows 8 Pro 64bit, Firefox 17.0.
Intel HD4000 / Nvidia GeForce GT 630M. I've forced Firefox to use both without any difference.

(The objects show up nicely in 3D on Ubuntu Linux at work, so the objects should be alright)
Thanks! Can you show me the output of javascript console after you've tried to switch to 3d mode? 
Ante - in reply to hudbrog
Timestamp: 2012-12-07 21:58:09
Warning: Error: WebGL: Can't get a usable WebGL context
Source File: hobbydev.ru/lib/three.js
Line: 22339

Timestamp: 2012-12-07 21:58:09
Warning: Error: WebGL: Can't get a usable WebGL context
Source File: hobbydev.ru/lib/three.js
Line: 22339

Timestamp: 2012-12-07 21:58:09
Error: TypeError: _gl is undefined
Source File: hobbydev.ru/lib/three.js
Line: 22351
Ante - in reply to Ante
Ah just dove alittle deeper on one of those warnings.

"about:support" in Firefox states this under Graphics;
WebGL RendererBlocked for your graphics card because of unresolved driver issues.

Setting webgl.force-enabled=true in "about:config" enables the 3D viewer, but I'll have to look into that further. Thanks for pointing me in the right direction.
Bug report:

First vector after a layer change or other Z-lift is not plotted correctly.
Since there is no way to attach images, I'll send you the files directly.
Thanks! I've fixed at least one bug that was causing incorrect visualization of the first commands on the layer. There could by more thou, please check.
This is *nice*! 

One feature request: any chance you could add either the ability to zoom in on a model or define how large our build platforms are? The Makerbot Cupcake's/TOM's are a 100mm x 100mm build platform whereas many repraps are 200mm x 200mm.
You should be able to zoom in/out with mouse scroll both on 2D and 3D views. With platform size.. I was planning on adding plastic parameters and other physical settings in near future.
I tried this with a 20mm box and it worked great. Every file I've given it since has gotten to 100% and then showed nothing (except the Gcode file itself). The view and info are all blank. I'm using Firefox. Am I missing something?
I've fixed the bug I've mentioned before. If you still get blank page - please, send me the files you're having problems with.
That might be a known bug, you need to reload page every time you view new file. I'm planning on fixing it pretty soon. If it doesn't help I'd appreciate if you could share the files you are trying to view and OS/browser versions.
Maybe I'm missing it, but it would be real nice to have a key-scroll combo to scroll through layers (as in Pronterface) instead of having to drag the scrollbar.
You can now use pgup/pgdwn or arrow keys to switch layers in 2D view. 
Hm, good idea, I'll implement hotkeys on the weekend, shouldn't be that hard.
Works great for me on my mac.  The 3D UI is a little twitchy/sensitive but it does the job.  Great work.
This is a really nice tool! Should really help tracking down obscure slicing problems.

Minor point: Are color mappings off a little? In my "Layer info" box, two move speeds are listed, but both have the same color (green). "Retract speed" has a red code, but a dark blue dot is shown on the rendering. These are minor and the tool is totally usable as is. Just thought you might like to know about it.
Thanks. I guess I need to write some kind of documentation to avoid confusion )
Moves are always green, no matter how many speeds there are.  Just so you can always visually see which lines are moves and which are extrusion without checking layerinfo box.  
With retractions there are two types of dots - retracts and restarts. Retracts are red, restarts are blue. I only show red on the speed list thou, I can add blue dot there too ) I guess I should remove red color from the list of possible extrusion line colors..
How to run this app?
is it not suitable for mac users?
i only got a bunch of folders and html files.

I ve been happy with 3D pleasant too (with repG) but since it doesnt support the colours from CURA and just gives me a white drawing.. i cant use it anymore.

Maybe someone knows ho i do have to change my gcode in CURA that i get the fullcoloured view in 3D Pleasant again.
Maybe its just adding some extra lines in the Start gcode file..-
For some reason I don't see my previous answer, so I'll reply again. It does work on any OS (I am using it on macos), but requires a modern version of chrome of firefox browser. It is a web application, so all you need to do to use it - is go to the link I've provided in description and drag your gcode to the designated area.
works now
Nice.  I've been pretty happy with Pleasant3D on my mac - but I'll give this a whirl and see how it does for me.  It's always nice to have more than one option for visualization tools.
Thanks, let me know how it works for you.
Works fine in the latest version of Safari.