Skip to content

Commit

Permalink
Warn against pressure values of 19 or more
Browse files Browse the repository at this point in the history
Warn against python-usb < 1.0
  • Loading branch information
jnweiger committed May 23, 2016
1 parent a0cd346 commit 085def8
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 39 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ EXCL=--exclude \*.orig --exclude \*.pyc
ALL=README.md *.png *.sh *.rules *.py *.inx examples misc silhouette
VERS=$$(echo '<xml height="0"/>' | python ./sendto_silhouette.py --version /dev/stdin)

## echo '<xml height="0"/>' | python ./sendto_silhouette.py /dev/stdin
# 'module' object has no attribute 'core'
# 'module' object has no attribute 'core'
# done. 0 min 0 sec
#
# debian 8
# --------
# echo > /etc/apt/sources.list.d/backports.list 'deb http://ftp.debian.org debian jessie-backports main'
# apt-get update
# apt-get -t jessie-backports install python-usb
# vi /etc/group
# lp:x:debian


DEST=$(DESTDIR)$(PREFIX)/share/inkscape/extensions
UDEV=$(DESTDIR)/lib/udev

Expand Down
1 change: 1 addition & 0 deletions distribute/deb/dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ tmp=../out

[ -d $tmp ] && rm -rf $tmp/*.deb
mkdir -p $tmp
cp *-pak files/
cd files
fakeroot checkinstall --fstrans --reset-uid --type debian \
--install=no -y --pkgname $name --pkgversion $vers --arch all \
Expand Down
63 changes: 33 additions & 30 deletions sendto_silhouette.inx
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,41 @@
<item value="pen">Pen</item>
<item value="cut">Cut</item>
</param>
<param name="pen_help" type="description">'pen' executes the strokes exactly as sent, 'cut' adds small serifs to help the knive find its orientation at corners.</param>
<param name="pen_help" type="description">'pen' executes the strokes exactly as sent, 'cut' adds small serifs to help the knive find its orientation at corners.
Pressure values of 19 or more make the machine misbehave. Beware.
</param>
<param name="media" type="enum" _gui-text="Media:">
<item value="100">Card without Craft Paper Backing</item>
<item value="101">Card with Craft Paper Backing</item>
<item value="102">Vinyl Sticker</item>
<item value="106">Film Labels</item>
<item value="111">Thick Media</item>
<item value="112">Thin Media</item>
<item value="113">Pen</item>
<item value="120">Bond Paper 13-28 lbs (105g)</item>
<item value="121">Bristol Paper 57-67 lbs (145g)</item>
<item value="122">Cardstock 40-60 lbs (90g)</item>
<item value="123">Cover 40-60 lbs (170g)</item>
<item value="124">Film, Double Matte Translucent</item>
<item value="125">Film, Vinyl With Adhesive Back</item>
<item value="126">Film, Window With Kling Adhesive</item>
<item value="127">Index 90 lbs (165g)</item>
<item value="128">Inkjet Photo Paper 28-44 lbs (70g)</item>
<item value="129">Inkjet Photo Paper 45-75 lbs (110g)</item>
<item value="130">Magnetic Sheet</item>
<item value="131">Offset 24-60 lbs (90g)</item>
<item value="132">Print Paper Light Weight</item>
<item value="133">Print Paper Medium Weight</item>
<item value="134">Sticker Sheet</item>
<item value="135">Tag 100 lbs (275g)</item>
<item value="136">Text Paper 24-70 lbs (105g)</item>
<item value="137">Vellum Bristol 57-67 lbs (145g)</item>
<item value="138">Writing Paper 24-70 lbs (105g)</item>
<item value="300">Custom</item>
<!-- CAUTION: keep in sync with silhouette/Graphtec.py -->
<item value="300">[P>0 S>0] Custom: use non-zero Pressure and Speed below</item>
<item value="100">[P=27,S=10] SCard without Craft Paper Backing</item>
<item value="101">[P=27,S=10] Card with Craft Paper Backing</item>
<item value="102">[P=10,S=10] Vinyl Sticker</item>
<item value="106">[P=14,S=10] Film Labels</item>
<item value="111">[P=27,S=10] Thick Media</item>
<item value="112">[P= 2,S=10] Thin Media</item>
<item value="113">[P=10,S=10] Pen</item>
<item value="120">[P=30,S=10] Bond Paper 13-28 lbs (105g)</item>
<item value="121">[P=30,S=10] Bristol Paper 57-67 lbs (145g)</item>
<item value="122">[P=30,S=10] Cardstock 40-60 lbs (90g)</item>
<item value="123">[P=30,S=10] Cover 40-60 lbs (170g)</item>
<item value="124">[P= 1,S=10] Film, Double Matte Translucent</item>
<item value="125">[P= 1,S=10] Film, Vinyl With Adhesive Back</item>
<item value="126">[P= 1,S=10] Film, Window With Kling Adhesive</item>
<item value="127">[P=30,S=10] Index 90 lbs (165g)</item>
<item value="128">[P=20,S=10] Inkjet Photo Paper 28-44 lbs (70g)</item>
<item value="129">[P=27,S=10] Inkjet Photo Paper 45-75 lbs (110g)</item>
<item value="130">[P=30,S= 3] Magnetic Sheet</item>
<item value="131">[P=30,S=10] Offset 24-60 lbs (90g)</item>
<item value="132">[P= 5,S=10] Print Paper Light Weight</item>
<item value="133">[P=25,S=10] Print Paper Medium Weight</item>
<item value="134">[P=20,S=10] Sticker Sheet</item>
<item value="135">[P=20,S=10] Tag 100 lbs (275g)</item>
<item value="136">[P=30,S=10] Text Paper 24-70 lbs (105g)</item>
<item value="137">[P=30,S=10] Vellum Bristol 57-67 lbs (145g)</item>
<item value="138">[P=30,S=10] Writing Paper 24-70 lbs (105g)</item>
</param>
<param name="speed" type="int" min="0" max="10" _gui-text="Speed">0</param>
<param name="pressure" type="int" min="0" max="33" _gui-text="Pressure">0</param>
<param name="pressure" type="int" min="0" max="18" _gui-text="Pressure">0</param>
<param name="speed_help" type="description">Use speed=0, pressure=0 to take the media defaults.</param>
<param name="autocrop" type="boolean" _gui-text="Trim margins">false</param> <param name="autocrop_help" type="description">Shift to the top lefthand corner, then do offsets.</param>
<param name="bbox_only" type="boolean" _gui-text="Draft Bounding Box Only">false</param>
Expand Down Expand Up @@ -76,7 +79,7 @@
<page name='about' _gui-text='About'>
<param name="about_who" type="description">inkscape-silhouette extension from https://github.com/jnweiger/inkscape-silhouette by Jürgen Weigert [[email protected]] and contributors</param>
<!-- Keep in sync with sendto_silhouette.py line 78 __version__ = ... -->
<param name="about_version" type="description">Version 1.17</param>
<param name="about_version" type="description">Version 1.18</param>
</page>
</param>

Expand Down
23 changes: 21 additions & 2 deletions sendto_silhouette.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@
# 2016-05-15 jw, v1.16 -- merged regmarks code from https://github.com/fablabnbg/inkscape-silhouette/pull/23
# 2016-05-17 jw, v1.17 -- fix avoid dev.reset in Graphtec.py, fix helps with
# https://github.com/fablabnbg/inkscape-silhouette/issues/10
# 2016-05-21 jw, v1.18 -- warn about python-usb < 1.0 and give instructions.
# Limit pressure to 18. 19 or 20 make the machine
# scroll forward backward for several minutes.

__version__ = '1.17' # Keep in sync with sendto_silhouette.inx ca line 79
__version__ = '1.18' # Keep in sync with sendto_silhouette.inx ca line 79
__author__ = 'Juergen Weigert <[email protected]> and contributors'

import sys, os, shutil, time, logging, tempfile
Expand Down Expand Up @@ -108,6 +111,11 @@
import gettext
from optparse import SUPPRESS_HELP

try:
inkex.localize() # 0.91
except:
_ = gettext.gettext # 0.49

from silhouette.Graphtec import SilhouetteCameo
from silhouette.Strategy import MatFree

Expand Down Expand Up @@ -254,7 +262,7 @@ def __init__(self):
help="[1..8], cut/draw each path object multiple times.")
self.OptionParser.add_option('-p', '--pressure',
action = 'store', dest = 'pressure', type = 'int', default = 10,
help="[1..33], or 0 for media default")
help="[1..18], or 0 for media default")
self.OptionParser.add_option('-r', '--reversetoggle',
action = 'store', dest = 'reversetoggle', type = 'inkbool', default = False,
help="Cut each path the other direction. Affects every second pass when multipass.")
Expand Down Expand Up @@ -1057,6 +1065,17 @@ def write_progress(done, total, msg):
if __name__ == '__main__':
e = SendtoSilhouette()

if len(sys.argv) < 2:
# write a tempfile that is autoremoved on exit
tmpfile=tempfile.NamedTemporaryFile(suffix='.svg', prefix='inkscape-silhouette')
sys.argv.append(tmpfile.name)
print sys.argv
print >>tmpfile, '<xml height="10"></xml>'
tmpfile.flush()
e.affect(sys.argv[1:])
# os.remove(tmpfile.name)
sys.exit(0)

start = time.time()
e.affect()
ss = int(time.time()-start+.5)
Expand Down
21 changes: 14 additions & 7 deletions silhouette/Graphtec.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# (c) 2013,2014 [email protected]
# (c) 2015 [email protected]
# (c) 2016 [email protected]
#
# Distribute under GPLv2 or ask.
#
Expand All @@ -14,6 +14,8 @@
# 2015-06-05 Renamed cut_bbox() to find_bbox(). It does not cut anything.
# 2015-06-06 refactored plot_cmds() from plot().
# 2016-05-16 no reset per default, this helps usbip.
# 2016-05-21 detect python-usb < 1.0 and give instructions.
#

from __future__ import print_function
import sys, time, re
Expand Down Expand Up @@ -41,18 +43,23 @@
print("\t sudo apt-get install python-usb \t\t# if you run Ubuntu", file=sys.stderr)
print("\n\n\n", file=sys.stderr)
raise e2;
print("Your python usb module appears to be 0.4.x or older -- We need version 1.x", file=sys.stderr)
print("\n\n\n", file=sys.stderr)
raise e;
# try my own wrapper instead.
# import UsbCoreMini as usb
# forget this. old 0.4 PyUSB segfaults easily.

if usb.version_info[0] < 1:
print("Your python usb module appears to be "+str(usb.version_info)+" -- We need version 1.x", file=sys.stderr)
print("For Debian 8 try:\n echo > /etc/apt/sources.list.d/backports.list 'deb http://ftp.debian.org debian jessie-backports main\n apt-get update\n apt-get -t jessie-backports install python-usb", file=sys.stderr)
print("\n\n\n", file=sys.stderr)
sys.exit(1)
# try my own wrapper instead.
# import UsbCoreMini as usb
# forget this. old 0.4 PyUSB segfaults easily.


# taken from
# robocut/CutDialog.ui
# robocut/CutDialog.cpp

MEDIA = [
# CAUTION: keep in sync with sendto_silhouette.inx
# media, pressure, speed, cap-color, name
( 100, 27, 10, "yellow", "Card without Craft Paper Backing"),
( 101, 27, 10, "yellow", "Card with Craft Paper Backing"),
Expand Down

0 comments on commit 085def8

Please sign in to comment.