[Home]Using Gedit To Aid In Creating Gcode

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Using Gedit to aid in creating Gcode

(later in this page we will show how to make some useful CNC related python plugins for gedit)

Gedit-(the gnome editor that comes with stock Ubuntu systems) is really a lot more powerful than initially meets the eye. It has a plugin feature that makes it very handy to use for editing CNC code. Info on Gedit plugins can be found here: http://live.gnome.org/Gedit/Plugins One of the things that makes the plugins appealing is the ability to launch other programs. This might seem strange to consider when using an editor, but it gives one the ability to edit code and launch Axis instantly to see what the code is doing. Here is how you can do that:

1. enable the 'External Tools' plugin (in the top menu bar- Edit/Preferences? then the Plugins tab then check External Tools)

upload:gedit-edit%20menu.jpg upload:gedit%20Plugins%20box.jpg

2. now you need to add a way of launching Axis - 'Tools' and at the bottom of that 'External Tools'


3. Open 'External Tools'


4. Click the 'New' icon and give it a name like 'emc'

5. fill in the description entry

6. In the shortcuts entry you can give it a hot key - like one of the function keys or <ctrl> function key

7. in the 'commands' entry box place something like this- (your path will be different than mine- good luck)-

the first part -"/home/dan/emc2-trunk/scripts/emc" points at the script that executes emc

the second part- "/home/dan/emc2-trunk/configs/sim/axis.ini" is the ini file that I used (axis in sim mode)

Just below the "Command" entry box are some pull down menu items that control how gedit interacts with your external script

For the 'Input' pulldown select 'Current Document'. For the 'Output' pulldown select 'New Document' (I am really having trouble getting the external process to let go of the program being edited and need some help on this one - DF)

Gedit will run the bash script launching axis for us. The argument - "$GEDIT_CURRENT_DOCUMENT_PATH &" means that we are launching emc with the text that is in the current document window as the program that emc/axis is going to open. The "&" lets this launch as a separate process, so that Gedit doesn't get hung up and wait for emc/axis to end before regaining control. If you don't put this in you can't edit while emc/axis is running.

Now, when you are editing gcode in Gedit, you will be able to view it in Axis by clicking on the 'Tools' menu item and then click on 'emc' (or whatever you named it earlier:


Here's a screen shot of the Gcode in Gedit and Axis running it in sim mode:


Time saving techniques with Gedit Snippets

Gedit has a plugin called 'Snippets' that is a real time saver. Here's an explanation from the gnome guru's page:


For editing gcode, snippets can be used for placing a bunch of frequently used text on the page. For instance, 'START' could define header and safety lines in a new program.


Then hit the Tab key


Then tab through the variables and fill them in.


How to write Python plugins

[Link to Gnome project page on Python plugin programming ]

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited November 28, 2009 6:23 pm by Dan Falck (diff)
Published under a Creative Commons License