Unicorn Tutorial 02

WORK-IN-PROGRESS: Please send griffin at makerbot dot com any suggestions!

<<< Tutorial 01: Vector-based Drawing || Tutorial 2: Basic Hatches || Tutorial 3: Tracing Bots/Printing Bots


Unicorn Tutorial 02 - Basic Hatches

On the hunt for great vector-based files to use as a source for this tutorial, I came upon the Adobe Illustrator documents for the MakerBot Giveaway Stickers.

I have loved these stickers since before I even started working for MakerBot, and I want to be able to print the series on the Unicorn!

Unlike the previous tutorial for the MakerBot Exploded Diagram, these stickers have solid blocks of black and fonts with fill. I decided to create two versions of these stickers: one with outlines-only to demonstrate how the unicorn "sees" vector art, and one with hatches to recreate the solid blocks of color to demonstrate basic hatching.

This mini-tutorial sprints through the file conversion process for the first sticker, "Design locally, build globally!", and then details the hatches process used to create the second version. I shared all of the design documents from the SVG file on forward on Thingiverse.com for your reference. Please select the option to save the linked downloads for links below (as your browser will attempt to view files like .svg files).

"Design locally, build globally!" Outline Version





  1. Open "75mm x 75mm" Inkscape template
  2. Import Adobe Illustrator .ai file.
  3. Use Align and Distribute tool to move image to center of document.
  4. Draw an outline-only box around sticker using Create rectangles tool (R).
  5. Click the Lock icon next to X,Y,H dimensions on tool bar to lock proportions.
  6. Change to Outline display mode via View>Display Mode menu.
  7. Scale up to fill 75mm x 75mm page (with 1mm safety margins in all directions).
  8. Save File As both Inkscape .svg file (for further work, like cross-hatching) and .eps file (for translation to DXF file).

I open a new document using my "75mm x 75mm template"(download). I had previously saved this file (with document dimensions and pre-built layers) into my /Applications/Inkscape/Contents/Resources/templates/ folder so that it will appear in the list of templates in File>New.

Next, I open the Object>Align and Distribute pane and use positioning buttons to put the design in the center of the frame. Then, I drag a rectangle around the sticker using the Create rectangles tool (R) until I reach the square sticker dimension I'm looking for. (Note, you can bring up the Object>Fill and Stroke pane to select the X (off) for Fill, and the solid block for Stroke paint so that you get an image like the one listed here.)

I perform an Edit>"Select All" and then choose Object>Group (Cnt+G) to group all of the illustration elements together for the sticker. I activated the Lock icon next to the X, Y, W coordinates on the tool bar so that any scale adjustments will adjust x/y equally, to keep me from distorting the illustration when I tug on the adjustment handles.

To get a sense of what this illustration would look like printed, I go up to the View>Display Mode menu and select Outline. Notice all of the fill around MakerBot and within the "Design locally" typeface vanish? Only the path information will carry though the process, so using the Outline view is helpful to check your Inkscape document to make sure you have replaced all fills and tones with linework.

I experimented with leaving the scale as is and with doubling the size to fill more of the sticky note by dragging the corner Scale handles. (The latter option seems to me more successful.)

Use the Save As… to create two versions of the file, one as an Inkscape SVG file for further editing (such as adding cross-hatching) and another as an EPS file for processing through towards g-code. (NOTE: When creating this tutorial I saved my Inkscape document in two versions, original and "2x" versions so that means I saved four files at this points.)




  1. Open your command line tool and navigate to directory containing the EPS file.
  2. Enter the command: "pstoedit -f dxf:-mm [Name of Illustration.eps] [Name of Illustration.dxf]"
  3. Note: the script will create a new file named [Name of Illustration.dxf]

Using your command line tool, navigate to the directory containing your new EPS file. One trick when using the Terminal app in Mac OS X is to type cd and then drag the folder from the finder to the command line. The entire path should appear after the cd tool and hitting return should take you to that folder.

Then enter your pstoedit command. (Example given in image.) You can add further flags and made more modifications to the file, but for the purposes of this tutorial I'm following the simplest path.

Note that second file name (the .dxf file) will be a new file created by pstoedit. Be careful to rename any previous DXF attempts that share the same name so that the command doesn't overwrite a file you want to keep.

You can open the resulting new file in QCAD to inspect it.



#Open DXF file and confirm units are in milimeters and paths fit within print surface.

  1. Select>Select All to activate all nodes of all paths.
  2. On left hand toolbar, select Edit and then push Explode (firecracker).
  3. Choose File>Save As to create a new copy of the DXF (ex: add "_xpld" to end of title)

QCAD is an excellent tool to use to inspect and clean up a drawing before sending it to the scribbles.py script to make the final g-code print document. Chances are, all you will need to do is make sure that the right units are in use by checking Edit>Drawing Preferences>Units and inspecting the document window to make sure all paths are within the positive x/y quadrant and fall a milimeter or two within the edges of the page. (If the pen slips off the edge of the drawing, the plotter might lift or mangle the page.)

If the document is not the size you anticipated, you can use Select>Select All and then (in the left toolbar) Edit>Scale Entities (second set of triangles down in the left column) to scale the entire drawing up/down by a factor of your choosing. The tool asks for you to "Specify a reference point": I'd suggest you select the point closest to 0,0 if possible.

If you have no reference point that is convenient, you can pick any point and then use the Select>Select All, Edit>Cut, and then Edit>Paste trick — specifying in the Command: command line tool a point at the dead center of your drawing surface (ex 37.5, 37.5) to re-pin the re-scaled drawing to where you need it.

Next you need to prepare the file for scribbles.py by "exploding" blocks, polylines, texts, dimensions, and hatches, changing them to basic paths. Certain elements (ex: text) are not broken all the way down to the most basic entities — so return to your "exploded" document and explode it a second time if you get unexpected results in the drawing.

Make sure to use Select>Select All to activate all nodes of all paths, and then find the Explode tool in the left hand toolbar by clicking the Edit button and then the Explode (firecracker) button.

After you have exploded the document, choose File>Save As to create a new copy of the DXF (ex: add "_xpld" to end of title). Exploding is a one way process: you may want to return to the un-exploded document to make adjustments and changes while larger groupings of lines and paths are still joined. Once you explode a document, editing lines will require you to select all of the atomic parts of that line individually to delete or adjust them.




  1. Copy your exploded DXF file into your Scribbles Scripts folder.
  2. Navigate your directory structure to the folder containing scribbles.py.
  3. Type in the command: "python scribbles.py [filename.dxf]>[filename.gcode]" where the second file name will be the new path scribbles.py will create.
  4. Wait for script to run… Now you have g-code!

Provided you have followed this process as I recommend above, this last stage should require the least amount of intervention on your part. There are further adjustments and hacks to scribbles.py that might help you, especially if you are using a scribe or similar instead of a hardy pen, but chances are you can use the scribbles.py settings right out of the box.

A current limitation of this script forces you to move your DXF file into the directory containing scribbles.py. I'd suggest you simply make a copy into that folder and delete it after your create the gcode you need and drag the new file to where you want your gcode to live.

I want to again encourage you to consider downloading my swap-in "context.py" file to replace the original one in your Scribbles Scripts>scribbles folder. Not only does this allow for a machine halt so you can remove your art — and get your pen tool back in position for the next print — but it also offers a registration test before the drawing so that you can better position your tool.

The command to run the script is as follows:

$python scribbles.py [filename.dxf]>[filename.gcode]

The second file name will be the new path scribbles.py will create — note you might need to rename the target file if you have already run the script.

Then all you need to do is wait for the script to run. When you are returned to a new command line prompt, then the script has succeeded. If you see strange errors, chances are that you either have a drawing that is not entirely within the positive x,y quadrant of the DXF document and/or you haven't selected all of the nodes/paths and exploded them. Many of the tools (particularly tracing tools) spin spline reference points in wild contortions (and negative values) to achieve path details. Explode replaces these harder-to-parse values with simple line segments and arcs.

You will find your new gcode file in the directory with scribbles.py — unless you specified a path to another folder.



  1. Position the pen tool where you wish (0,0) to fall in the lower left-hand corner of the printing surface.
  2. Test for placement either with my print-to-pad scribbles hack or by pasting in a pen-position gcode (below).
  3. Open your scribbles.py generated g-code document in ReplicatorG.app.
  4. Click the Build button (second from left on toolbar).
  5. Watch the magic happen. (Or troubleshoot earlier stage of drawing and print again.)
  6. After your print dries, scan it and share it on Thingiverse.com

If you follow the procedures in this tutorial, Scribbles will create work that requires that you manually set the position of the pen tool at (0,0) at the start of the print: the lower left-hand corner of the build surface. You don't want 0,0 to fall off the page, so you are going to reduce by a few tenths of a millimeter or a millimeter from the largest value to fit on the page depending on how wide your x/y margins are with this initial placement.

Before you load your gcode script, it is helpful to prep the pen tool to make sure you have set the z-axis height correctly for good pen pressure. I recommend you use my scribbles.py hack to build a registration test into your print itself, but if you feel more comfortable leaving scribbles.py alone, here is another way to prep for drawing.

You can copy+paste this code into ReplicatorG's gcode window and run it by selecting the Build button, second from the left on the toolbar. This tiny script can also be added to the top of the gcode document you generated to do the registration test within the context of performing your final print.

Note: Before running the short script, it is helpful to raise and zero the z-stage position using the jog shuttle tool so that the tip of the pen tool begins at least 5mm above the surface of the page so when the servo adjusts to show you the proper pen-down placement, you won't make too dark of a mark on your drawing surface before you found a suitable z-axis height.

M300 S40 (pen down)
M18 (disengage stepper motor drives)
M01 (Touch the pen to the paper. Are you happy with placement?)
M17 (engage stepper motor drives)
M300 S50 (pen up)

This script disengages the drives at a machine halt so that you can turn a z-rod or the z-motor pulley to lower the stage to touch the tip of the pen to the drawing surface. After you answer "yes" to the machine halt dialogue box, the pen will lift up to the non-drawing position and you will be ready to load your gcode document and print it. (Or if this is at the head of your document, the drawing itself will now begin.)

I'd suggest you watch your print for at least 30 seconds when you attempt it for the first time to make sure that the x/y proportions feel correct. If something is off — one of the steppers hits positions at a slightly different scale than the other — then your pen might skitter off the printing surface or even get caught over the edge of the build surface, leading to unpleasant results. Once things appear to be working well, your bot can happily draw on its own for hours. (I have created woodblock-style prints with deep deep blacks that take over an hours to plot: no problem!)

Even if your print isn't turning out how you like, you might want to let it finish so that you can determine at which stage (QCAD for clean up, Inkscape for design tweaks, etc.) you want to make changes before running through this process again.

Sharing your work will be hugely helpful, not only simply to share the cool stuff you are printing but also to share the unique "hand" of your particular bot. Depending on a lot of factors, including how tight vs loose you build your MakerBot Unicorn carriage arms, how well your bot's belts are working, and a number of other factors including paper and pen types, the same drawing can range in appearance from mechanical to a natural hand sketch. The more examples shared the more we know about the range of this tool: and help us to create a cookbook of adjustments to make to get desired print results.

The video below shows the printing of the Outlines version, followed by the printing of the Fill version.

"Design locally, build globally!" Hatches Version

Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.