Developing Control Software for the Silhouette Cameo

Basics

So as I mentioned before, I had screwed up my Cameo by destroying the touch screen. This meant I was unable to load my cutting mat, and made registration (aligning the printed design with the machine so the machine cut on the printed lines) very difficult. But, once I solved that it was a non-issue and I think it actually made things faster for me. Now why exactly do I want to make my own controller software? Simple. The software used to control the Silhouette Cameo is called Silhouette Studio, and is pretty impressive for free software. There are a lot of options, a lot of settings and configurations to enable you to cut/score/crimp/draw on almost any material. This ability to do a bunch of different things to a bunch of different materials sounds nice, but considering I got the machine for one very specific purpose it ended up being more of a time waster than I wanted. How nice would it be to import a file from Pepakura directly into this control software, send the file to the printer to be printed on cardstock, then load the Cameo, score the lines that are to be bended, pause to let you adjust blade depth, then cut the outer lines of the parts all without making changes to any settings or doing any configuration other than initially setting up the software. In a project like a full Iron Man costume, this could save a lot of hours.

Matlab DXF Importer

In the workflow I am using to cut the Pepakura files with the Cameo I need to first export the Pepakura file as multiple DXF files to import into Silhouette Studio. Unfortunately, Pepakura Designer doesn’t export DXF files using a standard protocol, instead the files are a little different than expected. One of the most frustrating issues is that while the shapes to be cut are polygons, each individual line seemed to be exported in no particular order. Since I love using Matlab I developed some scripts to use that imports the DXF files from Pepakura, and I was planning on using this to create some form of G-Code that I could export to an Arduino or something. However since the lines weren’t in order, the cutter would have been jumping all over the place cutting random lines and wasting a whole lot of time. So after a few days I finally got my scripts to correctly organize the lines and create objects I called “Shapes”. Each shape had a start/end point that converged together, and one continuous path. This means that developing a script to make G-Code that an Arduino could follow is simply a matter of travelling along each X-Y point in each “Shape”. The hard part of the controller is done, or at least I thought so.

*If anyone wants the Matlab scripts, let me know and I’d be glad to send it your way.

Silhouette Cameo USB Communication

I realized that replacing all of the electronics with my own controller would be way more effort than it would be worth, and what’s more is I wouldn’t be able to share my code or software with anyone because they’d need to replace their hardware too. That’s a lot of messing around to save a few hours. So I began to reverse engineer the communication protocol between my computer and the Cameo. My first thought is that it would be easy, since the Cameo has a USB port for a flash drive, and Silhouette Studio can export a file to a flash drive to run the Cameo so the Cameo doesn’t even need to be connected to the computer to run. This should be as easy as viewing the hexidecimal file that Silhouette Studio outputs and finding the commands and protocols, right? No. Absolutely not. If it isn’t apparent by now, I know very very little about software/computer communication. Silhouette Studio exports a file format called .gsp, and when viewed in a hex editor it is almost complete gibberish. There is a header that says “Graphtec Print&Cut” or something similar, and the rest is just garbage. I couldn’t find any patterns or anything.

So the next thing I tried was to sniff the USB communication when I had the Cameo plugged into my computer controlling it with Silhouette Studio. I used Microsoft Message Analyzer, and after spending hours trying to figure out what exact data I wanted to see, I finally got to the core of the USB communication. I will post images of the results in the future. Anyways, after some Googling of the commands sent I found out the communication protocol is called “GP-GL” which stands for “Graphtec Plotter Graphics Language” and is a derivation of “HP-GL” which is “Hewlett Packard Graphics Language”. Graphtec is a company that makes a lot of different plotters, and they actually developed the electronics in the Silhouette Cameo. There is a lot of information at this website here although the commands have changed a bit with newer Cameo firmware and newer versions of Silhouette Studio. I am still working on reverse engineering all of the commands, and my next step is to create a Windows application that will allow me to send either ASCII or hexidecimal commands directly to the Silhouette Cameo, so I can test each command individually and determine the response. But now that I have a good start on the USB communication, I can begin the next step.

Developing the Actual Software

So this part I haven’t started yet. My end-all be-all goal is to make a software that is an all-in-one Pepakura alternative and Silhouette Cameo controller, but I think the best route would be to make several subprograms and tie them all together at the end. My plan right now is to make a simple piece of software that will import a DXF made from the Pepakura software, and allow the user to send the file to a printer to print the lines and edge IDs, then follow a step by step procedure to score the bend lines and cut the final shapes. I have a lot of work to do on this software, and my main setback right now is figuring out how to communicate over USB with Windows. Seriously, that is hard! Driver stacks, callback functions, yea I have no idea what I’m doing. If anyone has any info to offer please let me know, because I’m starting in the dark on this one.

But as for actually controlling the Cameo, my Matlab script can be used to convert the DXF file into a series of paths that the cutter can follow. Of course I will remake the Matlab script as a C++ program so people won’t need to download the entire Matlab runtime just to run the program, but the logic will be the same. One of the biggest goals I have is to completely rework the automatic registration feature in the Print&Cut. Silhouette Studio has this thing where if the registration fails due to poorly printed registration marks, or misaligned paper or whatever, it will still cut the profiles even if they are way misaligned from the printed lines. There is no notification that the registration fails (unless the Cameo can’t find the initial registration mark, then it won’t even go through the rest of the registration process), and no way to know how well it went. I am hoping to make something a bit more robust and repeatable, to make things as accurate as possible.

I am of course looking for contributors to this project, so if you are interested let me know.