Monday, June 29, 2015

Using Inkscape with Turnkey Tyrannys plugin

If you've been following along you'll notice that I have been using Turnkey Tyrannys fork of an Inkscape plugin available here for my laser cutter design work. He has a nice set of instructions already wrote up on how to install the plugin, so I won't reinvent the wheel there. This post is more on how to go about designing and cutting your first part using his plugin, and a few things that I've picked up on in the last few months of using it.

First, I highly recommend using cutting_surface.svg template that he provides with the plugin. This already has page and document settings set to the correct units for his plugin to operate. If you would like your rules and objects to be in a different unit of measurement (mm or inch), then press Ctrl-Shift-D while in inkscape to open the Document Properties dialog.
Under the General heading you'll find "Default Units". In the screenshot above they are set to Inch, since I'm stateside. This are the displayed units on your rulers, as well as the default units when fine adjusting objects and text within your design. For everyone else, you'll probably want to work in mm. Weirdos. Just select it from the drop down box and you're good to go. About midway down you'll see "Custom Size" where you can change the page size that is displayed, and the Units that it is saved as. The plugin requires Units to be in pixels, px, in order to work properly. If this is changed you'll receive an error when attempting to export telling you to change it back.

Ok! On to actually designing something. We'll start with something easy, a basic keychain. First, you'll want to select the "rectangle" tool (highlighted red, below) from the toolbox along the left side of the screen, and draw a rough shape that you would like. (Your colors and line thickness may vary from the screenshots. We will fix this in a bit)

Now, keychains aren't very friendly with such sharp corners, so lets round those off. You can use the small circle anchors to do this freehand, or the dialog boxes highlighted in yellow above. I set Rx and Ry both to 0.500 for a full radius on the ends, and adjusted the overall size to be 3.0" wide and 1.0" high. You'll end up with something that looks like this:
Using the circle tool, give yourself a hole to thread a keyring into. Keep in mind everything is still in a rough state, so don't worry too much about placement. We can drag things around later once we have everything we want.

Let's add some text, using the text tool. Just click where you want and start typing away. If the text runs out of room, you can use the selection anchors to push and pull it into the size you need.

Hey, it's starting to look like a keychain! Sweet! Ok, now we need to adjust a few settings so the laser cutter understands what we are trying to do. First, we have to adjust the Fill and Stroke of any object that we want the laser to pay attention to. On the top menu, click on Object > Fill and Stroke. It should appear in the tray on the right side of the screen, or off on its own window depending on how you have Inkscape configured. You'll have 3 tabs: Fill, Stroke, and Stroke Style. Using shift, select each object you'd like to vector cut. For vector cut lines, you will want to set it to No fill, a solid stroke(flat color), and a stroke style width of 0.001".

This will make your lines pretty hard to see, so be sure to zoom in until you can see what you are working with.

Now a quick little explanation of how the plugin views different objects in Inkscape.. Anything you draw in Inkscape is considered an object, and will be exported as raster data. In order to turn these into vector cut lines, you must change them to a Path instead of Object. Simple enough, with your two objects still selected click on Path > Object to Path. This will allow the plugin to export them properly, otherwise you'll just get an engraving of your cutout line, instead of actually cutting it out. Keep in mind, we only have two objects selected and converted to path right now.. not the text. We want to leave the text as an object that way it exports as a raster correctly.

Now, you should end up with something that looks like this.
Now it's time to tell the laser what power settings we want. Turnkeys plugin requires a pretty specific Layer Name in order to set power levels and feed rates.
The Marlin firmware has a setting inside the code that limits its max power to a certain frequency. The first section of the layer name in Inkscape defines what percentage of that max power to use. (Future reference, a 70% power level in Inkscape on my machine gives me 18ma of power, the max rating for my 40 watt CO2 laser tube. I never set it above 70 for this reason.) The highlighted layer above has a 10% power(of that max power set inside the marlin firmware), with a Pulse Per Millemeter of 40, and a feed rate of 2500mm/m. Now, we know we want to cut these two paths out from whatever material we are using, so we need to change these settings to something a bit more reasonable. On my machine, I know I can cut 1/8th inch acrylic with a power level of 68%, PPM of 40, and Feedrate of 250mm/m. So, my layer name will be:  68 [ppm=40,feed=250]

Select both paths you would like cut out at the above settings, right click on them, and move them to that layer. Next, we will move the text to a separate layer and adjust its power settings to 15% power, with a feed rate of 3000mm/m and PPM of 40. If you have empty layers, you can remove them with the blue minus button in the layer tray. They don't hurt anything, but it makes it easier to keep track of which layers/power levels you are using.

Once your two vector paths and your raster object text are finished, select all 3 of them. It's time to export to a gcode file that the laser can read. If you have the plugin installed correctly, click on Extensions > Export > Turnkey Laser Exporter...
For this tutorial, I'll be using an SD card to transfer the gcode to the laser. Click on the Advanced tab, and make sure "Are you using Pronterface?" is *not* checked. Leave the rest of the options as default, and click on Apply. Once it's done processing you'll get the below notification. Check it carefully to make sure it looks like what you are expecting.
There, we can see that we have two vector lines, and one raster. This coincides with what we drew, a cutout for the keychain, a cutout for the hole, and the raster text data. You'll find the gcode file on your desktop. Just copy that over to SD, and off to the laser you go! Insert the SD card, power everything up, and use the dial to navigate to "Print from SD" and select your file. Be sure to have your water pump and exhaust fan going, as well as any safety interlocks you have installed.

Keep in mind, this is just a very simple tutorial to get your feet wet. I'll be writing another tutorial soon that involves importing artwork and going over how to organize your layers and objects to cut in an order that makes sense. (inside cuts first, before outside, etc). Have fun, and don't burn the house down! :)


  1. Nice! Thank you so damn much. I have been using Epilogue laser and it has power/speed/frequency settings. After reading this guide it makes much more sense how this plugin works.

  2. Hi do you still use the ramps and are you still happy with ramps as some people say don't even think about using the arduino its not powerful enough also did you find all the software and process to engrave and cut in one easy enough to do.

    1. Hi
      I use RAMP and arduino in my modded K40, no problem at all with the "power", supply the correct code is a bit of a learning curve but it's free....

  3. Thank you so much for sharing this worth while to spent time on. You are running a really awesome blog. Keep up this good work

    Turnkey Office Interior Services

  4. Great tutorial, simple, clear and helpful
    Thanks for your time

  5. hi , I've tried to use Inkscape raster plugin for engraving purpose , however I couldn't make Gcode with G7 code for raster image with Marlin and it always deals with layers as vector type and not raster type, I really appreciated to have your help for this issue