Monday, March 12, 2012

using Inkscape and Gcodetools for CNC plasma cutting

I like SheetCam for generating G-code for a CNC plasma cutter from DXF or SVG drawings, but I prefer free and/or open source programs that students can use on their own computers. Inkscape and the Gcodetools plug-in achieve that.

Version 0.49 of Inkscape will include Gcodetools, but until then we have to extract the contents of the Gcodetools download (using a program such as 7-zip) and put them in the appropriate Inkscape directory (probably c:\Program Files\Inkscape\share\extensions\ on Windows).

Once you have this set up, start up Inkscape and check under the Extensions menu for Gcodetools.
If it's not there, close Inkscape, make sure the files are copied to the correct directory, and restart Inkscape.

The process for creating G-code from a drawing follows:

Open (or create) a drawing in Inkscape. Make sure the bottom left corner of your drawing is at the bottom left of the document. As an example, I'll be making an arcade controller top for mounting buttons and a joystick.

Convert all objects to paths. Keyboard shortcuts to do this are <Ctrl><a> (to select everything) then <Shift><Ctrl><c> to convert objects to paths.

You should now have only "objects of type Path".

Now we need to set some orientation points. Click on the Extensions menu and select Gcodetools then Orientation points....

Change the Units to inches (in) and click Apply then Close.

To specify that you're going to use a plasma cutter, click on the Extensions menu and select Gcodetools then Tools library...

Select plasma and click Apply.

This will create a green text box with your tool definition in it.

You will be able to edit the text to edit it and change things like your feed rate. For now all we want to do is remove some of the "gcode before path" lines. Double-click that text box and delete everything but the line "M03 (turn on plasma)" so that it looks like this:

Next you will need to select all of your objects again (press F1 to use the arrow tool again instead of the text tool) and choose Prepare path for plasma...

This will bring up a window allowing you to create lead-in and lead-out paths, as explained in this article on torchmate.com. You'll probably want a short in-out path to make a cleaner cut and to show you which direction the torch will be cutting. Remember that the units for the length are inches. Click Apply create the paths and click Close to close that tool once it has finished.

If you don't like how the in-out paths look, you can undo it and try again until you get something that looks like this:

You can now select and delete the objects in your original drawing so you will just see the cut paths.

Now select Path to Gcode....

Click on the Preferences tab to make sure you will be saving the file onto your flash drive (e.g. drive e:\).

Select the Path to Gcode tab and click Apply. Read through any warnings that pop up, but you should get some usable G-code.

Open the file in Notepad or a similar text editor, and it should look like this:

The one thing you'll want to change is to delete the M3 on the fourth line of the file. M3 is the Gcode for turning on the torch, and we don't want it to turn on until the torch has moved into position. You can eliminate this step by having an empty file in your output directory (e:\ or wherever you specified earlier) that is called header.txt (edit: the empty file should just be named header with no extension).Your output file will then look like this:

Open that output.ngc file in Mach3, make sure everything looks as you expect, set up the torch (talk to your Instructor about the torch settings), and click Cycle Start (or press <Alt><r>). You may need to click (or press) this again every time the torch fires if it's set to pause before cutting. 

Hopefully everything will work for you and you'll have a nicely cut metal project.


16 comments:

Kerf Developments said...

Thanks for that, I was struggling with a similar problem.

Kathrina said...

That is a very detailed instruction on how to create G-code from a drawing. It really helped me on my current project. I hope mine will be successful and I would try to use your suggestion to try Inkscape in the future for my cnc plasma cutter projects.

Unknown said...

Useful Information...nice post and in detail..thanks..

hypertherm plasma consumables

Anonymous said...

Thx kindly! Informative

Currently on my own build plasma cnc, I use Sheetcam with postprocessor MP1000THC. The THC product of cncdirect and, I am running it with a floating head to reference Zero for Z axis. Thus would like to know if there is a way to set up - either as in the 'green' section under tool library - that it could perform the same?
Would the changes remain in library then at it is std to the machine in use?

Also is there a way - when posting code to Mach3 - that it is free of the header and M03 that needs deleting?

Thx Again,
Shane.Schuller@vodamail.co.za

David Hay said...

@Shane.Schuller I've only briefly used SheetCam, so I'm not sure about your first question.

As to posting G-code without a header, make sure you have an empty (blank) file in your output directory that is called header.txt.

David Hay said...

Oops, not header.txt, the empty file should just be named header with no extension.

Jack said...

Hi, I am following your guide and have come across an issue with the plasma paths being produced on the wrong side of the profile to be cut. Can you suggest how this can be determined?

David Hay said...

@Jack Try moving the orientation points to inside (or outside) of what you're trying to cut.

Matthias said...

Hi, great instructions. Thanks.
I have a problem with a bmp (it´s only a comic figure with one black line). When i set the path to the gcode, i get one line outside the picture and one line inside the picture. But i want only one line(the same like the picture).
When i paint a line with the pen, so it works, but not with the picture.
Thanks

David Hay said...

@Matthias When you're tracing (vectorizing) the bitmap, you can try brightness cutoff instead of edge detection. You can also experiment with Inset, Outset, or Simplify under the path menu. Another option would be to just delete one of the vectors (either inside or outside the original line) and see if it looks close enough to the original image.

djvstudio said...

Looks like it’s been awhile that anyone has posted. Not sure if this is being monitored anymore but I’ll try. I’m using Insksape and would like to move my pierce point outside my drawing. The problem I’m getting the pierce is making a small round circle on my cut. Everything is cutting perfect but I’m gave to go back and spot weld and fill in the pierce point then scribe etc. my thoughts if I could pierce outside my drawing then complete my cut I could save bit of time. Can you help? my email. dickievaughn@gmail.com

djvstudio said...

Wanting my pierce points to start outside my drawing to eliminate the round defect in my cut. I’m having to go back and spot weld, grind to fill in pierce point. Can you help! I’m using Ink Scape

David Hay said...

@djvstudio I haven't used Gcodetools (or plasma cutters) in quite some time, but I'm sure it should be possible to move the pierce point outside your drawing. Perhaps modify your drawing so that the line starts outside the final shape that you want.

jos said...


if you convert the paths to plasma code, you can afterwards move the points with adjusted nodes and then convert them to g code

jos said...

if you convert the paths to plasma code, you can afterwards move the points with adjusted nodes and then convert them to g code

Plasma cutters expert said...

Thanks for sharing. Top plasma cutters here. Thanks!