From d550d7e550171072cd9170dbd75f2cbc7605b345 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Mon, 27 Dec 2010 11:18:05 -0500 Subject: [PATCH] Extensions. Add option to choose dxf output units --- share/extensions/dxf_outlines.inx | 11 ++++++++++- share/extensions/dxf_outlines.py | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/share/extensions/dxf_outlines.inx b/share/extensions/dxf_outlines.inx index fe8048a8e..8e8c54c6c 100644 --- a/share/extensions/dxf_outlines.inx +++ b/share/extensions/dxf_outlines.inx @@ -9,11 +9,20 @@ false true + + <_item value="72./90">pt + <_item value="1./15">pc + <_item value="1.">px + <_item value="25.4/90">mm + <_item value="2.54/90">cm + <_item value=".0254/90">m + <_item value="1./90">in + <_item value="1./1080">ft + <_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 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. diff --git a/share/extensions/dxf_outlines.py b/share/extensions/dxf_outlines.py index 9c0ec3557..6dd0de477 100755 --- a/share/extensions/dxf_outlines.py +++ b/share/extensions/dxf_outlines.py @@ -58,6 +58,7 @@ class MyEffect(inkex.Effect): 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("--units", action="store", type="string", dest="units") self.OptionParser.add_option("--tab", action="store", type="string", dest="tab") self.OptionParser.add_option("--inputhelp", action="store", type="string", dest="inputhelp") self.dxf = [] @@ -236,7 +237,9 @@ class MyEffect(inkex.Effect): self.dxf_add(" 0\nLAYER\n 5\n%x\n100\nAcDbSymbolTableRecord\n100\nAcDbLayerTableRecord\n 2\n%s\n 70\n0\n 6\nCONTINUOUS\n" % (i + 80, self.layers[i])) self.dxf_add(dxf_templates.r14_style) - scale = 25.4/90.0 + scale = eval(self.options.units) + if not scale: + scale = 25.4/90 h = inkex.unittouu(self.document.getroot().xpath('@height', namespaces=inkex.NSS)[0]) self.groupmat = [[[scale, 0.0, 0.0], [0.0, -scale, h*scale]]] doc = self.document.getroot() -- 2.30.2