Wayback Machine
SEP May Jun
Previous capture 9 Next capture
2012 2013 2014
3 captures
8 Jan 12 - 9 May 13
sparklines
Close Help

Setting Up Libcutter

From Cricut Hacking Wiki

Jump to: navigation, search

Contents

[hide]

Prep Your Environment

Ubuntu

Get the packages you'll need that you may not have already:

  • gcc (shocking, I know, butif you don't have this cmake will yell at you):
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.   
Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
  • cmake
  • make
  • git (if you want to clone the github repo, anyway)
  • libxml++2.6-dev
  • libjpg-dev
  • libsdl

To install the packages either use the synaptic package manager or open up a terminal and run:

sudo aptitude install <package1> [<package2>..]

We also need libsvg; I have been unable to find an ubuntu package that works yet, so we'll have to build this from source:

tar xvzf libsvg-0.1.4.tar.gz libsvg-0.1.4
  • If you haven't already, install the libxml++2.6-dev, libsdl and libjpg-dev packages
    • Note: I went through a bunch of other packages trying to find which ones I needed; if you have trouble, try libxml2-dev, librsvg2-dev, libcairo2-dev
  • Navigate into the directory you extracted:
cd libsvg-0.1.4
  • Configure the installer:
./configure
  • If all went well, compile the library:
make
  • If all went well, install the library:
make install

Get The Code

  • Open a terminal and create a directory that you'd like to put libcutter in, then navigate to that directory:
mkdir ~/projects/
cd ~/projects
  • Clone the git repository:
git clone git://github.com/vangdfang/libcutter.git

Compile

  • Navigate to your libcutter source:
cd ~/projects/libcutter
  • Move keys.h from ./include/pub to ./include:
mv ./include/pub/keys.h ./include
  • Grab the keys for moving (KEY2), cutting a line (KEY4) and cutting a curve (KEY6) and replace the existing keys in keys.h with those values. Be sure to include the '0x' prefix (tells the compiler that it's a hexadecimal value) and the 'ul' postfix. Note that (KEY3) and (KEY5) will also appear to work for LINE_KEY and CURVE_KEY, but they lift the blade after each cut, leaving "gaps" in your cuts. Those keys may be useful in applications other than libcutter. Your ./include/keys.h should look something like this:
 
#ifndef KEYS_H
#define MOVE_KEY_0   0x47302A23ul
#define MOVE_KEY_1   0x5D31482Ful
#define MOVE_KEY_2   0x3B257A61ul
#define MOVE_KEY_3   0x3671382Ful


#define LINE_KEY_0  0x45356650ul
#define LINE_KEY_1  0x3A386D69ul
#define LINE_KEY_2  0x575A7037ul
#define LINE_KEY_3  0x335F357Dul



#define CURVE_KEY_0 0x3F62626Dul
#define CURVE_KEY_1 0x7E555F44ul
#define CURVE_KEY_2 0x7E29425Aul
#define CURVE_KEY_3 0x52246268ul
#endif

If you don't make this change then, ./util/draw_gcode and ./util/draw_svg won't actually move the cutter.

  • While you're at it, remove the #warning directive from the file.
  • run cmake:
cmake CMakeLists.txt
  • run make:
make

Run Some Tests

For all of these tests navigate first to the "util" directory in your libcutter project:

cd ~/projects/libcutter/util

You'll also need to figure out which device your cutter is hooked up to. In my case it's /dev/ttyUSB1, although I'm not at all sure of a good way to determine which it is. As a side note, if you're running Ubuntu in a virtual machine (mine's VMware on a Windows 7 host) make sure to give the machine the actual USB device rather than the emulated serial device.

Try out some GCode

./draw_gcode /dev/ttyUSB1 gcode_tests/pololu.gcode

Try out an SVG Image

In my case libsvg installed its shared object file into /usr/local/lib, so I need to tell draw_svg where to find it. Your mileage may vary:

env LD_LIBRARY_PATH=/usr/local/lib ./draw_svg svg_tests/rectangle.svg /dev/ttyUSB1

Run cutter-logo python script

TODO: I'm not sure how to create the "cutter" module for python; something to do with SWIG, but I've never used SWIG before and running cutter-logo.py fails with the following error:

Traceback (most recent call last):
  File "cutter-logo.py", line 12, in <module>
    from cutter import *
ImportError: No module named cutter
Personal tools