Apr 11, 2019

Inkscape to G-Code – All You Need to Know to Get Started

Love your Inkscape and wonder if you can use it for generating G-code? You can if you read this article. We'll tell you all about switching from Inkscape to G-code.

Inkscape to G-code From Inkscape to G-Code

Sandra Bullock drawn with Inkscape. Source: Inkscape

So you’ve created an impressive design in Inkscape to the point where you want to hold it in your hand. This may then lead you to ask, “Can I send my model from Inkscape directly to my 3D printer?”

The short answer is no, not directly. Because Inkscape is not a native 3D authoring program, you will need to import it into a 3D modeling program to transform it into a 3D object.

Furthermore, 3D printers require instructions written in G-code. Inkscape saves in the SVG format. Inkscape does come with a plug-in that will generate G-code for machines that are 2D-cutters or plotters. However, you will need to use a multi-step process to convert the 2D Inkscape generated SVG file to a 3D-printer-ready G-code file.

Perhaps in the near future, Inkscape will generate 3D objects that can directly be sent to your 3D printer. But until then, we’ll just have to take these extra steps. But don’t worry, we’ve outlined them for you here.

Inkscape to G-code What Is Inkscape?

You can design gorgeous images in Inkscape, like this classic old car. Source: kurs.valug.at

Inkscape is a wonderful, professional-quality, free drawing software. If you know what Adobe Illustrator or CorelDRAW can do, then you know what Inkscape is capable of. You can create beautiful illustrations, amazing graphics, logos, diagrams, and more.

Inkscape is open source, and there are several user-created extensions that add to the abilities of this already powerful vector software. As mentioned, one available extension will output a G-code file, but it is limited to a 2D object.

If you don’t already have Inkscape, you can download it from the website. Versions are available for Windows 32-bit and 64-bit, Linux OS distributions (such as Ubuntu), and Mac OSX.

Inkscape to G-code What Is G-Code and Where Is It Used?

G-code running and Arduino pen plotter to make a circuit board. Source: EEWeb

G-code is the most-used programming language for controlling industrial and hobby machines, such as vinyl cutters, mills, laser cutters, and 3D printers.

The G-code “tells” the computerized machines how to make things by specifying coordinates in the X, Y, and Z planes. It instructs the machines where to move, how fast to move, and when to engage the tool.

The tools can be a highspeed drill bit, a laser, razor blade, marker pen, or, in the case of a 3D printer, the filament extruder. Some of the tools remove material, such as a mill or lathe. Others make an imprint or cut, such as a plotter, vinyl cutter, or laser cutters. In the case of 3D printing, material is added as the G-code is executed.

G-code is machine specific, and therefore the type of machine will dictate what it can produce. For example, a plotting or cutting machine will only be able to use 2D files. 3D printers can only use 3D files. Your end project will tell you if your G-code will be 2D or 3D.

Inkscape to G-code Step #1: Draw Something

2D star drawn in Inkscape. Source: Daniel Subia / All3DP

Now we’ll walk you through the steps from Inkscape to G-code.

Let’s keep it simple for this tutorial and draw a five-pointed star. Inkscape has a preset to draw stars that makes it easy. You’ll find the icon on the left-hand side of the Inkscape work pallet. From start to finish in Inkscape, you’ll follow these steps:

  1. Open Inkscape and open a new file.
  2. Select the star icon on the left-hand side.
  3. Drag and pull a star shape onto the work area of the file.
  4. Save it as an SVG file called star.svg.

Inkscape to G-code Step #2: Go from SVG to STL

TinkerCAD automatically turns a 2D drawing in a 3D model, like this 3D star. Source: Daniel Subia / All3DP

Once you have the 2D drawing, the next step is to add a dimension. 3D printers need, well, 3D files. This will also mean converting the SVG file to the standard STL format.

In this example, we’ll use TinkerCAD to convert the file, but any other SVG compatible CAD program could do the trick. When you import the star.svg file into TinkerCAD, the star will automatically go from a flat 2D into 3D. You could make changes to the star at this point if you choose to, but it’s not necessary if you’re happy with the dimensions.

Export the 3D star model file to an STL file. Call the file star.stl.

Inkscape to G-code Step #3: Go from STL to G-Code

3D star rendered in Slic3r. Source: Daniel Subia / All3DP

The next step is to convert your file to the sweet, sweet G-code we want it in. To do this, open the file in a slicing program, such a Slic3r or Cura. We’ll use Slic3r as an example here.

Once you have the STL file loaded, you simply click the “Export G-code…” box on the right-hand side of Slic3r. For other programs, this could be under Export or Save As in the File menu, if the option is not readily available on your screen. This will export your STL file as a G-code file.

With the G-code exported and formatted for your particular machine, you can now command your printer to print the 3D star.

Inkscape to G-code Step #4: Examine the G-Code

GCode Analyzer showing the first 33 lines of G-code. Source: Daniel Subia / All3DP

This last step isn’t strictly necessary, but we include it for those who are curious about what G-code actually looks like, or for those who want to get really advanced and edit the G-code. You can view it through one of the many free online G-code examiners and simulators out there.

A G-code examiner will display all the lines of G-code for you to see and possibly will allow you to edit it if you want to get into advanced G-code tweaking. One free website that will display your G-code is GCodeAnalyzer. From the homepage, you can drag and drop or select the star.g file. The site will load the file and display the G-code as depicted in the image above.

Inkscape to G-code Bonus: Watch a 3D Simulation of Your Print

The 3D star in the GCode Viewer simulation. Source: Daniel Subia / All3DP

Lastly, we want to give you a little bonus to see something cool. Most applications can show you 2D and 3D renderings of the print. You can scroll up or down, line by line to see what each layer will print.

While this is cool, there’s a website that takes this one step further: GCode Viewer. This site will give you a 3D simulation of your G-code. Uploading the file to this site is a bit different in that you only have the option to drag and drop the file onto the website. However, once you do so, it automatically starts a 3D animation of your G-code!

Feature image source: jherrm.com/gcode-viewer/

License: The text of "Inkscape to G-Code – All You Need to Know to Get Started" by All3DP is licensed under a Creative Commons Attribution 4.0 International License.

Subscribe to updates from All3DP

You are subscribed to updates from All3DP

You can’t subscribe to updates from All3DP. Learn more… Subscribe

You can’t subscribe to updates from All3DP. Learn more…

B719266D-CB2F-4571-9ABD-AFEC8A7D79DCB719266D-CB2F-4571-9ABD-AFEC8A7D79DCB719266D-CB2F-4571-9ABD-AFEC8A7D79DC