Skip to content

Commit

Permalink
Merge branch 'master' of ssh://github.com/fablabnbg/inkscape-silhouette
Browse files Browse the repository at this point in the history
  • Loading branch information
jnweiger-dev committed Aug 5, 2019
2 parents c165eb5 + 2a7f6f5 commit 9698fcb
Show file tree
Hide file tree
Showing 30 changed files with 2,845 additions and 264 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pyc
4 changes: 2 additions & 2 deletions Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ Typical sequence
"!%d\x03" % speed # 1..10
"FX%d\x03" % press # 1..33
"FC%d\x03" % off # off=18: cutting, off=0: pen. Other values unknown. #FC p,q,[n] [t]
"FY%d\x03" % enh # enh=1/0: Trackenhancing on/off
"FY%d\x03" % enh # enh=0/1: Trackenhancing on/off
"FN%d\x03" %ori # ori=1/0: Landscape/Portrait
"FE0\x03" # ??
"TB71\x03" # ??
# Response " 0, 0\x03"
"FA\x03" # begin page definition
"FU%d,%d\x03" % (w,h) # h,w page dimensions without top/left margin. Needed to start left.
"FM1\x03" # ??
--------------------------------- if registraion marks
--------------------------------- if registration marks
"TB50,381\x03"
"TB99\x03"
"TB55,1\x03"
Expand Down
224 changes: 137 additions & 87 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,158 +1,208 @@
inkscape-silhouette
===================
# inkscape-silhouette

An extension to drive a Silhoutte Cameo from within inkscape.
An extension to drive a Silhoutte Cameo and similar plotter devices from within inkscape.
100% pure python, ontop of the libusb backend.

Here is the wiki with photos and a video: https://github.com/jnweiger/inkscape-silhouette/wiki
Here is the wiki with photos and a video: https://github.com/fablabnbg/inkscape-silhouette/wiki

Installation
------------
## Suported Devices

Ubuntu 16.04
This extension should work with the following devices:

* apt install python-usb
* Silhouette Portrait
* Silhouette Portrait 2 (working confirmed)
* Silhouette Cameo
* Silhouette Cameo 2
* Silhouette Cameo 3
* Silhouette Curio (partial success confirmed in #36)
* Craft Robo CC200-20
* Craft Robo CC300-20
* Silhouette SD 1
* Silhouette SD 2

## Installation

### Ubuntu 16.04

* `apt install python-usb`
* https://github.com/fablabnbg/inkscape-silhouette/releases
Scroll down to Downloads and click on the *.deb file.

Ubuntu 14.04
### Ubuntu 14.04

* apt install python-pip python-setuptools
* sudo pip install pyusb
* `apt install python-pip python-setuptools`
* `sudo pip install pyusb`
* https://github.com/fablabnbg/inkscape-silhouette/releases
Scroll down to Downloads and click on the *.deb file.


Other Debian based Linux
### Other Debian based Linux

* Download https://github.com/fablabnbg/inkscape-silhouette/archive/master.zip
* Copy the the folder silhouette and the two files sendto_silhouette.inx and
sendto_silhouette.py to ~/.config/inkscape/extensions/ or (if you have permissions) /usr/share/inkscape/extensions/
* Copy the the folder silhouette and the two files `sendto_silhouette.inx` and
`sendto_silhouette.py` to `~/.config/inkscape/extensions/` or (if you have permissions) `/usr/share/inkscape/extensions/`

* `sudo apt-get install python-usb`
* restart inkscape, check the menu entry "Extensions -> Export -> Send to Silhouette"

* sudo apt-get install python-usb
* restart inkscape, check the menu entry Extensions -> Export -> Send to Silhouette

### openSUSE

openSUSE:
* `~/.config/inkscape/extensions/` or
* `/usr/share/inkscape/extensions/`
* and run `sudo zypper in python-usb`

* ~/.config/inkscape/extensions/ or
* /usr/share/inkscape/extensions/
* and run '''sudo zypper in python-usb'''
### Arch Linux

Arch Linux:
* sudo pacman -S inkscape python2 python2-lxml python2-pyusb
* git clone https://github.com/fablabnbg/inkscape-silhouette.git
* cd inkscape-silhouette
* sudo python2 setup.py build && sudo python2 setup.py install
* sudo cp sendto_silhouette.* /usr/share/inkscape/extensions/
* sudo cp -R silhouette /usr/share/inkscape/extensions/
```shell
sudo pacman -S inkscape python2 python2-lxml python2-pyusb
git clone https://github.com/fablabnbg/inkscape-silhouette.git
cd inkscape-silhouette
sudo python2 setup.py build && sudo python2 setup.py install
sudo cp sendto_silhouette.* /usr/share/inkscape/extensions/
sudo cp -R silhouette /usr/share/inkscape/extensions/
```

### Mac OS X

Mac OS X
* Install prerequisites:
* install homebrew http://brew.sh/
* brew install libusb
* `brew install libusb`
* Install the extension:
* sudo ./install_osx.py

Windows (untested):
* Download and install the free test version of **winzip** from http://www.winzip.com
* Download https://github.com/jnweiger/inkscape-silhouette/archive/master.zip
* Navigate to your Downloads folder and double-click on **inkscape-silhouette-master.zip**
* Click open the **inkscape-silhouette-master** folder.
* Select the following three items (with Ctrl-Click): **silhouette**, **sendto_silhouette.inx**, and **sendto_silhouette.py**
* Extract to My Computer **C:\Program Files\Inkscape\share\extensions**
* untested: if you have a Silhouette Studio CD, install the device driver. Then your Silhouette Cameo may show up as a printer device and the extension could now work. If not, installing pywinusb might help.
* The following tips are for a Windows-7 64-bit machine:
* Download and install http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/
* x86\libusb0_x86.dll: x86 32-bit library. Must be renamed to libusb0.dll <br>
On 64 bit, Installs to Windows\syswow64\libusb0.dll.
On 32 bit, Installs to Windows\system32\libusb0.dll.
* X86 ONLY ARCHITECTURES:<br>
x86\libusb0.sys: x86 32-bit driver.<br>
Installs to Windows\system32\drivers\libusb0.sys
* When you get a number of options, chose the printer option.
* If you don't have python installed, then install the latest stable version.
* Download and unpack http://sourceforge.net/projects/pyusb/
* `sudo ./install_osx.py`

### Windows

#### Requirements

* Download http://zadig.akeo.ie/downloads/zadig-2.3.exe
* Go to menu options `List all devices`
* Look for USB Printing Support in the dropdown list
* Use manufacturer ID: 10B4D Graftek America`
* Select driver `libusb0 (v1.2.6.0)`
* Click install driver
* If you don't have python installed, then install the latest stable version.
* Download and unpack http://sourceforge.net/projects/pyusb/
* cd ..\pyusb-1.0.0b1; python.exe setup.py install
* An error message `ImportError: No module named usb.core` means you are close, but `pyusb` was not correctly installed. Please check, if there are multiple python installations in your system, e.g. one that came with inkscape.
* Find the path to the `python.exe` in the inkscape directory, e.g. on a Windows 7 (64 bits) it may be `C:\Program Files (x86)\Inkscape\python\python.exe`
* Change directory to the `pyusb` one and run it again.

#### Silhouette inkscape extension itself

* Download and install `7zip` from https://www.7-zip.org/download.html
* Download https://github.com/fablabnbg/inkscape-silhouette/archive/master.zip
* Navigate to your `Downloads` folder and double-click on `inkscape-silhouette-master.zip`
* Click open the `inkscape-silhouette-master` folder.
* Select the following three items (with Ctrl-Click): `silhouette`, `sendto_silhouette.inx`, and `sendto_silhouette.py`
* Extract to `My Computer`: `C:\Program Files\Inkscape\share\extensions` or `C:\Program Files (x86)\Inkscape\share\extensions` if first does not exists.
* Restart inkscape
* An error message 'ImportError: No module named usb.core' means you are close, but pyusb was not correctly installed. Please check, if there are multiple python installations in your system, e.g. one that came with inkscape.

## Usage

1. Open your document with inkscape.
2. Ensure the unit of document width and height is mm or inch, but not px. (File - Document settings - Page - Custom - Unit mm) Otherwise you may observe differences in dimensions at inkscape 0.91/0.92, because default dpi has changed from 90 to 96.
3. Convert all objects and texts to paths (Path - Convert object to path)
4. Select the parts you want to plot.
5. Open Extension (Extensions - Export - Send to Silhouette)
6. Set your desired plot parameters:
* **X-Offset, Y-Offset** An addtitional offset of your drawing from the top left corner. Default is 0/0
* **Tool Cut/Pen** Cut mode drews small circles for orientation of the blade, Pen mode draws exactly as given.
* **Media** Select a predfined media or set to custom settings.
* **Speed** Custom speed of the movements
* **Pressure** Custom Pressure on the blade. One unit is said to be 7g force.
7. Press Apply button to start cut.

## Troubleshooting

Troubleshooting
---------------
```python
>>> import usb.core
>>> usb.core.find()
<usb.core.Device object at 0xb720fb8c>
>>>
```

python
>>> import usb.core
>>> usb.core.find()
<usb.core.Device object at 0xb720fb8c>
>>>
If this reports `no usb.core.Device` to you, please help troubleshoot.

If this reports no usb.core.Device to you, please help troubleshoot.
```python
python
>>> import usb.core
>>> usb.version_info[0]
```

This fails on win32/64 with 'module has no attribute 'version info' which then causes Graphtec.py to error even though usb.core is installed.

## Using of registration marks

The plotter will search the registration marks at the given positions.
If it founds the marks, they will serve as accurate reference and define the origin.
Therefore it is necessary to set the correct offset values of the mark.
As a result the cut will go precisely along the graphics.

Using of registration marks
---------------------------

To plot with registration marks do the following:

1. Open the document examples/registration-marks.svg
1. Open the document which fit to your setup, e.g. `examples/registration-marks-cameo-silhouette-a4-maxi.svg` for Silhouette Cameo using A4 paper format.
2. Insert your cutting paths and graphics on the apropriate layers.
3. Printout the whole document including registration marks. You probably want to hide the cutting layer.
3. Printout the whole document including registration marks. You probably want to hide the cutting layer.
4. Select your cutting paths in the document, but exclude regmarks and graphics.
5. Set or ensure the correct values (regmark position/width/height) on the regmark tab.
6. Enable 'Document has registration marks' and 'Search for registration marks'
5. On the **Regmarks** tab:
* Check **Document has registration marks**
* Check **Search for registration marks**
6. Set all following parameters according to the registration file used:
* **X mark distance** (e.g. *190*)
* **Y mark distance** (e.g. *277*)
* **Position of regmark from document left** (e.g. *10*)
* **Position of regmark from document top** (e.g. *10*)
7. Start cut.

The plotter will search the registration marks at the given positions. If it founds the marks, they will serve as accurate reference and define the origin. Therefore it is necessary to set the correct offset values of the mark. As a result the cut will go precisely along the graphics.
At my device there seems to be a little offset between the search optics and the cutting knife. For enhanced precision I have to set an offset of 0,1mm for both x and y on the first tab to compensate.
On some devices have an offset between the search optics and the cutting knife.
For enhanced precision, you may have to set an offset on **X-Offset** and/or **Y-Offset** on the **Silhouette** tab to compensate.

Features
--------
## Features

* Path sorting for monotonic cut. We limit backwards movement to only a few
millimeters, and make the knive pull only towards sharp corners
* Path sorting for monotonic cut. We limit backwards movement to only a few
millimeters, and make the knive pull only towards sharp corners
so that most designs can be done without a cutting mat!
* Coordinate system conforms to inkscape SVG.
* Exact Margins. Can start at (0,0).
* Pen mode used to avoid the precut movement of the knive.
Those movements are visible a) at the left hand side, when
Those movements are visible a) at the left hand side, when
starting, b) at each sharp turn.
* Bounding Box. Can optionally plot (or calculate only)
* Bounding Box. Can optionally plot (or calculate only)
the bounding box instead of plotting all strokes.
This can be used (with low pressure=1 or removed knive) to just
This can be used (with low pressure=1 or removed knive) to just
check, where the plot would be.
* The standalone script arrow_test.py can be used to test drive
the SilhoutteCameo class.
* The standalone script `arrow_test.py` can be used to test drive
the `SilhoutteCameo` class.
* Robust communication with the device. Small writes and timeouts are
handled gracefully. Timeouts will occur, when we travel far with low speed.
* Multipass: Can repeat each stroke multiple times to enhance plot or
* Multipass: Can repeat each stroke multiple times to enhance plot or
cut quality. This can also be used to attempt a cut without cutting mat, by
applying very little pressure.
* reverse toggle options, to cut the opposite direction. This might also be
* reverse toggle options, to cut the opposite direction. This might also be
helpful with mat-free cutting via multipass.
* honors hidden layers.

Misfeatures of InkCut that we do not 'feature'
----------------------------------------------
## Misfeatures of InkCut that we do not 'feature'

* object transforms are missing most of the time.
* Stars, polygons, and boxes are plotted not closed, the final stroke
* Stars, polygons, and boxes are plotted not closed, the final stroke
is missing. (Must be me, no?)
* always plots all layers, even if hidden.

TODO
----
## TODO

* Implement the triangle in a square test cut.

* test MatFree cutting strategy with the WC-Wunderbach-Wimpern font, which is especially
well suited as a test-case.

* improve MatFree cutting by finding a better scan sort algorithm.
Wide shadow casting towards negative y?

* Implement paper-zip as a seperate inkscape extension.
* Implement paper-zip as a seperate inkscape extension.

REFERENCES
----------
## References

* http://wiki.inkscape.org/wiki/index.php/Extensions
* http://wiki.inkscape.org/wiki/index.php/INX_Parameters
Expand Down
Loading

0 comments on commit 9698fcb

Please sign in to comment.