[Home]InkscapeHowto

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Inkscape is a powerful Open Source 2D drawing package. Among other capabilities, it is a fully-functional 2D CAD program. You can think of it as either a drawing package that uses the Scalable Vector Graphics (SVG) format as its native format, or as a graphical editor for SVG files. It is easy to add extensions to Inkscape for special functions.

There are two separate extensions to Inkscape to create gcode. The newer extension is called "Gcodetools"and the older extension is called "gcode." both extensions work. This page describes both ways to convert Inkscape paths to gcode files. Gcodetools has been accepted into the main code base of Inkscape and will be available without any extra effort starting with the 0.48 release.

In addition to the two extensions within Inkscape, it is also possible to use external gcode generators such as pyCAM. Some external convertors can handle .svg files directly. For other convertors, Inkscape can export to various formats, including .dxf.

Gcodetools

Setup of Inkscape (and Gcodetools scripts) on Ubuntu

Note: Version 1.7 is the latest stable version. Most of the directions below are based on v1.2. For current instructions see the link above.

How it works

Simple tutorial

Here's simple tutorial how to convert path to Gcode:

             to edit the tool information, 
                zoom to the tool details on screen
                select the text box containing the parameter to edit
                Then TEXT > TEXT and FONTS (or shift + control + T)
                Select the Text Tab on the popup window
                Edit the text
                Select APPLY

You will get a new group that contains a kind of preview of generated Gcode (straight lines (G01) are painted in red, arcs (G02 and G03) are painted in blue and green). And of course you will get your Gcode file in the selected directory. Here are some illustrations.

upload:g83147_005.png

This image is out of date - see the links for a current version.

This tutorial does not cover all functions of the extension, there are much more of them such:

All manuals, tutorials and source codes are available here:

Second way using gcode extension

Setup of Inkscape (and gcode scripts) on Ubuntu

to your /usr/share/inkscape/extensions directory. Rename those files to gcode.inx and gcode.py.

upload:inkscapeprefs.png

How it works

Tutorial

upload:inkscapeshape.png upload:inkscapebadngc.png upload:inkscapebestshape.png upload:inkscapegcodeeffect.png upload:inkscapegoodngc.png

Feedback

Please edit this section of the page to provide feedback. In particular, I am interested in finding out if it would be best to add a curve interpolation to the effect. Perhaps the best approach is some kind of middle ground.

GlenHarris?: I have modified these scripts to create a slightly different version. This version honors the units of the inkscape document, so there shouldnt be any scale problems (i.e. mm vs inches - dont know about the transformation issues hinted at above). The other main change is that it will output information in layers, see the help for the effect for more details. Also, this has been set up with a framework so that we can add automation conversion from beziers to straight lines or arcs (to within machine tolerance). You can call this effect in two ways:

Here are the files:

GlenHarris?: OK, we now have the '2.0' version of Inkscape Gcode generation. The most important change is that it will now output some shapes (e.g. rounded rectangles) directly, and it can now export bezier curves. Bezier curves are linearly interpolated to machine resolution - a future extension would be to use arcs instead.

The code has been set up in a [repository] so that if anyone can contribute further changes they are welcome. To install, grab either the .zip or .tar.gz from here:

This file should be unzipped into your '/usr/share/inkscape/extensions' or 'C:/Program? Files/Inkscape?/Share?/Extensions?' directory. You can call this effect in two ways: Make sure you read the help carefully because it will explain how to label layers etc.

Making Millimeters Default Units

And with these files the Inkscape makes nice G-code: http://dp.jstenback.com/gcode/

2013-03-23 This link is broken

Only issue is that the result is in inch, but with small modification in the python script:

       # 0.001 = inch, 0.2822222 = mm
       xScale = self.options.scaleX  * 0.2822222 # 8.5 / 744.1
       yScale = self.options.scaleY * -0.2822222 #-11.0 / 1052.37

and:

       # G20 = inch, G21 = mm
       self.write("G21\nF%.4f\n" % feed)

the script makes nice G-code in mm.

 [ courtesy of Péter Bocska on the emc-users mailing list ]

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited March 23, 2013 6:32 pm by c-68-57-23-200.hsd1.pa.comcast.net (diff)
Search:
Published under a Creative Commons License