summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Wüst <sebi@timewaster.de>2013-10-26 20:29:08 +0000
committerSebastian Wüst <sebi@timewaster.de>2013-10-26 20:29:08 +0000
commit27839ab6126ade297f3e0f79f2dfa36de7964bc4 (patch)
tree87ee3d3dadce42633890fc9b116f724f67196f3f
parentsmall optimizations (diff)
downloadinkscape-27839ab6126ade297f3e0f79f2dfa36de7964bc4.tar.gz
inkscape-27839ab6126ade297f3e0f79f2dfa36de7964bc4.zip
small changes (mainly text)
(bzr r12417.1.29)
-rw-r--r--share/extensions/hpgl_encoder.py2
-rw-r--r--share/extensions/hpgl_input.inx2
-rw-r--r--share/extensions/hpgl_output.inx11
-rw-r--r--share/extensions/plotter.inx45
-rw-r--r--share/extensions/plotter.py2
5 files changed, 31 insertions, 31 deletions
diff --git a/share/extensions/hpgl_encoder.py b/share/extensions/hpgl_encoder.py
index 4e642e4a2..435ee2faa 100644
--- a/share/extensions/hpgl_encoder.py
+++ b/share/extensions/hpgl_encoder.py
@@ -145,6 +145,7 @@ class hpglEncoder:
# path to HPGL commands
oldPosX = ''
oldPosY = ''
+ # TODO: Plot smallest parts first to avid plotter dragging parts of foil around (on text)
for singlePath in paths:
cmd = 'PU'
for singlePathPoint in singlePath:
@@ -156,6 +157,7 @@ class hpglEncoder:
oldPosX = posX
oldPosY = posY
# perform overcut
+ # TODO: Find that evasive bug that produces an extra point between the end of the path and the overcut
if self.options.useOvercut and not self.dryRun:
# check if last and first points are the same, otherwise the path is not closed and no overcut can be performed
if int(round(oldPosX)) == int(round(singlePath[0][1][0])) and int(round(oldPosY)) == int(round(singlePath[0][1][1])):
diff --git a/share/extensions/hpgl_input.inx b/share/extensions/hpgl_input.inx
index be0a0e943..d8c33713f 100644
--- a/share/extensions/hpgl_input.inx
+++ b/share/extensions/hpgl_input.inx
@@ -6,7 +6,7 @@
<dependency type="executable" location="extensions">hpgl_decoder.py</dependency>
<dependency type="executable" location="extensions">inkex.py</dependency>
<_param name="introduction" type="description">Please note that you can only open HPGL files written by Inkscape, to open other HPGL files please change their file extension to .plt, make sure you have UniConverter installed and open them again.</_param>
- <param name="space" type="description"> </param>
+ <param name="space" type="description">&#xa0;</param>
<param name="resolutionX" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution X (dpi)" _gui-description="The amount of steps in one inch on the X axis (Default: 1016.0)">1016.0</param>
<param name="resolutionY" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution Y (dpi)" _gui-description="The amount of steps in one inch on the Y axis (Default: 1016.0)">1016.0</param>
<param name="showMovements" type="boolean" _gui-text="Show Movements between paths" _gui-description="Check this to show movements between paths with a different color (Default: Unchecked)">false</param>
diff --git a/share/extensions/hpgl_output.inx b/share/extensions/hpgl_output.inx
index d5cc37d33..7f8705996 100644
--- a/share/extensions/hpgl_output.inx
+++ b/share/extensions/hpgl_output.inx
@@ -14,7 +14,7 @@
<param name="resolutionY" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution Y (dpi)" _gui-description="The amount of steps the cutter moves if it moves for 1 inch on the Y axis - Try different settings to find the one that fits your plotter (Default: 1016.0)">1016.0</param>
<param name="mirrorX" type="boolean" _gui-text="Mirror X-axis" _gui-description="Check this to mirror the X axis - Try different settings to find the one that fits your plotter (Default: Unchecked)">false</param>
<param name="mirrorY" type="boolean" _gui-text="Mirror Y-axis" _gui-description="Check this to mirror the Y axis - Try different settings to find the one that fits your plotter (Default: Unchecked)">false</param>
- <param name="orientation" type="optiongroup" appearance="minimal" _gui-text="Orientation (CW)" _gui-description="Orientation of the plot - Try different settings to find the one that fits your plotter (Default: 0°)">
+ <param name="orientation" type="optiongroup" appearance="minimal" _gui-text="Rotation (Clockwise)" _gui-description="Rotation of the drawing - Try different settings to find the one that fits your plotter (Default: 0°)">
<option value="0">0°</option>
<option value="90">90°</option>
<option value="180">180°</option>
@@ -22,16 +22,15 @@
</param>
<param name="center" type="boolean" _gui-text="Center zero point" _gui-description="Check this if your plotter uses a centered zero point - Try different settings to find the one that fits your plotter (Default: Unchecked)">false</param>
</page>
- <page name="overcut" _gui-text="Overcut">
+ <page name="overcutToolOffset" _gui-text="Overcut &#x26; Tool Offset">
<param name="useOvercut" type="boolean" _gui-text="Use overcut" _gui-description="Check this to use the overcut, if not checked the 'Overcut' parameter is unused (Default: Checked)">true</param>
<param name="overcut" type="float" min="0.0" max="100.0" precision="2" _gui-text="Overcut (mm)" _gui-description="The distance in mm that will be cut over the starting point of the path to prevent open paths (Default: 1.00)">1.00</param>
- </page>
- <page name="toolOffset" _gui-text="Tool Offset">
+ <param name="space" type="description">&#xa0;</param>
<param name="useToolOffset" type="boolean" _gui-text="Use tool offset correction" _gui-description="Check this to use the tool offset correction, if not checked the 'Tool offset' and 'Precut' parameters are unused (Default: Checked)">true</param>
<param name="toolOffset" type="float" min="0.0" max="20.0" precision="2" _gui-text="Tool offset (mm)" _gui-description="The offset from the tool tip to the tool axis in mm (Default: 0.25)">0.25</param>
<param name="precut" type="boolean" _gui-text="Use precut" _gui-description="Check this to cut a small line before the real drawing to align the tool orientation for the first cut (Default: Checked)">true</param>
- <param name="space" type="description"> </param>
- <_param name="offsetNote" type="description">Please note that using the tool offset correction will move your plot away from the zero point by the tool offset.</_param>
+ <param name="space" type="description">&#xa0;</param>
+ <_param name="offsetNote" type="description">Please note that using the tool offset correction will move your plot away from the zero point by the length in mm specified by the tool offset.</_param>
</page>
<page name="misc" _gui-text="Miscellaneous">
<param name="flat" type="float" min="0.1" max="10.0" precision="1" _gui-text="Curve flatness" _gui-description="Curves are divided into lines, this number controls how fine the curves will be reproduced, the smaller the finer (Default: '1.2')">1.2</param>
diff --git a/share/extensions/plotter.inx b/share/extensions/plotter.inx
index f22df3380..6aba009cf 100644
--- a/share/extensions/plotter.inx
+++ b/share/extensions/plotter.inx
@@ -8,20 +8,6 @@
<dependency type="executable" location="extensions">inkex.py</dependency>
<_param name="introduction" type="description">Please make sure that all objects you want to plot are converted to paths. The plot will automatically be aligned to the zero point.</_param>
<param name="tab" type="notebook">
- <page name="plotter" _gui-text="Plotter Settings">
- <param name="pen" type="int" min="0" max="10" _gui-text="Pen number" _gui-description="The number of the pen (tool) to use, on most plotters 1 (Standard: '1')">1</param>
- <param name="resolutionX" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution X (dpi)" _gui-description="The amount of steps the cutter moves if it moves for 1 inch on the X axis - Try different settings to find the one that fits your plotter (Default: 1016.0)">1016.0</param>
- <param name="resolutionY" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution Y (dpi)" _gui-description="The amount of steps the cutter moves if it moves for 1 inch on the Y axis - Try different settings to find the one that fits your plotter (Default: 1016.0)">1016.0</param>
- <param name="mirrorX" type="boolean" _gui-text="Mirror X-axis" _gui-description="Check this to mirror the X axis (Default: Unchecked)">false</param>
- <param name="mirrorY" type="boolean" _gui-text="Mirror Y-axis" _gui-description="Check this to mirror the Y axis - Try different settings to find the one that fits your plotter (Default: Unchecked)">false</param>
- <param name="orientation" type="optiongroup" appearance="minimal" _gui-text="Orientation (CW)" _gui-description="Orientation of the plot - Try different settings to find the one that fits your plotter (Default: 0°)">
- <option value="0">0°</option>
- <option value="90">90°</option>
- <option value="180">180°</option>
- <option value="270">270°</option>
- </param>
- <param name="center" type="boolean" _gui-text="Center zero point" _gui-description="Check this if your plotter uses a centered zero point - Try different settings to find the one that fits your plotter (Default: Unchecked)">false</param>
- </page>
<page name="misc" _gui-text="Connection">
<param name="serialPort" type="string" _gui-text="Serial Port" _gui-description="The port of your serial connection, on Windows something like 'COM1', on Linux something like: '/dev/ttyUSB0' (Default: COM1)">COM1</param>
<param name="serialBaudRate" type="optiongroup" appearance="minimal" _gui-text="Serial Baud rate" _gui-description="The Baud rate of your serial connection (Default: 9600)">
@@ -41,25 +27,38 @@
<option value="115200">115200</option>
</param>
<param name="flowControl" type="optiongroup" appearance="minimal" _gui-text="Flow control" _gui-description="Software / Hardware flow control - Try different settings to find the one that fits your plotter (Default: Software)">
- <option value="0">Software</option>
- <option value="1">Hardware (RTS/CTS)</option>
- <option value="2">Hardware (DSR/DTR)</option>
+ <option value="0">None</option>
+ <option value="1">Software</option>
+ <option value="2">Hardware</option>
</param>
- <param name="space" type="description"> </param>
+ <param name="space" type="description">&#xa0;</param>
<_param name="serialHelp" type="description">This can be a physical serial connection or a USB-to-Serial bridge. Ask your plotter manufacturer for drivers if needed.</_param>
<_param name="parallelHelp" type="description">Please note that Parallel (LPT) connections are not supported.</_param>
<_param name="hpglNote" type="description">Please note that only the HPGL command language is supported at the moment.</_param>
</page>
- <page name="overcut" _gui-text="Overcut">
+ <page name="plotter" _gui-text="Plotter Settings">
+ <param name="pen" type="int" min="0" max="10" _gui-text="Pen number" _gui-description="The number of the pen (tool) to use, on most plotters 1 (Standard: '1')">1</param>
+ <param name="resolutionX" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution X (dpi)" _gui-description="The amount of steps the cutter moves if it moves for 1 inch on the X axis - Try different settings to find the one that fits your plotter (Default: 1016.0)">1016.0</param>
+ <param name="resolutionY" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution Y (dpi)" _gui-description="The amount of steps the cutter moves if it moves for 1 inch on the Y axis - Try different settings to find the one that fits your plotter (Default: 1016.0)">1016.0</param>
+ <param name="mirrorX" type="boolean" _gui-text="Mirror X-axis" _gui-description="Check this to mirror the X axis (Default: Unchecked)">false</param>
+ <param name="mirrorY" type="boolean" _gui-text="Mirror Y-axis" _gui-description="Check this to mirror the Y axis - Try different settings to find the one that fits your plotter (Default: Unchecked)">false</param>
+ <param name="orientation" type="optiongroup" appearance="minimal" _gui-text="Rotation (Clockwise)" _gui-description="Rotation of the plot - Try different settings to find the one that fits your plotter (Default: 0°)">
+ <option value="0">0°</option>
+ <option value="90">90°</option>
+ <option value="180">180°</option>
+ <option value="270">270°</option>
+ </param>
+ <param name="center" type="boolean" _gui-text="Center zero point" _gui-description="Check this if your plotter uses a centered zero point - Try different settings to find the one that fits your plotter (Default: Unchecked)">false</param>
+ </page>
+ <page name="overcutToolOffset" _gui-text="Overcut &#x26; Tool Offset">
<param name="useOvercut" type="boolean" _gui-text="Use overcut" _gui-description="Check this to use the overcut, if not checked the 'Overcut' parameter is unused (Default: Checked)">true</param>
<param name="overcut" type="float" min="0.0" max="100.0" precision="2" _gui-text="Overcut (mm)" _gui-description="The distance in mm that will be cut over the starting point of the path to prevent open paths (Default: 1.00)">1.00</param>
- </page>
- <page name="toolOffset" _gui-text="Tool Offset">
+ <param name="space" type="description">&#xa0;</param>
<param name="useToolOffset" type="boolean" _gui-text="Use tool offset correction" _gui-description="Check this to use the tool offset correction, if not checked the 'Tool offset' and 'Precut' parameters are unused (Default: Checked)">true</param>
<param name="toolOffset" type="float" min="0.0" max="20.0" precision="2" _gui-text="Tool offset (mm)" _gui-description="The offset from the tool tip to the tool axis in mm (Default: 0.25)">0.25</param>
<param name="precut" type="boolean" _gui-text="Use precut" _gui-description="Check this to cut a small line before the real drawing to align the tool orientation for the first cut (Default: Checked)">true</param>
- <param name="space" type="description"> </param>
- <_param name="offsetNote" type="description">Please note that using the tool offset correction will move your plot away from the zero point by the tool offset.</_param>
+ <param name="space" type="description">&#xa0;</param>
+ <_param name="offsetNote" type="description">Please note that using the tool offset correction will move your plot away from the zero point by the length in mm specified by the tool offset.</_param>
</page>
<page name="misc" _gui-text="Miscellaneous">
<param name="flat" type="float" min="0.1" max="10.0" precision="1" _gui-text="Curve flatness" _gui-description="Curves are divided into lines, this number controls how fine the curves will be reproduced, the smaller the finer (Default: '1.2')">1.2</param>
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 <effect needs-live-preview="false"> 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 <effect needs-live-preview='false'> 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