summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7929191)
raw | patch | inline | side by side (parent: 7929191)
author | prokoudine <prokoudine@users.sourceforge.net> | |
Thu, 5 Jun 2008 15:56:03 +0000 (15:56 +0000) | ||
committer | prokoudine <prokoudine@users.sourceforge.net> | |
Thu, 5 Jun 2008 15:56:03 +0000 (15:56 +0000) |
po/POTFILES.in | patch | blob | history | |
share/extensions/Makefile.am | patch | blob | history | |
share/extensions/hpgl_output.inx | [new file with mode: 0644] | patch | blob |
share/extensions/hpgl_output.py | [new file with mode: 0644] | patch | blob |
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 3c20358b315ea717319be9aa8a97af523fac8084..a520095b74eb44131d2b9d4ddff898fe27cf471e 100644 (file)
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
[type: gettext/xml] share/extensions/grid_cartesian.inx
[type: gettext/xml] share/extensions/grid_polar.inx
[type: gettext/xml] share/extensions/handles.inx
+[type: gettext/xml] share/extensions/hpgl_output.inx
[type: gettext/xml] share/extensions/inkscape_help_askaquestion.inx
[type: gettext/xml] share/extensions/inkscape_help_commandline.inx
[type: gettext/xml] share/extensions/inkscape_help_faq.inx
index 62fa9eeda8fe45c93a01b592083349f7cec175d4..73b5ad78a796604fd60b689bccd72069b5ac1782 100644 (file)
grid_cartesian.py \
grid_polar.py \
handles.py \
+ hpgl_output.py \
ill2svg.pl \
inkex.py \
interp.py \
grid_cartesian.inx \
grid_polar.inx \
handles.inx \
+ hpgl_output.inx \
inkscape_help_askaquestion.inx \
inkscape_help_commandline.inx \
inkscape_help_faq.inx\
diff --git a/share/extensions/hpgl_output.inx b/share/extensions/hpgl_output.inx
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+ <_name>HPGL Output</_name>
+ <id>org.ekips.output.hpgl</id>
+ <dependency type="extension">org.inkscape.output.svg.inkscape</dependency>
+ <dependency type="executable" location="extensions">hpgl_output.py</dependency>
+ <dependency type="executable" location="extensions">inkex.py</dependency>
+ <output>
+ <extension>.hpgl</extension>
+ <mimetype>image/hpgl</mimetype>
+ <_filetypename>HP Graphics Language file (*.hpgl)</_filetypename>
+ <_filetypetooltip>Export to an HP Graphics Language file</_filetypetooltip>
+ <dataloss>TRUE</dataloss>\r
+ </output>
+ <script>
+ <command reldir="extensions" interpreter="python">hpgl_output.py</command>
+ <helper_extension>org.inkscape.output.svg.inkscape</helper_extension>\r
+ </script>\r
+</inkscape-extension>\r
diff --git a/share/extensions/hpgl_output.py b/share/extensions/hpgl_output.py
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/env python \r
+'''\r
+Copyright (C) 2008 Aaron Spike, aaron@ekips.org\r
+\r
+This program is free software; you can redistribute it and/or modify\r
+it under the terms of the GNU General Public License as published by\r
+the Free Software Foundation; either version 2 of the License, or\r
+(at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+'''\r
+import inkex, cubicsuperpath, simplepath, cspsubdiv\r
+\r
+class MyEffect(inkex.Effect):\r
+ def __init__(self):\r
+ inkex.Effect.__init__(self)\r
+ self.OptionParser.add_option("-f", "--flatness",\r
+ action="store", type="float", \r
+ dest="flat", default=10.0,\r
+ help="Minimum flatness of the subdivided curves")\r
+ self.hpgl = ['IN;SP1;']\r
+ def output(self):\r
+ print ''.join(self.hpgl)\r
+ def effect(self):\r
+ path = '//svg:path'
+ for node in self.document.getroot().xpath(path, namespaces=inkex.NSS):\r
+ d = node.get('d')\r
+ p = cubicsuperpath.parsePath(d)\r
+ cspsubdiv.cspsubdiv(p, self.options.flat)\r
+ for sp in p:\r
+ first = True\r
+ for csp in sp:\r
+ cmd = 'PD'\r
+ if first:\r
+ cmd = 'PU'\r
+ first = False\r
+ self.hpgl.append('%s%s,%s;' % (cmd,csp[1][0],csp[1][1]))\r
+\r
+e = MyEffect()\r
+e.affect()
\ No newline at end of file