diff options
| author | Alvin Penner <penner@vaxxine.com> | 2010-02-01 23:35:34 +0000 |
|---|---|---|
| committer | Alvin Penner <penner@vaxxine.com> | 2010-02-01 23:35:34 +0000 |
| commit | 5d63da92cad5a9041bd4a082dca1a40676d34bf6 (patch) | |
| tree | c9f3f3fab8f6b29b9f34904d5882471cdf950fb0 | |
| parent | Updates for devlibs revision 9 (diff) | |
| download | inkscape-5d63da92cad5a9041bd4a082dca1a40676d34bf6.tar.gz inkscape-5d63da92cad5a9041bd4a082dca1a40676d34bf6.zip | |
allow switch between LINE and LWPOLYLINE
Fixed bugs:
- https://launchpad.net/bugs/512447
(bzr r9042)
| -rw-r--r-- | share/extensions/dxf_outlines.inx | 8 | ||||
| -rwxr-xr-x | share/extensions/dxf_outlines.py | 14 |
2 files changed, 17 insertions, 5 deletions
diff --git a/share/extensions/dxf_outlines.inx b/share/extensions/dxf_outlines.inx index 169385001..fe8048a8e 100644 --- a/share/extensions/dxf_outlines.inx +++ b/share/extensions/dxf_outlines.inx @@ -7,14 +7,16 @@ <dependency type="executable" location="extensions">inkex.py</dependency> <param name="tab" type="notebook"> <page name="options" _gui-text="Options"> - <param name="ROBO" type="boolean" _gui-text="enable ROBO-Master output">false</param> + <param name="ROBO" type="boolean" _gui-text="use ROBO-Master type of spline output">false</param> + <param name="POLY" type="boolean" _gui-text="use LWPOLYLINE type of line output">true</param> </page> <page name="help" _gui-text="Help"> <_param name="inputhelp" type="description" xml:space="preserve">- AutoCAD Release 13 format. - assume svg drawing is in pixels, at 90 dpi. - assume dxf drawing is in mm. -- only LWPOLYLINE and SPLINE elements are supported. -- ROBO-Master option is a specialized spline readable only by ROBO-Master and AutoDesk viewers, not Inkscape.</_param> +- only line and spline elements are supported. +- ROBO-Master spline output is a specialized spline readable only by ROBO-Master and AutoDesk viewers, not Inkscape. +- LWPOLYLINE output is a multiply-connected polyline, disable it to use a legacy version of the LINE output.</_param> </page> </param> <output> diff --git a/share/extensions/dxf_outlines.py b/share/extensions/dxf_outlines.py index ecdc6ce40..295fc7466 100755 --- a/share/extensions/dxf_outlines.py +++ b/share/extensions/dxf_outlines.py @@ -7,6 +7,7 @@ Copyright (C) 2008 Alvin Penner, penner@vaxxine.com - ROBO-Master output option added Aug 2008 - ROBO-Master multispline output added Sept 2008 - LWPOLYLINE output modification added Dec 2008 +- toggle between LINE/LWPOLYLINE added Jan 2010 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 @@ -53,6 +54,7 @@ class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option("-R", "--ROBO", action="store", type="string", dest="ROBO") + self.OptionParser.add_option("-P", "--POLY", action="store", type="string", dest="POLY") self.OptionParser.add_option("--tab", action="store", type="string", dest="tab") self.OptionParser.add_option("--inputhelp", action="store", type="string", dest="inputhelp") self.dxf = [] @@ -65,6 +67,10 @@ class MyEffect(inkex.Effect): def dxf_add(self, str): self.dxf.append(str) def dxf_line(self,csp): + self.handle += 1 + self.dxf_add(" 0\nLINE\n 5\n%x\n100\nAcDbEntity\n 8\n0\n 62\n%d\n100\nAcDbLine\n" % (self.handle, self.color)) + self.dxf_add(" 10\n%f\n 20\n%f\n 30\n0.0\n 11\n%f\n 21\n%f\n 31\n0.0\n" % (csp[0][0],csp[0][1],csp[1][0],csp[1][1])) + def LWPOLY_line(self,csp): if (abs(csp[0][0] - self.poly[-1][0]) > .0001 or abs(csp[0][1] - self.poly[-1][1]) > .0001): self.LWPOLY_output() # terminate current polyline @@ -174,14 +180,18 @@ class MyEffect(inkex.Effect): s = sub[i] e = sub[i+1] if s[1] == s[2] and e[0] == e[1]: - self.dxf_line([s[1],e[1]]) + if (self.options.POLY == 'true'): + self.LWPOLY_line([s[1],e[1]]) + else: + self.dxf_line([s[1],e[1]]) elif (self.options.ROBO == 'true'): self.ROBO_spline([s[1],s[2],e[0],e[1]]) else: self.dxf_spline([s[1],s[2],e[0],e[1]]) if self.options.ROBO == 'true': self.ROBO_output() - self.LWPOLY_output() + if self.options.POLY == 'true': + self.LWPOLY_output() self.dxf_add(dxf_templates.r14_footer) if __name__ == '__main__': |
