584,826 active members*
5,168 visitors online*
Register for free
Login
Results 1 to 13 of 13
  1. #1
    Join Date
    May 2007
    Posts
    22

    Notepad++ Gcode Lexer

    HI all. I wrote a Gcode lexer for Notepad++ text editor.

    The plugin itself is made by two files :
    gcodelexer.dll : the plugin.
    gcodelexer.xml : plugin configuration file.

    To install do this :
    1) Close Notepad++ if it's opened.
    2) Copy gcodelexer.dll in "plugins" folder under Notepad++ installation directory. Usually Notepad++ is
    installed under "C:\Program Files (x86)\Notepad++". Plgins folder il located there.
    3) Copy gcodelexer.xml under C:\Users\USER_NAME\AppData\Roaming\Notepad++\plugi ns\Config folder.

    Obviously USER_NAME is the name of the currently logged user.

    To remove the plugin, delete gcodelexer.dll and gcodelexer.xml from your system.

    To activate syntax highlighting there are two ways :
    1) Automatically, if you load a file with .cnc or .nc extension.
    2) Manually, choosing the language from Notepad++ "Language" menu. The name to search for is "GCODE".

    Playing with "Settings" --> "Style Configurator" ---> "Gcode Lexer" menu option, one can change the visual attributes
    used by the lexer.

    The plugin has been tested with Notepad++ 6.8.8

    Happy editing.
    Sandro

  2. #2
    Join Date
    Jul 2006
    Posts
    53

    Re: Notepad++ Gcode Lexer

    That's really nice. I've wanted gcode language support in notepad++ for some time.
    Finding this was a very pleasant surprise - THANK YOU!
    Dave

  3. #3
    Join Date
    May 2005
    Posts
    1662

    Re: Notepad++ Gcode Lexer

    I was searching for a plugin as well.
    Listing this on the notepad++ website would make this easier for others to find. Of course it's your choice.

    Thanks for your efforts
    Anyone who says "It only goes together one way" has no imagination.

  4. #4
    Join Date
    Jan 2005
    Posts
    1943

    Re: Notepad++ Gcode Lexer

    I have been using this with notepad ++ for years. https://github.com/robEllenberg/gcode-syntax

    It is the first link whe you search google for " Gcode notepad++"

  5. #5
    Join Date
    May 2005
    Posts
    1662

    Re: Notepad++ Gcode Lexer

    Quote Originally Posted by 109jb View Post
    It is the first link whe you search google for " Gcode notepad++"
    I found that and chose not to download it for some reason. Possibly appeared too Mach3 specific ?
    Modifying the xml file looks not difficult so will customize this one for my machine,
    In hindsight the same was possible with the earlier plugin. Oh well..
    Anyone who says "It only goes together one way" has no imagination.

  6. #6
    Join Date
    May 2007
    Posts
    22

    Re: Notepad++ Gcode Lexer

    Thanks you guys for trying the plugin. This is my first attempt to write a Notepad++ plugin and I started this project to also learn object oriented programming.

    It does something more than setting colors to different Gcode commands. It does a scanning of the file, setting the color of rapid motions to red, feed motions to green, circular interpolations to other colors and so on. I admit my sense of colour need to be improved. I choose these colours to mimic the behaviour of other cgode editors. It should be a visual help to immediately see what a gcode file does. I tried it with basic GCODE files without advanced commands or variables. It seems to work fine even if it could be improved.

    PS: If someone find a good colors combination, please share your gcodelexer.xml file so others can find it useful.
    thanks again for testing.
    (please ignore my english errors, my italian is better)
    Sandro

  7. #7
    Join Date
    Oct 2014
    Posts
    17

    Re: Notepad++ Gcode Lexer

    Thank's for nice plugin Sandro,
    I wanted to highlight z-axis + - movements somehow but found out that I cant edit yours as "user defined language".
    How can I make changes other than style?

  8. #8
    Join Date
    May 2007
    Posts
    22

    Re: Notepad++ Gcode Lexer

    To change lexer colours click on Settings --> Style Configurator. then choose "Gcode Lexer" from the language list on the left but
    you can't change the colout of just the Z axis (or any other Axis). Only FEED, RAPID and other command categories can be changed. As i wrote in previous message, the lexer do not set colours based on gcode recognition. It does a scanning of all the tokens and set colour accordingly to motion status.
    What I mean is that if, for example, a block contains let' say X100 Y 100 and the the last G motion command was G0, the block will be marked by the lexer as RAPID and drawn with the colour assigned to "RAPID MOTIONS" in the style configurator (red by default).
    The same line would be marked as FEED if the last previous motion command was G1 and drawn in "FEED MOTIONS" style. The same is true for circular motions and canned cycles.

    Sandro

  9. #9
    Join Date
    May 2005
    Posts
    1662

    Re: Notepad++ Gcode Lexer

    Modifying the xml file looks not difficult
    Hmm... taking a closer look at things this lexer isn't editable in xml in any useful way.

    Tracking the active gcode mode is a very nice feature. A another nice feature would be to highlight the
    minimum/maximum ranges of movement. I'm not sure if this is practical or even possible. Consider it a feature
    request to be safely ignored
    Anyone who says "It only goes together one way" has no imagination.

  10. #10
    Join Date
    May 2007
    Posts
    22

    Re: Notepad++ Gcode Lexer

    Hi. you request sounds interesting. Do you mean the lexer should highlight the max/min XYX motion ?. Why is this useful ? I'm always interested in learning from people tha make chips. I wrote postprocessors for living but I do not have many contacts with people in the shopfloor.


    May be I didn't understood you quote about XML editing. Configuration of the lexer colours doesn't not require manual XML file editing. All the configuration stuff is done via Notepad++ user interface.

  11. #11
    Join Date
    May 2005
    Posts
    1662

    Re: Notepad++ Gcode Lexer

    Do you mean the lexer should highlight the max/min XYX motion ?. Why is this useful ?
    Yes, max/min motion. Most of my gcode files are created/stored in my office. The computer in the office is not a cnc machine control and does not have a machine simulator.
    It would be helpful to scan the files for unreasonable motion, especially in the -Z direction. This feature is found in back-plotters and editors like Cimco Edit.
    My comment should be filed under 'thinking out loud' and thanks for the plug-in.

    Sorry for the late reply.
    Anyone who says "It only goes together one way" has no imagination.

  12. #12
    Join Date
    May 2007
    Posts
    22

    Re: Notepad++ Gcode Lexer

    @cyclestart : it not so easy to highlight XYZ min/max values in the editor. The problem is not to compute the values rather than to highlight the correct value in the correct input line.

    In my spare time I'm writing another program that read and analyze Gcode files and create a report trying to predict machining time. Among other things it also save XYZ min max values (in the current workpiece origin). I do not have any date for it because I only work on it on weekends (and bike season is approaching so I will have less time to code and more time to have fun I hope...). anyway I will release it here when ready.

  13. #13
    Join Date
    Jan 2013
    Posts
    0

    Re: Notepad++ Gcode Lexer

    Thank you Sandro for sharing this nice plugin!

    It would be wonderful, if possible, to be able to assign different colors to X&I, Y&J, Z&K, A, B, R movements. Something like FEED_X_I, FEED_Y_J, FEED_Z_J, FEED_A..., RAPID_X_I, RAPID_Y_J...

Similar Threads

  1. Bamboo Notepad Covers
    By svaustin in forum Videos
    Replies: 0
    Last Post: 10-24-2014, 04:18 AM
  2. Notepad++ G CODE EDIT ANY ONE?
    By VoKuS in forum Coding
    Replies: 8
    Last Post: 10-23-2012, 03:34 AM
  3. Creating TAP files from Notepad
    By ViperTX in forum Mach Mill
    Replies: 5
    Last Post: 03-16-2010, 02:05 AM
  4. Replies: 1
    Last Post: 01-29-2008, 01:51 AM
  5. Notepad G code?
    By disinformation in forum G-Code Programing
    Replies: 24
    Last Post: 02-26-2007, 11:11 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •