Marty McGuire

Posts Tagged thing-a-day-2011

2011
Tue Feb 8

Thing-a-Day 2011 #8 - Hershey font rendering in JavaScript with RaphaΓ«l

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

After exporting a bunch of Hershey vector fonts to SVG the other day, I was concerned that the next step in using them in a program would be painful. Specifically, I expected to have to create a mapping from each ASCII character I care about to the individual glyphs that represent them.

Halfway through a couple of different strategies for making the mapping easy, I realized that these fonts are, for the most part, already aligned with ASCII.Β  So, the "space" character (ASCII 32) is the first glyph in most of the Hershey fonts, and the other characters follow thereafter. So to get the glyph for a given ASCII, I just have to pull it out of the array at glyph[character - 32].

My code for this is starting to take shape, but it's not useful (or clean) enough to share, yet. Still, it is worth a nice picture:

Hershey_fonts_in_js

I'm having a really good time doing Thing-a-Day. It's been very challenging to find the time to keep going, but each time I do I am quite happy with what I'm able to produce. The undeniably awesome part is that these things are all adding up to bigger projects I would have never had time to tackle, otherwise!

Update: I could not resist adding a text field and going crazy with live rendering:

Hershey_font_js_lulz

Β 

Mon Feb 7

Thing-a-Day 2011 #7 - 2-Color Baltimore Node Logo Plot

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

I'm on the road and away from my MakerBot, etc., but I've created a version of the Baltimore Node logo that should be plottable in 2 colors using either the MakerBot Unicorn or the EggBot! I also replaced the outline text we were using with a Hershey Font version using the SVGs I posted yesterday.

Another tweak - I played around with Inkscape's XML editor to get these things into layers. It's a neat trick, but kind of a pain. I also reordered several of the paths for better and/or more interesting drawing order. I'll see how it turns out when I get back to my bot.

You can find it on Thingiverse: http://www.thingiverse.com/thing:6204

And here's what Posterous does with the SVG when I upload it. No promises that it will be useful for anything.

Node-logo
Sun Feb 6

Thing-a-Day 2011 #6 - Hershey Fonts in SVG

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

I just posted these guys over on Thingiverse!

Making text for Unicorn plots isn't always a fun process. Most tools (even my Inkscape plugin) require you to convert text into paths, and even then you get the outlines of shapes, which can often turn messy at small sizes.

mifga pointed me towards the Hershey fonts. They’re a set of fonts for vector plotters named after creator Dr. A. V. Hershey who made them for the U.S. National Bureau of Standards.

These files are in a weird, weird, format. But after some normalizing, wailing, and gnashing of teeth, I was able to write some code to parse them and spit them back out as SVG! Now you can use these fonts in your Unicorn drawings.


Hooray-math Music

To use these in Unicorn plots, you'll want to grab my Unicorn G-Code extension for Inkscape.

Instructions

To use these fonts in your Unicorn plots:

  1. Download the SVG file containing the font of your choice, or grab the whole hershey_svg.zip to get them all.
  2. In your Inkscape drawing, use File | Import to load the font you want
  3. Drag around and duplicate the characters that you want to use.
  4. Delete the ones that you don’t.
  5. Save your file and Save a Copy to get your .gcode!
Sat Feb 5

Thing-a-Day 2011 #5 - Graffiti Markup Language (GML) to Unicorn!

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

When I first heard of Graffiti Markup Language (GML) I was like "An XML format for graffiti? Pfft!" Then yesterday I was like "Wait, I have a pen plotter."

gml2unicorn is a Python script that will take GML files and convert them into G-Code compatible with the MakerBot Unicorn pen plotter.

Gml Gml-orig
Learn more on Thingiverse, or grab the code on GitHub.
Fri Feb 4

Thing-a-Day 2011 #4 - Pen-Changing!

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

Once again, I'm work on the MakerBot Unicorn G-Code Output extension for Inkscape.

Today's update is kind of a simple-but-clever hack, inspired by the code for EggBot.

It lets you create multi-color plots by putting paths of different colors on different layers. For example to create this image:

Thing-a-day-unicorn-2-color
I put the text on a layer named "text" and the unicorn logo on a layer named "unicorn".

Inkscape-unicorn-layer-pause
And selected the new "Pause on layer change?" option!

When plotting, everything pauses before starting a new layer and I get the message "Plotting layer '[LAYERNAME]'". I can use that pause as an opportunity to change out the pen, as I did in this example, using a black pen for the text layer and a blue pen for the unicorn layer.

Thu Feb 3

Thing-a-Day 2011 #3 - Copies and continuous plotting for inkscape-unicorn

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

The the MakerBot Unicorn G-Code Output extension to Inkscape I've been working on so far for Thing-a-Day now has a new feature - support for copies and continuous plotting!

I've incorporated mifga's multi-sheet print-to-pad hack to prompt for changing sheets between copies. I've also added support for plotting sheet-after-sheet, continuously, using the "M30" G-Code, which causes ReplicatorG to start the program over from the beginning, effectively running until you stop it yourself.

For the curious: have some diffs on GitHub! Also, pictures:

Thing-a-day-unicorns Inkscape-unicorn-copies
Wed Feb 2

Thing-a-Day 2011 #2 - New features for inkscape-unicorn: pen registration and homing support

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

Today I made some improvements to the inkscape-unicorn plotter extension that I released yesterday.

Inkscape-unicorn-reg-and-homing

Specifically, I've added two things:

  • The option to do a pen-registration check at the beginning of each plot, taken from mifga's original.
  • The option to set where "home" is, for people who like to start their plots with the platform anywhere other than in the center.

This should help make some nice plots!

Tue Feb 1

Thing-a-Day 2011 #1 - Unicorn Pen Plotter extension for Inkscape!

This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.

I spent some time this weekend making this plugin and today went through the process of releasing it via GitHub and posting it to Thingiverse: http://www.thingiverse.com/thing:5986

Inkscape-unicorn

One problem that has often plagued users of the MakerBot Unicorn is the long and confusing chain of tools required to go from a nice vector drawing to a G-Code file that can be plotted from ReplicatorG.

mifga did an awesome tutorial that made it possible to understand the steps needed to work all of these tools, but it was obvious that something better was needed.

So, I made a mashup of scribbles.py and the Egg-Bot Driver for Inkscape to bring you the inkscape-unicorn extension for Inkscape!

Once installed, this extension allows you to save files in “MakerBot Unicorn G-Code (*.gcode)” format!

Learn more, download, and contribute at the GitHub page for this project:

https://github.com/martymcguire/inkscape-unicorn

If you’re desperate, you can also download the zip file attached to this thing, but please consider getting the latest version from GitHub. :)

Thanks to langfordw for the original Unicorn Logo used as an example on this Thing.