So you’ve created an impressive design in Inkscape to the point where you want to hold it in your hand, in all its 3D glory. This may 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 isn’t a native 3D authoring program, you’ll 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; until then, we’ll just have to take these extra steps. But don’t worry, we’ve outlined them for you here. Before we look at how to convert a design, let’s take a closer look at what Inkscape and G-code are.

Back to Contents

Inkscape to G-code: How to Convert SVG to G-code

What Is Inkscape?

Complex designs can be achieved using Inkscape
Complex designs can be achieved using Inkscape (Source: Amazon)

Inkscape is 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, which means that, in addition to being free, 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’s limited to 2D objects.

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 MacOSX.

The creation in the image above is quite an advanced design, so beginners may want to start with something simpler to kick things off. In our tutorial, we’ll opt for something easier, although practice makes perfect, and you might just be creating G-code for the car in no time.

About G-code, though…

Back to Contents

Advertisement
Advertisement
Advertisement
Inkscape to G-code: How to Convert SVG to G-code

What Is G-code & Where Is It Used?

G-code running an Arduino pen plotter to make a circuit board
G-code running an 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 CNC 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 do it, and when to engage the tool.

The tools can be a high-speed drill bit, marker pen, laser, or, in the case of an FDM 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 or vinyl cutter. 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, while 3D printers use 3D files. Your end project will tell you if your G-code will be 2D or 3D.

With the above clarified, we’ll walk you through the steps to get your design from Inkscape to G-code, ready for printing.

Back to Contents

Advertisement
Advertisement
Advertisement
1
Inkscape to G-code: How to Convert SVG to G-code

Draw a 2D design

A 2D star drawn using Inkscape
A 2D star drawn using Inkscape (Source: Daniel Subia via All3DP)

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.

Of course, the more experienced you are, or the more you practice, you’ll be able to create more complex designs, but here we’ll focus on the basics.

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 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”.

Back to Contents

Advertisement
Advertisement
Advertisement
2
Inkscape to G-code: How to Convert SVG to G-code

Convert SVG to STL

Tinkercad automatically turns a 2D drawing into a 3D model, like this 3D star
Tinkercad automatically turns a 2D drawing into a 3D model, like this 3D star (Source: Daniel Subia via All3DP)

Once you have the 2D drawing, the next step is to add a dimension, as 3D printers obviously need 3D files. This will also mean converting the SVG file to the standard 3D printing 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 want, but it’s not necessary if you’re happy with the dimensions.

Export the 3D star model file as an STL file by clicking on “Export” in the upper right corner. We’ll call the file “star.stl”.

Back to Contents

Advertisement
Advertisement
3
Inkscape to G-code: How to Convert SVG to G-code

Convert STL to G-code

Saving the star as G-code
Saving the star as G-code (Source: All3DP)

The next step is to convert your file to the G-code we want it to be. To do this, open the file in a slicing program, such as Creality Slicer or Cura; we’ll go for the latter in this example.

Once you have the STL file loaded, you can tweak the settings according to your printing setup, the material of choice, and the model you’re printing. Once you’re set, click on “Slice” in the bottom right corner and, a few seconds later (or minutes, depending on how complex the design and setup are), click on “Save to Disk”. You’ll be able to save the file as G-code, and alternatively, you can go to “File > Export” and change the type to “G-code File”.

For other programs, the option could be under “Export” or “Save As” in the File menu, if the option isn’t readily available on your screen.

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

Back to Contents

Advertisement
Advertisement
Inkscape to G-code: How to Convert SVG to G-code

G-code Extension

The
The "Gcodetools" extension is a complicated affair (Source: Ian Mitchell via All3DP)

Inkscape has added a G-code extension to its software that now allows you to go straight from Inkscape to G-code without having to necessarily go the “SVG > STL > G-code” route. Inkscape refers to these as “Gcodetools“, and while this may seem like a good thing to make it easier to convert from Inkscape to G-code, it actually appears to be a bit of a complicated process.

To access the Gcodetools in Inkscape, you need to open the “Extensions” drop-down and find the sub-menu with the tool’s name. This will give you a number of G-code options for different types of machines.

It wouldn’t be possible in this space to go through all the permutations involved for setting the appropriate route to the final G-code, so our advice at present is to follow the method we’ve gone through previously. Once you’ve become comfortable and skilled with using Inkscape, then that may be the time to look at using this fairly complicated process.

Back to Contents

Advertisement
Advertisement
Inkscape to G-code: How to Convert SVG to G-code

Examine the G-code

GCode Analyzer showing the first 33 lines of G-code
GCode Analyzer showing the first 33 lines of G-code (Source: Daniel Subia via All3DP)

This last step isn’t strictly necessary, but it can be useful for those who are curious about what G-code actually looks like, or 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 allow you to edit it if you want to get into advanced G-code tweaking.

A free website that will display your G-code is GCodeAnalyzer, a tool from gCodeViewer. From the homepage, you can drag and drop or select the “star.gcode” file. The site will load the file and display the G-code, as depicted in the image above.

Back to Contents

Advertisement
Advertisement
Inkscape to G-code: How to Convert SVG to G-code

Bonus: Watch a 3D Simulation of Your Print

The 3D star in the GCode Viewer simulation
The 3D star in the GCode Viewer simulation (Source: Daniel Subia via All3DP)

Lastly, there’s 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!

Back to Contents

Advertisement
Advertisement

License: The text of "Inkscape to G-code: How to Convert SVG to G-code" by All3DP is licensed under a Creative Commons Attribution 4.0 International License.

Stay informed with notifications from All3DP.

You get a notification when a new article is published.

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

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

Advertisement