From 7858bd3f3f6acf19964274472062546d84986cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sat, 13 Jul 2013 19:21:28 +0200 Subject: moved main hpgl processing to new classes, moved plotter control to a extension dialog (bzr r12417.1.1) --- share/extensions/plotter.py | 92 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 share/extensions/plotter.py (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py new file mode 100644 index 000000000..7b760e33e --- /dev/null +++ b/share/extensions/plotter.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python +# coding=utf-8 +''' +Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +''' + +# standard library +import sys +# local library +import gettext, hpgl_decoder, hpgl_encoder, inkex +inkex.localize() + + +class MyEffect(inkex.Effect): + def __init__(self): + inkex.Effect.__init__(self) + self.OptionParser.add_option("--tab", action="store", type="string", dest="tab") + self.OptionParser.add_option("--resolutionX", action="store", type="float", dest="resolutionX", default=1016.0, help="Resolution X (dpi)") + self.OptionParser.add_option("--resolutionY", action="store", type="float", dest="resolutionY", default=1016.0, help="Resolution Y (dpi)") + self.OptionParser.add_option("--pen", action="store", type="int", dest="pen", default=1, help="Pen number") + self.OptionParser.add_option("--orientation", action="store", type="string", dest="orientation", default="90", help="orientation") + self.OptionParser.add_option("--mirrorX", action="store", type="inkbool", dest="mirrorX", default="FALSE", help="Mirror X-axis") + self.OptionParser.add_option("--mirrorY", action="store", type="inkbool", dest="mirrorY", default="FALSE", help="Mirror Y-axis") + self.OptionParser.add_option("--center", action="store", type="inkbool", dest="center", default="FALSE", help="Center zero point") + self.OptionParser.add_option("--flat", action="store", type="float", dest="flat", default=1.2, help="Curve flatness") + self.OptionParser.add_option("--useOvercut", action="store", type="inkbool", dest="useOvercut", default="TRUE", help="Use overcut") + self.OptionParser.add_option("--overcut", action="store", type="float", dest="overcut", default=1.0, help="Overcut (mm)") + self.OptionParser.add_option("--useToolOffset", action="store", type="inkbool", dest="useToolOffset", default="TRUE", help="Correct tool offset") + self.OptionParser.add_option("--toolOffset", action="store", type="float", dest="toolOffset", default=0.25, help="Tool offset (mm)") + self.OptionParser.add_option("--toolOffsetReturn", action="store", type="float", dest="toolOffsetReturn", default=2.5, help="Return factor") + self.OptionParser.add_option("--precut", action="store", type="inkbool", dest="precut", default="TRUE", help="Use precut") + self.OptionParser.add_option("--offsetX", action="store", type="float", dest="offsetX", default=0.0, help="X offset (mm)") + self.OptionParser.add_option("--offsetY", action="store", type="float", dest="offsetY", default=0.0, help="Y offset (mm)") + self.OptionParser.add_option("--serialPort", action="store", type="string", dest="serialPort", default="COM1", help="Serial port") + self.OptionParser.add_option("--serialBaudRate", action="store", type="string", dest="serialBaudRate", default="9600", help="Serial Baud rate") + + def effect(self): + # gracefully exit script when pySerial is missing + try: + import serial + except ImportError, e: + # TODO:2013-07-13:Sebastian Wüst:Maybe add this text to extension window + inkex.errormsg(_("pySerial is not installed." + + "\n\n1. Download pySerial here: http://pypi.python.org/pypi/pyserial" + + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: \"C:\\Program Files (x86)\\inkscape\\python\\Lib\\\" (Or wherever your Inkscape is installed to)" + + "\n3. Restart Inkscape.")) + return + # get hpgl data + myHpglEncoder = hpgl_encoder.hpglEncoder(self.document.getroot(), self.options) + self.hpgl = myHpglEncoder.getHpgl() + if self.hpgl == -1: + inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) + return + # TODO:2013-07-13:Sebastian Wüst:Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. + if 1 == 2: # reparse data for preview + self.options.showMovements = True + self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) + self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) + myHpglDecoder = hpgl_decoder.hpglDecoder(self.options) + (hasUnknownCommands, hasNoHpglData, doc) = myHpglDecoder.getSvg(self.hpgl) + if not hasNoHpglData: + self.document = doc + if 1 == 1: # send data to plotter + # TODO:2013-07-13:Sebastian Wüst:Somehow slow down sending to avoid buffer overruns in the plotter on very large drawings. + mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None) + mySerial.write(self.hpgl) + # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) + mySerial.read(2) + mySerial.close() + +if __name__ == '__main__': + # Raise recursion limit to avoid exceptions on big documents + sys.setrecursionlimit(20000); + # start extension + e = MyEffect() + e.affect() + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file -- cgit v1.2.3 From 9c2812df7879eadc3d6743555b7d0a808d9ad9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 14 Jul 2013 15:08:21 +0200 Subject: minor changes (bzr r12417.1.2) --- share/extensions/plotter.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index 7b760e33e..f17c7dcf0 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -66,7 +66,8 @@ class MyEffect(inkex.Effect): inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return # TODO:2013-07-13:Sebastian Wüst:Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. - if 1 == 2: # reparse data for preview + ''' + # reparse data for preview self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) @@ -74,13 +75,14 @@ class MyEffect(inkex.Effect): (hasUnknownCommands, hasNoHpglData, doc) = myHpglDecoder.getSvg(self.hpgl) if not hasNoHpglData: self.document = doc - if 1 == 1: # send data to plotter - # TODO:2013-07-13:Sebastian Wüst:Somehow slow down sending to avoid buffer overruns in the plotter on very large drawings. - mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None) - mySerial.write(self.hpgl) - # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) - mySerial.read(2) - mySerial.close() + ''' + # send data to plotter + # TODO:2013-07-13:Sebastian Wüst:Somehow slow down sending to avoid buffer overruns in the plotter on very large drawings. + mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None) + mySerial.write(self.hpgl) + # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) + mySerial.read(2) + mySerial.close() if __name__ == '__main__': # Raise recursion limit to avoid exceptions on big documents -- cgit v1.2.3 From 8d0d0ff393bde4b53bcd9c8e57b59d1a3021ba77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 14 Jul 2013 17:06:36 +0200 Subject: changed how decoder is called and errors are passed (bzr r12417.1.3) --- share/extensions/plotter.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index f17c7dcf0..d54f9ed6c 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -71,10 +71,16 @@ class MyEffect(inkex.Effect): self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) - myHpglDecoder = hpgl_decoder.hpglDecoder(self.options) - (hasUnknownCommands, hasNoHpglData, doc) = myHpglDecoder.getSvg(self.hpgl) - if not hasNoHpglData: - self.document = doc + myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) + try: + doc, warnings = myHpglDecoder.getSvg() + # deliver document to inkscape + self.document = doc + except Exception as inst: + if inst.args[0] == 'NO_HPGL_DATA': + # do nothing + else: + raise Exception(inst) ''' # send data to plotter # TODO:2013-07-13:Sebastian Wüst:Somehow slow down sending to avoid buffer overruns in the plotter on very large drawings. -- cgit v1.2.3 From 7108556bbdc57d1d6ea3c5002c6b475667cea4f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 14 Jul 2013 19:44:08 +0200 Subject: changed how encoder passes errors (bzr r12417.1.5) --- share/extensions/plotter.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index d54f9ed6c..ebb69e8a1 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -53,7 +53,6 @@ class MyEffect(inkex.Effect): try: import serial except ImportError, e: - # TODO:2013-07-13:Sebastian Wüst:Maybe add this text to extension window inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here: http://pypi.python.org/pypi/pyserial" + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: \"C:\\Program Files (x86)\\inkscape\\python\\Lib\\\" (Or wherever your Inkscape is installed to)" @@ -61,10 +60,15 @@ class MyEffect(inkex.Effect): return # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self.document.getroot(), self.options) - self.hpgl = myHpglEncoder.getHpgl() - if self.hpgl == -1: - inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) - return + try: + self.hpgl = myHpglEncoder.getHpgl() + except Exception as inst: + if inst.args[0] == 'NO_PATHS': + # issue error if no paths found + inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) + return 1 + else: + raise Exception(inst) # TODO:2013-07-13:Sebastian Wüst:Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. ''' # reparse data for preview -- cgit v1.2.3 From cbc6385db94389b5b9ebbf0a1893eb8368d71efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 14 Jul 2013 19:50:20 +0200 Subject: changed all quotes to single quotes except for translations (bzr r12417.1.6) --- share/extensions/plotter.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index ebb69e8a1..42e348742 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -28,25 +28,25 @@ inkex.localize() class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) - self.OptionParser.add_option("--tab", action="store", type="string", dest="tab") - self.OptionParser.add_option("--resolutionX", action="store", type="float", dest="resolutionX", default=1016.0, help="Resolution X (dpi)") - self.OptionParser.add_option("--resolutionY", action="store", type="float", dest="resolutionY", default=1016.0, help="Resolution Y (dpi)") - self.OptionParser.add_option("--pen", action="store", type="int", dest="pen", default=1, help="Pen number") - self.OptionParser.add_option("--orientation", action="store", type="string", dest="orientation", default="90", help="orientation") - self.OptionParser.add_option("--mirrorX", action="store", type="inkbool", dest="mirrorX", default="FALSE", help="Mirror X-axis") - self.OptionParser.add_option("--mirrorY", action="store", type="inkbool", dest="mirrorY", default="FALSE", help="Mirror Y-axis") - self.OptionParser.add_option("--center", action="store", type="inkbool", dest="center", default="FALSE", help="Center zero point") - self.OptionParser.add_option("--flat", action="store", type="float", dest="flat", default=1.2, help="Curve flatness") - self.OptionParser.add_option("--useOvercut", action="store", type="inkbool", dest="useOvercut", default="TRUE", help="Use overcut") - self.OptionParser.add_option("--overcut", action="store", type="float", dest="overcut", default=1.0, help="Overcut (mm)") - self.OptionParser.add_option("--useToolOffset", action="store", type="inkbool", dest="useToolOffset", default="TRUE", help="Correct tool offset") - self.OptionParser.add_option("--toolOffset", action="store", type="float", dest="toolOffset", default=0.25, help="Tool offset (mm)") - self.OptionParser.add_option("--toolOffsetReturn", action="store", type="float", dest="toolOffsetReturn", default=2.5, help="Return factor") - self.OptionParser.add_option("--precut", action="store", type="inkbool", dest="precut", default="TRUE", help="Use precut") - self.OptionParser.add_option("--offsetX", action="store", type="float", dest="offsetX", default=0.0, help="X offset (mm)") - self.OptionParser.add_option("--offsetY", action="store", type="float", dest="offsetY", default=0.0, help="Y offset (mm)") - self.OptionParser.add_option("--serialPort", action="store", type="string", dest="serialPort", default="COM1", help="Serial port") - self.OptionParser.add_option("--serialBaudRate", action="store", type="string", dest="serialBaudRate", default="9600", help="Serial Baud rate") + self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') + self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') + self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') + self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') + self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') + self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') + self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') + self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') + self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') + self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') + self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') + self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') + self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') + self.OptionParser.add_option('--toolOffsetReturn', action='store', type='float', dest='toolOffsetReturn', default=2.5, help='Return factor') + self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') + self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') + self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') + self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') + self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') def effect(self): # gracefully exit script when pySerial is missing -- cgit v1.2.3 From de3cd4c192b87660d348ca146b3a7409d8d05108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sat, 27 Jul 2013 17:18:36 +0200 Subject: small changes + fixes (bzr r12417.1.13) --- share/extensions/plotter.py | 1 - 1 file changed, 1 deletion(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index 42e348742..4556e9058 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -87,7 +87,6 @@ class MyEffect(inkex.Effect): raise Exception(inst) ''' # send data to plotter - # TODO:2013-07-13:Sebastian Wüst:Somehow slow down sending to avoid buffer overruns in the plotter on very large drawings. mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None) mySerial.write(self.hpgl) # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) -- cgit v1.2.3 From 0cccda91e5b2d2ab5d21a6cc1365aa1c73d5bc9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Thu, 3 Oct 2013 20:26:22 +0200 Subject: parser can now work with multiple pens, better exception handling (bzr r12417.1.15) --- share/extensions/plotter.py | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index 4556e9058..0c802ddc9 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -68,25 +68,29 @@ class MyEffect(inkex.Effect): inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return 1 else: - raise Exception(inst) - # TODO:2013-07-13:Sebastian Wüst:Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. + type, value, traceback = sys.exc_info() + raise ValueError, ("", type, value), traceback + # TODO:2013-07-13:Sebastian Wüst:Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) ''' - # reparse data for preview - self.options.showMovements = True - self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) - self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) - myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) - try: - doc, warnings = myHpglDecoder.getSvg() - # deliver document to inkscape - self.document = doc - except Exception as inst: - if inst.args[0] == 'NO_HPGL_DATA': - # do nothing - else: - raise Exception(inst) + # reparse data for preview + self.options.showMovements = True + self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) + self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) + myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) + try: + doc, warnings = myHpglDecoder.getSvg() + # deliver document to inkscape + self.document = doc + except Exception as inst: + if inst.args[0] == 'NO_HPGL_DATA': + # do nothing + pass + else: + type, value, traceback = sys.exc_info() + raise ValueError, ("", type, value), traceback ''' # send data to plotter + # TODO:2013-07-13:Sebastian Wüst:Slow down sending to prevent buffer overflow (Somewhat esotherical) mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None) mySerial.write(self.hpgl) # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) -- cgit v1.2.3 From 74ab23d467f0a8e128ae0c09f009878e49e94427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 6 Oct 2013 21:06:09 +0200 Subject: numerous optimizations, fixed bug tool offset correction calculates wrong points when length of line is smaller than tool offset (bzr r12417.1.16) --- share/extensions/plotter.py | 1 + 1 file changed, 1 insertion(+) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index 0c802ddc9..9b8aff54f 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -58,6 +58,7 @@ class MyEffect(inkex.Effect): + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: \"C:\\Program Files (x86)\\inkscape\\python\\Lib\\\" (Or wherever your Inkscape is installed to)" + "\n3. Restart Inkscape.")) return + # TODO:2013-07-13:Sebastian Wüst:Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self.document.getroot(), self.options) try: -- cgit v1.2.3 From d88806501eed58d77af06eab96352a667d895063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Wed, 9 Oct 2013 21:35:15 +0200 Subject: small stuff (bzr r12417.1.17) --- share/extensions/plotter.py | 1 + 1 file changed, 1 insertion(+) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index 9b8aff54f..db05c03cc 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -92,6 +92,7 @@ class MyEffect(inkex.Effect): ''' # send data to plotter # TODO:2013-07-13:Sebastian Wüst:Slow down sending to prevent buffer overflow (Somewhat esotherical) + # TODO:2013-10-09:Sebastian Wüst: add rtscts=1 ? mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None) mySerial.write(self.hpgl) # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) -- cgit v1.2.3 From 8bc4fd8b36f86b6a6c02a5118486bc7da999076f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sat, 19 Oct 2013 20:50:05 +0200 Subject: finished tool offset correction; optimized hpgl data; fixed texts, small bugs, parameters; added flow control parameter; and more (bzr r12417.1.21) --- share/extensions/plotter.py | 52 ++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index db05c03cc..7e2481d29 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -28,25 +28,25 @@ inkex.localize() class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) - self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') - self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') - self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') - self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') - self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') - self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') - self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') - self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') - self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') - self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') - self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') - self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') - self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') - self.OptionParser.add_option('--toolOffsetReturn', action='store', type='float', dest='toolOffsetReturn', default=2.5, help='Return factor') - self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') - self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') - self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') - self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') - self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') + self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') + self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') + self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') + self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') + self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') + self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') + self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') + self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') + self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') + self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') + self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') + self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') + self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') + self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') + self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') + self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') + self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') + self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') + self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') def effect(self): # gracefully exit script when pySerial is missing @@ -55,10 +55,10 @@ class MyEffect(inkex.Effect): except ImportError, e: inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here: http://pypi.python.org/pypi/pyserial" - + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: \"C:\\Program Files (x86)\\inkscape\\python\\Lib\\\" (Or wherever your Inkscape is installed to)" + + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: \"\\inkscape\\python\\Lib\\\" (Or wherever your Inkscape is installed to)" + "\n3. Restart Inkscape.")) return - # TODO:2013-07-13:Sebastian Wüst:Maybe implement DMPL? + # TODO:2013-10-01:Sebastian Wüst:Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self.document.getroot(), self.options) try: @@ -91,9 +91,13 @@ class MyEffect(inkex.Effect): raise ValueError, ("", type, value), traceback ''' # send data to plotter - # TODO:2013-07-13:Sebastian Wüst:Slow down sending to prevent buffer overflow (Somewhat esotherical) - # TODO:2013-10-09:Sebastian Wüst: add rtscts=1 ? - mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None) + # TODO:2013-07-13:Sebastian Wüst:Slow down sending to prevent buffer overflow on plotter side (should be investigated first) + if self.options.flowControl == '1': + mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, rtscts=True) + elif self.options.flowControl == '2': + mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, dsrdtr=True) + else: + mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, xonxoff=True) mySerial.write(self.hpgl) # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) mySerial.read(2) -- cgit v1.2.3 From ba4502382379fc02e2ff57bd52e6e6926bfeee1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 20 Oct 2013 00:13:25 +0200 Subject: changed text (bzr r12417.1.23) --- share/extensions/plotter.py | 114 +------------------------------------------- 1 file changed, 1 insertion(+), 113 deletions(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index 7e2481d29..56869e617 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -1,113 +1 @@ -#!/usr/bin/env python -# coding=utf-8 -''' -Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -''' - -# standard library -import sys -# local library -import gettext, hpgl_decoder, hpgl_encoder, inkex -inkex.localize() - - -class MyEffect(inkex.Effect): - def __init__(self): - inkex.Effect.__init__(self) - self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') - self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') - self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') - self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') - self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') - self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') - self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') - self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') - self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') - self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') - self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') - self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') - self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') - self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') - self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') - self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') - self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') - self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') - self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') - - def effect(self): - # gracefully exit script when pySerial is missing - try: - import serial - except ImportError, e: - inkex.errormsg(_("pySerial is not installed." - + "\n\n1. Download pySerial here: http://pypi.python.org/pypi/pyserial" - + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: \"\\inkscape\\python\\Lib\\\" (Or wherever your Inkscape is installed to)" - + "\n3. Restart Inkscape.")) - return - # TODO:2013-10-01:Sebastian Wüst:Maybe implement DMPL? - # get hpgl data - myHpglEncoder = hpgl_encoder.hpglEncoder(self.document.getroot(), self.options) - try: - self.hpgl = myHpglEncoder.getHpgl() - except Exception as inst: - if inst.args[0] == 'NO_PATHS': - # issue error if no paths found - inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) - return 1 - else: - type, value, traceback = sys.exc_info() - raise ValueError, ("", type, value), traceback - # TODO:2013-07-13:Sebastian Wüst:Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) - ''' - # reparse data for preview - self.options.showMovements = True - self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) - self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) - myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) - try: - doc, warnings = myHpglDecoder.getSvg() - # deliver document to inkscape - self.document = doc - except Exception as inst: - if inst.args[0] == 'NO_HPGL_DATA': - # do nothing - pass - else: - type, value, traceback = sys.exc_info() - raise ValueError, ("", type, value), traceback - ''' - # send data to plotter - # TODO:2013-07-13:Sebastian Wüst:Slow down sending to prevent buffer overflow on plotter side (should be investigated first) - if self.options.flowControl == '1': - mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, rtscts=True) - elif self.options.flowControl == '2': - mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, dsrdtr=True) - else: - mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, xonxoff=True) - mySerial.write(self.hpgl) - # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) - mySerial.read(2) - mySerial.close() - -if __name__ == '__main__': - # Raise recursion limit to avoid exceptions on big documents - sys.setrecursionlimit(20000); - # start extension - e = MyEffect() - e.affect() - -# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file +#!/usr/bin/env python # coding=utf-8 ''' Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' # standard library import sys # local library import gettext, hpgl_decoder, hpgl_encoder, inkex inkex.localize() class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') def effect(self): # gracefully exit script when pySerial is missing try: import serial except ImportError, e: inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here: http://pypi.python.org/pypi/pyserial" + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: [...]\\inkscape\\python\\Lib\\" + "\n3. Restart Inkscape.")) return # TODO:2013-10-01:Sebastian Wüst:Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self.document.getroot(), self.options) try: self.hpgl = myHpglEncoder.getHpgl() except Exception as inst: if inst.args[0] == 'NO_PATHS': # issue error if no paths found inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return 1 else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # TODO:2013-07-13:Sebastian Wüst:Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) ''' # reparse data for preview self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) try: doc, warnings = myHpglDecoder.getSvg() # deliver document to inkscape self.document = doc except Exception as inst: if inst.args[0] == 'NO_HPGL_DATA': # do nothing pass else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback ''' # send data to plotter # TODO:2013-07-13:Sebastian Wüst:Slow down sending to prevent buffer overflow on plotter side (should be investigated first) if self.options.flowControl == '1': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, rtscts=True) elif self.options.flowControl == '2': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, dsrdtr=True) else: mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, xonxoff=True) mySerial.write(self.hpgl) # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) mySerial.read(2) mySerial.close() if __name__ == '__main__': # Raise recursion limit to avoid exceptions on big documents sys.setrecursionlimit(20000); # start extension e = MyEffect() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file -- cgit v1.2.3 From 012165f8eaa0f2ef5572d096d62e36c9069c964f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 20 Oct 2013 18:05:04 +0200 Subject: changed todo format (bzr r12417.1.27) --- share/extensions/plotter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index 56869e617..d93cf0783 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -1 +1 @@ -#!/usr/bin/env python # coding=utf-8 ''' Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' # standard library import sys # local library import gettext, hpgl_decoder, hpgl_encoder, inkex inkex.localize() class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') def effect(self): # gracefully exit script when pySerial is missing try: import serial except ImportError, e: inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here: http://pypi.python.org/pypi/pyserial" + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: [...]\\inkscape\\python\\Lib\\" + "\n3. Restart Inkscape.")) return # TODO:2013-10-01:Sebastian Wüst:Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self.document.getroot(), self.options) try: self.hpgl = myHpglEncoder.getHpgl() except Exception as inst: if inst.args[0] == 'NO_PATHS': # issue error if no paths found inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return 1 else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # TODO:2013-07-13:Sebastian Wüst:Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) ''' # reparse data for preview self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) try: doc, warnings = myHpglDecoder.getSvg() # deliver document to inkscape self.document = doc except Exception as inst: if inst.args[0] == 'NO_HPGL_DATA': # do nothing pass else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback ''' # send data to plotter # TODO:2013-07-13:Sebastian Wüst:Slow down sending to prevent buffer overflow on plotter side (should be investigated first) if self.options.flowControl == '1': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, rtscts=True) elif self.options.flowControl == '2': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, dsrdtr=True) else: mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, xonxoff=True) mySerial.write(self.hpgl) # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) mySerial.read(2) mySerial.close() if __name__ == '__main__': # Raise recursion limit to avoid exceptions on big documents sys.setrecursionlimit(20000); # start extension e = MyEffect() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file +#!/usr/bin/env python # coding=utf-8 ''' Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' # standard library import sys # local library import gettext, hpgl_decoder, hpgl_encoder, inkex inkex.localize() class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') def effect(self): # gracefully exit script when pySerial is missing try: import serial except ImportError, e: inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here: http://pypi.python.org/pypi/pyserial" + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: [...]\\inkscape\\python\\Lib\\" + "\n3. Restart Inkscape.")) return # TODO: Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self.document.getroot(), self.options) try: self.hpgl = myHpglEncoder.getHpgl() except Exception as inst: if inst.args[0] == 'NO_PATHS': # issue error if no paths found inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return 1 else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) ''' # reparse data for preview self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) try: doc, warnings = myHpglDecoder.getSvg() # deliver document to inkscape self.document = doc except Exception as inst: if inst.args[0] == 'NO_HPGL_DATA': # do nothing pass else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback ''' # send data to plotter # TODO: Slow down sending to prevent buffer overflow on plotter side (should be investigated first) if self.options.flowControl == '1': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, rtscts=True) elif self.options.flowControl == '2': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, dsrdtr=True) else: mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, xonxoff=True) mySerial.write(self.hpgl) # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) mySerial.read(2) mySerial.close() if __name__ == '__main__': # Raise recursion limit to avoid exceptions on big documents sys.setrecursionlimit(20000); # start extension e = MyEffect() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file -- cgit v1.2.3 From 27839ab6126ade297f3e0f79f2dfa36de7964bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sat, 26 Oct 2013 22:29:08 +0200 Subject: small changes (mainly text) (bzr r12417.1.29) --- share/extensions/plotter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index d93cf0783..c888bd51e 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -1 +1 @@ -#!/usr/bin/env python # coding=utf-8 ''' Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' # standard library import sys # local library import gettext, hpgl_decoder, hpgl_encoder, inkex inkex.localize() class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') def effect(self): # gracefully exit script when pySerial is missing try: import serial except ImportError, e: inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here: http://pypi.python.org/pypi/pyserial" + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: [...]\\inkscape\\python\\Lib\\" + "\n3. Restart Inkscape.")) return # TODO: Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self.document.getroot(), self.options) try: self.hpgl = myHpglEncoder.getHpgl() except Exception as inst: if inst.args[0] == 'NO_PATHS': # issue error if no paths found inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return 1 else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) ''' # reparse data for preview self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) try: doc, warnings = myHpglDecoder.getSvg() # deliver document to inkscape self.document = doc except Exception as inst: if inst.args[0] == 'NO_HPGL_DATA': # do nothing pass else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback ''' # send data to plotter # TODO: Slow down sending to prevent buffer overflow on plotter side (should be investigated first) if self.options.flowControl == '1': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, rtscts=True) elif self.options.flowControl == '2': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, dsrdtr=True) else: mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=None, xonxoff=True) mySerial.write(self.hpgl) # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) mySerial.read(2) mySerial.close() if __name__ == '__main__': # Raise recursion limit to avoid exceptions on big documents sys.setrecursionlimit(20000); # start extension e = MyEffect() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file +#!/usr/bin/env python # coding=utf-8 ''' Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' # standard library import sys # local library import gettext, hpgl_decoder, hpgl_encoder, inkex inkex.localize() class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') def effect(self): # gracefully exit script when pySerial is missing try: import serial except ImportError, e: inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here: http://pypi.python.org/pypi/pyserial" + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: [Program files]/inkscape/python/Lib/" + "\n3. Restart Inkscape.")) return # TODO: Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self.document.getroot(), self.options) try: self.hpgl = myHpglEncoder.getHpgl() except Exception as inst: if inst.args[0] == 'NO_PATHS': # issue error if no paths found inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return 1 else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) ''' # reparse data for preview self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) try: doc, warnings = myHpglDecoder.getSvg() # deliver document to inkscape self.document = doc except Exception as inst: if inst.args[0] == 'NO_HPGL_DATA': # do nothing pass else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback ''' # send data to plotter if self.options.flowControl == '1': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, xonxoff=True) elif self.options.flowControl == '2': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, dsrdtr=None, rtscts=True) else: mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10) try: mySerial.write(self.hpgl) except Exception as inst: if inst.args[0] == 'Write timeout': inkex.errormsg(_("Could not send data. Please check that your plotter is running, connected and the settings are correct.")) else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) mySerial.read(2) mySerial.close() if __name__ == '__main__': # Raise recursion limit to avoid exceptions on big documents sys.setrecursionlimit(20000); # start extension e = MyEffect() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file -- cgit v1.2.3 From 41dcf1ea9364fe4edc14c08a08b65707f72068fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 27 Oct 2013 14:09:57 +0100 Subject: text change (bzr r12417.1.30) --- share/extensions/plotter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index c888bd51e..5f3ceaea0 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -1 +1 @@ -#!/usr/bin/env python # coding=utf-8 ''' Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' # standard library import sys # local library import gettext, hpgl_decoder, hpgl_encoder, inkex inkex.localize() class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') def effect(self): # gracefully exit script when pySerial is missing try: import serial except ImportError, e: inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here: http://pypi.python.org/pypi/pyserial" + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: [Program files]/inkscape/python/Lib/" + "\n3. Restart Inkscape.")) return # TODO: Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self.document.getroot(), self.options) try: self.hpgl = myHpglEncoder.getHpgl() except Exception as inst: if inst.args[0] == 'NO_PATHS': # issue error if no paths found inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return 1 else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) ''' # reparse data for preview self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) try: doc, warnings = myHpglDecoder.getSvg() # deliver document to inkscape self.document = doc except Exception as inst: if inst.args[0] == 'NO_HPGL_DATA': # do nothing pass else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback ''' # send data to plotter if self.options.flowControl == '1': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, xonxoff=True) elif self.options.flowControl == '2': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, dsrdtr=None, rtscts=True) else: mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10) try: mySerial.write(self.hpgl) except Exception as inst: if inst.args[0] == 'Write timeout': inkex.errormsg(_("Could not send data. Please check that your plotter is running, connected and the settings are correct.")) else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) mySerial.read(2) mySerial.close() if __name__ == '__main__': # Raise recursion limit to avoid exceptions on big documents sys.setrecursionlimit(20000); # start extension e = MyEffect() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file +#!/usr/bin/env python # coding=utf-8 ''' Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' # standard library import sys # local library import gettext, hpgl_decoder, hpgl_encoder, inkex inkex.localize() class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') def effect(self): # gracefully exit script when pySerial is missing try: import serial except ImportError, e: inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here: http://pypi.python.org/pypi/pyserial" + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: C:\\[Program files]\\inkscape\\python\\Lib\\" + "\n3. Restart Inkscape.")) return # TODO: Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self.document.getroot(), self.options) try: self.hpgl = myHpglEncoder.getHpgl() except Exception as inst: if inst.args[0] == 'NO_PATHS': # issue error if no paths found inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return 1 else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) ''' # reparse data for preview self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) try: doc, warnings = myHpglDecoder.getSvg() # deliver document to inkscape self.document = doc except Exception as inst: if inst.args[0] == 'NO_HPGL_DATA': # do nothing pass else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback ''' # send data to plotter if self.options.flowControl == '1': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, xonxoff=True) elif self.options.flowControl == '2': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, dsrdtr=None, rtscts=True) else: mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10) try: mySerial.write(self.hpgl) except Exception as inst: if inst.args[0] == 'Write timeout': inkex.errormsg(_("Could not send data. Please check that your plotter is running, connected and the settings are correct.")) else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) mySerial.read(2) mySerial.close() if __name__ == '__main__': # Raise recursion limit to avoid exceptions on big documents sys.setrecursionlimit(20000); # start extension e = MyEffect() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file -- cgit v1.2.3 From 75681d0c8c5d5d4929d03d960ef95a8db913c493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Mon, 28 Oct 2013 18:30:45 +0100 Subject: be more specific for pyserial download (bzr r12417.1.32) --- share/extensions/plotter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index 737e389c4..c9dd2d7ff 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -1 +1 @@ -#!/usr/bin/env python # coding=utf-8 ''' Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' # standard library import sys # local library import gettext, hpgl_decoder, hpgl_encoder, inkex inkex.localize() class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') def effect(self): # gracefully exit script when pySerial is missing try: import serial except ImportError, e: inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here: http://pypi.python.org/pypi/pyserial" + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: C:\\[Program files]\\inkscape\\python\\Lib\\" + "\n3. Restart Inkscape.")) return # TODO: Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self) try: self.hpgl = myHpglEncoder.getHpgl() except Exception as inst: if inst.args[0] == 'NO_PATHS': # issue error if no paths found inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return 1 else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) ''' # reparse data for preview self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) try: doc, warnings = myHpglDecoder.getSvg() # deliver document to inkscape self.document = doc except Exception as inst: if inst.args[0] == 'NO_HPGL_DATA': # do nothing pass else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback ''' # send data to plotter if self.options.flowControl == '1': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, xonxoff=True) elif self.options.flowControl == '2': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, dsrdtr=None, rtscts=True) else: mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10) try: mySerial.write(self.hpgl) except Exception as inst: if inst.args[0] == 'Write timeout': inkex.errormsg(_("Could not send data. Please check that your plotter is running, connected and the settings are correct.")) else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) mySerial.read(2) mySerial.close() if __name__ == '__main__': # Raise recursion limit to avoid exceptions on big documents sys.setrecursionlimit(20000); # start extension e = MyEffect() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file +#!/usr/bin/env python # coding=utf-8 ''' Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' # standard library import sys # local library import gettext, hpgl_decoder, hpgl_encoder, inkex inkex.localize() class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') def effect(self): # gracefully exit script when pySerial is missing try: import serial except ImportError, e: inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here (not the \".exe\"): http://pypi.python.org/pypi/pyserial" + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: C:\\[Program files]\\inkscape\\python\\Lib\\" + "\n3. Restart Inkscape.")) return # TODO: Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self) try: self.hpgl = myHpglEncoder.getHpgl() except Exception as inst: if inst.args[0] == 'NO_PATHS': # issue error if no paths found inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return 1 else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) ''' # reparse data for preview self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) try: doc, warnings = myHpglDecoder.getSvg() # deliver document to inkscape self.document = doc except Exception as inst: if inst.args[0] == 'NO_HPGL_DATA': # do nothing pass else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback ''' # send data to plotter if self.options.flowControl == '1': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, xonxoff=True) elif self.options.flowControl == '2': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, dsrdtr=None, rtscts=True) else: mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10) try: mySerial.write(self.hpgl) except Exception as inst: if inst.args[0] == 'Write timeout': inkex.errormsg(_("Could not send data. Please check that your plotter is running, connected and the settings are correct.")) else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) mySerial.read(2) mySerial.close() if __name__ == '__main__': # Raise recursion limit to avoid exceptions on big documents sys.setrecursionlimit(20000); # start extension e = MyEffect() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file -- cgit v1.2.3 From 9d4d82ce94c327033bce64c289648c8f7b84c5e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sat, 2 Nov 2013 22:52:43 +0100 Subject: text changes (bzr r12417.1.33) --- share/extensions/plotter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index c9dd2d7ff..29ad2d177 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -1 +1 @@ -#!/usr/bin/env python # coding=utf-8 ''' Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' # standard library import sys # local library import gettext, hpgl_decoder, hpgl_encoder, inkex inkex.localize() class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') def effect(self): # gracefully exit script when pySerial is missing try: import serial except ImportError, e: inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here (not the \".exe\"): http://pypi.python.org/pypi/pyserial" + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: C:\\[Program files]\\inkscape\\python\\Lib\\" + "\n3. Restart Inkscape.")) return # TODO: Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self) try: self.hpgl = myHpglEncoder.getHpgl() except Exception as inst: if inst.args[0] == 'NO_PATHS': # issue error if no paths found inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return 1 else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) ''' # reparse data for preview self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) try: doc, warnings = myHpglDecoder.getSvg() # deliver document to inkscape self.document = doc except Exception as inst: if inst.args[0] == 'NO_HPGL_DATA': # do nothing pass else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback ''' # send data to plotter if self.options.flowControl == '1': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, xonxoff=True) elif self.options.flowControl == '2': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, dsrdtr=None, rtscts=True) else: mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10) try: mySerial.write(self.hpgl) except Exception as inst: if inst.args[0] == 'Write timeout': inkex.errormsg(_("Could not send data. Please check that your plotter is running, connected and the settings are correct.")) else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) mySerial.read(2) mySerial.close() if __name__ == '__main__': # Raise recursion limit to avoid exceptions on big documents sys.setrecursionlimit(20000); # start extension e = MyEffect() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file +#!/usr/bin/env python # coding=utf-8 ''' Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' # standard library import sys # local library import gettext, hpgl_decoder, hpgl_encoder, inkex inkex.localize() # TODO: Materialvorschub nach plot, rechtecke plotten class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') def effect(self): # gracefully exit script when pySerial is missing try: import serial except ImportError, e: inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here (not the \".exe\"): http://pypi.python.org/pypi/pyserial" + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: C:\\[Program files]\\inkscape\\python\\Lib\\" + "\n3. Restart Inkscape.")) return # TODO: Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self) try: self.hpgl = myHpglEncoder.getHpgl() except Exception as inst: if inst.args[0] == 'NO_PATHS': # issue error if no paths found inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return 1 else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) ''' # reparse data for preview self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) try: doc, warnings = myHpglDecoder.getSvg() # deliver document to inkscape self.document = doc except Exception as inst: if inst.args[0] == 'NO_HPGL_DATA': # do nothing pass else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback ''' # send data to plotter if self.options.flowControl == '1': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, xonxoff=True) elif self.options.flowControl == '2': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, dsrdtr=None, rtscts=True) else: mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10) try: mySerial.write(self.hpgl) except Exception as inst: if inst.args[0] == 'Write timeout': inkex.errormsg(_("Could not send data. Please check that your plotter is running, connected and the settings are correct.")) else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) mySerial.read(2) mySerial.close() if __name__ == '__main__': # Raise recursion limit to avoid exceptions on big documents sys.setrecursionlimit(20000); # start extension e = MyEffect() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file -- cgit v1.2.3 From a1a79d1ce4108f7bb462253d8c100f642cf8dcc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 3 Nov 2013 01:23:14 +0100 Subject: better PEP 8 compatibility (bzr r12417.1.34) --- share/extensions/plotter.py | 125 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 124 insertions(+), 1 deletion(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index 29ad2d177..d0d42c671 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -1 +1,124 @@ -#!/usr/bin/env python # coding=utf-8 ''' Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' # standard library import sys # local library import gettext, hpgl_decoder, hpgl_encoder, inkex inkex.localize() # TODO: Materialvorschub nach plot, rechtecke plotten class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') def effect(self): # gracefully exit script when pySerial is missing try: import serial except ImportError, e: inkex.errormsg(_("pySerial is not installed." + "\n\n1. Download pySerial here (not the \".exe\"): http://pypi.python.org/pypi/pyserial" + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: C:\\[Program files]\\inkscape\\python\\Lib\\" + "\n3. Restart Inkscape.")) return # TODO: Maybe implement DMPL? # get hpgl data myHpglEncoder = hpgl_encoder.hpglEncoder(self) try: self.hpgl = myHpglEncoder.getHpgl() except Exception as inst: if inst.args[0] == 'NO_PATHS': # issue error if no paths found inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) return 1 else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) ''' # reparse data for preview self.options.showMovements = True self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) try: doc, warnings = myHpglDecoder.getSvg() # deliver document to inkscape self.document = doc except Exception as inst: if inst.args[0] == 'NO_HPGL_DATA': # do nothing pass else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback ''' # send data to plotter if self.options.flowControl == '1': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, xonxoff=True) elif self.options.flowControl == '2': mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, dsrdtr=None, rtscts=True) else: mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10) try: mySerial.write(self.hpgl) except Exception as inst: if inst.args[0] == 'Write timeout': inkex.errormsg(_("Could not send data. Please check that your plotter is running, connected and the settings are correct.")) else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) mySerial.read(2) mySerial.close() if __name__ == '__main__': # Raise recursion limit to avoid exceptions on big documents sys.setrecursionlimit(20000); # start extension e = MyEffect() e.affect() # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file +#!/usr/bin/env python +# coding=utf-8 +''' +Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +''' + +# standard library +import sys +# local libraries +import gettext +import hpgl_decoder +import hpgl_encoder +import inkex +inkex.localize() + + +# TODO: Materialvorschub nach plot, rechtecke plotten +class MyEffect(inkex.Effect): + + def __init__(self): + inkex.Effect.__init__(self) + self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') + self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') + self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') + self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') + self.OptionParser.add_option('--orientation', action='store', type='string', dest='orientation', default='90', help='orientation') + self.OptionParser.add_option('--mirrorX', action='store', type='inkbool', dest='mirrorX', default='FALSE', help='Mirror X-axis') + self.OptionParser.add_option('--mirrorY', action='store', type='inkbool', dest='mirrorY', default='FALSE', help='Mirror Y-axis') + self.OptionParser.add_option('--center', action='store', type='inkbool', dest='center', default='FALSE', help='Center zero point') + self.OptionParser.add_option('--flat', action='store', type='float', dest='flat', default=1.2, help='Curve flatness') + self.OptionParser.add_option('--useOvercut', action='store', type='inkbool', dest='useOvercut', default='TRUE', help='Use overcut') + self.OptionParser.add_option('--overcut', action='store', type='float', dest='overcut', default=1.0, help='Overcut (mm)') + self.OptionParser.add_option('--useToolOffset', action='store', type='inkbool', dest='useToolOffset', default='TRUE', help='Correct tool offset') + self.OptionParser.add_option('--toolOffset', action='store', type='float', dest='toolOffset', default=0.25, help='Tool offset (mm)') + self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') + self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') + self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') + self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') + self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') + self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') + + def effect(self): + # gracefully exit script when pySerial is missing + try: + import serial + except ImportError, e: + inkex.errormsg(_("pySerial is not installed." + + "\n\n1. Download pySerial here (not the \".exe\"): http://pypi.python.org/pypi/pyserial" + + "\n2. Extract the \"serial\" subfolder from the zip to the following folder: C:\\[Program files]\\inkscape\\python\\Lib\\" + + "\n3. Restart Inkscape.")) + return + # TODO: Maybe implement DMPL? + # get hpgl data + myHpglEncoder = hpgl_encoder.hpglEncoder(self) + try: + self.hpgl = myHpglEncoder.getHpgl() + except Exception as inst: + if inst.args[0] == 'NO_PATHS': + # issue error if no paths found + inkex.errormsg(_("No paths where found. Please convert all objects you want to plot into paths.")) + return 1 + else: + type, value, traceback = sys.exc_info() + raise ValueError, ("", type, value), traceback + # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) + ''' + # reparse data for preview + self.options.showMovements = True + self.options.docWidth = float(inkex.unittouu(self.document.getroot().get('width'))) + self.options.docHeight = float(inkex.unittouu(self.document.getroot().get('height'))) + myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options) + try: + doc, warnings = myHpglDecoder.getSvg() + # deliver document to inkscape + self.document = doc + except Exception as inst: + if inst.args[0] == 'NO_HPGL_DATA': + # do nothing + pass + else: + type, value, traceback = sys.exc_info() + raise ValueError, ("", type, value), traceback + ''' + # send data to plotter + if self.options.flowControl == '1': + mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, xonxoff=True) + elif self.options.flowControl == '2': + mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10, dsrdtr=None, rtscts=True) + else: + mySerial = serial.Serial(port=self.options.serialPort, baudrate=self.options.serialBaudRate, timeout=0.1, writeTimeout=10) + try: + mySerial.write(self.hpgl) + except Exception as inst: + if inst.args[0] == 'Write timeout': + inkex.errormsg(_("Could not send data. Please check that your plotter is running, connected and the settings are correct.")) + else: + type, value, traceback = sys.exc_info() + raise ValueError, ("", type, value), traceback + # Read back 2 chars to avoid plotter not plotting last command (I have no idea why this is necessary) + mySerial.read(2) + mySerial.close() + +if __name__ == '__main__': + # Raise recursion limit to avoid exceptions on big documents + sys.setrecursionlimit(20000) + # start extension + e = MyEffect() + e.affect() + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file -- cgit v1.2.3 From fac095aac7e613ac44076d7a45ab71a8771a04c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 3 Nov 2013 02:11:28 +0100 Subject: a 'bit' shorter lines (bzr r12417.1.35) --- share/extensions/plotter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index d0d42c671..6ff6adeaf 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -76,7 +76,8 @@ class MyEffect(inkex.Effect): else: type, value, traceback = sys.exc_info() raise ValueError, ("", type, value), traceback - # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is a preview or a final run. (Remember to set to true) + # TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is + # a preview or a final run. (Remember to set to true) ''' # reparse data for preview self.options.showMovements = True -- cgit v1.2.3 From adb9bd4e463b14d5b5860d8bc17848a30991d48b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 3 Nov 2013 15:52:50 +0100 Subject: added more todos (bzr r12417.1.37) --- share/extensions/plotter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'share/extensions/plotter.py') diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index 6ff6adeaf..aef9e016d 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -28,7 +28,8 @@ import inkex inkex.localize() -# TODO: Materialvorschub nach plot, rechtecke plotten +# TODO: Unittests +# TODO: Material feed after plot, plot rectangles class MyEffect(inkex.Effect): def __init__(self): -- cgit v1.2.3