Wednesday, 30 December 2020

VSC as G-Code Editor

When I worked in the trade the company provided Cimco Edit.  For hobby use I prefer free and where possible open source.  After trying Notepad++, Gedit, EdytorNC and a few dead ends I've found a cross-platform solution with most of the features on my want list.  It's Visual Studio Code with an extension named G-Code Syntax.  The license is a mix of open source and not-so-open source.  It is free to use.  There are a surprising number of cnc extensions for VSC, from Fanuc specific to beginner aids and even one specific to Fusion 360's HSM post processors.

The git-hub page for vscode-gcode-syntax is here: https://github.com/appliedengdesign/vscode-gcode-syntax 

It is still in the active development stage.  A minor weirdness is the .ngc file extension being misspelled .ncg.  There are options turned off by default because they have not been fully developed at this time. Along with the expected syntax colour highlighting there is a tree view with a text description of the actions performed on each line of g-code.  The stats panel appears to be a work in progress but hopefully will include estimated run time and program travel extents.


    When a file with a recognized g-code extension is opened VSC applies the g-code extension.  On the right side of the image the g-code appears with syntax highlights.  Clicking on the large G on the far left of the screen toggles the G-Code Tree.

 

 

 

In the file tree select a file and it opens in the viewer.  Right click another file and choose "Compare with Selected" to open a split screen with the differences highlighted.  There are few ways to accomplish this but the method above is simple and reliable.  There is likely a way to search the differences with a "next" command but for now I scroll.  The 2 files stay in sync while scrolling.  Beyond finding differences in existing files this tool can be used to monitor changes while editing.

Of course VSC does all the usual text editor things like find and replace etc.  I've only begun to learn what's possible.  VSC is a text editor with IDE capabilities and includes features I may never need. For someone who doesn't mind getting their hands dirty in the g-code VSC will be my go-to editor when working in Linux (which is most of the time). 

 Update: the G-Code Tree View isn't working with larger files.  This isn't a show stopper but it would be nice to see this fixed.

 

 

 
 

No comments:

Post a Comment

Note: only a member of this blog may post a comment.