On writing and robots

Jesse Lumarie
Unpacking Trunk Club
3 min readAug 16, 2016

About eight months ago, I started as a software-engineering apprentice here at Trunk Club.

Apprenticeships at Trunk Club last about six months, and offer a way for non-traditional engineering candidates to break into the software-engineering field. As part of the apprenticeship program, each candidate must complete a technical project which they then present at the end of their apprenticeship.

For my apprenticeship project at Trunk Club, I worked on a prototype that would allow stylists to put handwritten notes into their client’s trunks.

For context — when Trunk Club first started, stylists and warehouse operations were housed in the same building. Stylists could easily put handwritten notes in every client’s trunk. As we scaled and spread out our stylist and warehouse operations, we started typing our notes and inserting those notes into trunks at our warehouse.

We’d like to get back to a place where a stylist can put a handwritten note into a trunk regardless of their location.

Here’s how I thought it would work:

  1. After packing a trunk for a client, the stylist writes a note on a piece of paper
  2. The stylist then takes a picture of the note using an app (which uploads the note to our servers)
  3. ✨Magic✨ (And programming. But mostly magic)
  4. The note is written out by a pen plotter in our warehouse and placed in the client’s trunk
Prototype in action

In order to make step 3 work, we wrote a SVG-to-G-code parser that we’re putting on the internet for all to use. While there were some existing SVG-to-G-code converters written in other languages, I figured it’d be a good learning experience to build my own G-code parser for our specific needs.

If you want to draw a vector image onto a piece of paper (or more traditionally, cut/burn a design into a piece of wood using a CNC machine/laser), G-code is likely instructing the machine that’s doing the writing/burning. SVG doesn’t convert directly into G-code, so you need a program to convert SVGs to G-code.

The SVG (Scalable Vector Graphics) file format is used to describe images that can be resized without losing quality (compare raster images, which describe a fixed bitmap of pixels). You can think of an SVG as an instruction on how to draw a image.

G-code (which according to this NIST tome stands for General Code) similarly contains a set of instructions on how to draw an image, but is used directly by CNC machines and other automated routers to draw images.

Wikipedia says it best:

G-code is a language in which people tell computerized machine tools how to make something. The “how” is defined by instructions on where to move, how fast to move, and what path to move.

Our gem takes an SVG that looks like this:

And turns it into G-code that a plotter could write out:

Trunk Club is about building relationships at scale, and recreating stylist’s handwritten notes in client trunks is another way to foster our connection to our customers.

We’re still figuring out the feasibility of getting this technology to production, but in the interim figured there were hobbyists out there who might want to use Ruby for their SVG-to-G-code conversion needs.

You can find the code for the gem on Github —please let us know if you have have any questions(and don’t be shy about opening up a pull request!)

Want to help build the future of retail (with or without laser firing robots)? Send an email to techblog@trunkclub.com and let us know!

Thanks to Jerry Williams and Jason Block

--

--