Code

noop: In share/extensions: svn propset svn:eol-style native *.py *.inx
authorpjrm <pjrm@users.sourceforge.net>
Tue, 7 Apr 2009 06:42:09 +0000 (06:42 +0000)
committerpjrm <pjrm@users.sourceforge.net>
Tue, 7 Apr 2009 06:42:09 +0000 (06:42 +0000)
In four cases, there were a mix of end-of-line styles.

share/extensions/dxf_input.py
share/extensions/foldable-box.inx
share/extensions/grid_cartesian.inx
share/extensions/grid_polar.inx
share/extensions/guides_creator.inx
share/extensions/hpgl_output.py
share/extensions/polyhedron_3d.inx
share/extensions/printing-marks.inx
share/extensions/printing-marks.py
share/extensions/svgcalendar.inx
share/extensions/triangle.inx

index 6937825a2fbd66c1c62cd9dc2e329c452d440fd9..d2e645ea1dec9a44babd97633cd30c7118749f7e 100644 (file)
-#!/usr/bin/env python\r
-'''\r
-dxf_input.py - input a DXF file >= (AutoCAD Release 13 == AC1012)\r
-\r
-Copyright (C) 2008, 2009 Alvin Penner, penner@vaxxine.com\r
-Copyright (C) 2009 Christian Mayer, inkscape@christianmayer.de\r
-- thanks to Aaron Spike for inkex.py and simplestyle.py\r
-- without which this would not have been possible\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
-\r
-import inkex, simplestyle, math\r
-from StringIO import StringIO\r
-\r
-def export_MTEXT():\r
-    # mandatory group codes : (1, 10, 20) (text, x, y)\r
-    if vals[groups['1']] and vals[groups['10']] and vals[groups['20']]:\r
-        x = vals[groups['10']][0]\r
-        y = vals[groups['20']][0]\r
-        # optional group codes : (40, 50) (text height mm, text angle)\r
-        size = 12                       # default fontsize in px\r
-        if vals[groups['40']]:\r
-            size = scale*vals[groups['40']][0]\r
-        attribs = {'x': '%f' % x, 'y': '%f' % y, 'style': 'font-size: %dpx; fill: %s' % (size, color)}\r
-        angle = 0                       # default angle in degrees\r
-        if vals[groups['50']]:\r
-            angle = vals[groups['50']][0]\r
-            attribs.update({'transform': 'rotate (%f %f %f)' % (-angle, x, y)})\r
-        attribs.update({inkex.addNS('linespacing','sodipodi'): '125%'})\r
-        node = inkex.etree.SubElement(layer, 'text', attribs)\r
-        text = vals[groups['1']][0]\r
-        found = text.find('\P')         # new line\r
-        while found > -1:\r
-            tspan = inkex.etree.SubElement(node , 'tspan', {inkex.addNS('role','sodipodi'): 'line'})\r
-            tspan.text = text[:found]\r
-            text = text[(found+2):]\r
-            found = text.find('\P')\r
-        tspan = inkex.etree.SubElement(node , 'tspan', {inkex.addNS('role','sodipodi'): 'line'})\r
-        tspan.text = text\r
-\r
-def export_POINT():\r
-    # mandatory group codes : (10, 20) (x, y)\r
-    if vals[groups['10']] and vals[groups['20']]:\r
-        generate_ellipse(vals[groups['10']][0], vals[groups['20']][0], w/2, 0.0, 1.0, 0.0, 0.0)\r
-\r
-def export_LINE():\r
-    # mandatory group codes : (10, 11, 20, 21) (x1, x2, y1, y2)\r
-    if vals[groups['10']] and vals[groups['11']] and vals[groups['20']] and vals[groups['21']]:\r
-        path = 'M %f,%f %f,%f' % (vals[groups['10']][0], vals[groups['20']][0], scale*(vals[groups['11']][0] - xmin), - scale*(vals[groups['21']][0] - ymax))\r
-        attribs = {'d': path, 'style': style}\r
-        inkex.etree.SubElement(layer, 'path', attribs)\r
-\r
-def export_SPLINE():\r
-    # mandatory group codes : (10, 20, 70) (x, y, flags)\r
-    if vals[groups['10']] and vals[groups['20']] and vals[groups['70']]:\r
-        if not (vals[groups['70']][0] & 3) and len(vals[groups['10']]) == 4 and len(vals[groups['20']]) == 4:\r
-            path = 'M %f,%f C %f,%f %f,%f %f,%f' % (vals[groups['10']][0], vals[groups['20']][0], vals[groups['10']][1], vals[groups['20']][1], vals[groups['10']][2], vals[groups['20']][2], vals[groups['10']][3], vals[groups['20']][3])\r
-            attribs = {'d': path, 'style': style}\r
-            inkex.etree.SubElement(layer, 'path', attribs)\r
-        if not (vals[groups['70']][0] & 3) and len(vals[groups['10']]) == 3 and len(vals[groups['20']]) == 3:\r
-            path = 'M %f,%f Q %f,%f %f,%f' % (vals[groups['10']][0], vals[groups['20']][0], vals[groups['10']][1], vals[groups['20']][1], vals[groups['10']][2], vals[groups['20']][2])\r
-            attribs = {'d': path, 'style': style}\r
-            inkex.etree.SubElement(layer, 'path', attribs)\r
-\r
-def export_CIRCLE():\r
-    # mandatory group codes : (10, 20, 40) (x, y, radius)\r
-    if vals[groups['10']] and vals[groups['20']] and vals[groups['40']]:\r
-        generate_ellipse(vals[groups['10']][0], vals[groups['20']][0], scale*vals[groups['40']][0], 0.0, 1.0, 0.0, 0.0)\r
-\r
-def export_ARC():\r
-    # mandatory group codes : (10, 20, 40, 50, 51) (x, y, radius, angle1, angle2)\r
-    if vals[groups['10']] and vals[groups['20']] and vals[groups['40']] and vals[groups['50']] and vals[groups['51']]:\r
-        generate_ellipse(vals[groups['10']][0], vals[groups['20']][0], scale*vals[groups['40']][0], 0.0, 1.0, vals[groups['50']][0]*math.pi/180.0, vals[groups['51']][0]*math.pi/180.0)\r
-\r
-def export_ELLIPSE():\r
-    # mandatory group codes : (10, 11, 20, 21, 40, 41, 42) (xc, xm, yc, ym, width ratio, angle1, angle2)\r
-    if vals[groups['10']] and vals[groups['11']] and vals[groups['20']] and vals[groups['21']] and vals[groups['40']] and vals[groups['41']] and vals[groups['42']]:\r
-        generate_ellipse(vals[groups['10']][0], vals[groups['20']][0], scale*vals[groups['11']][0], scale*vals[groups['21']][0], vals[groups['40']][0], vals[groups['41']][0], vals[groups['42']][0])\r
-\r
-def export_LEADER():\r
-    # mandatory group codes : (10, 20) (x, y)\r
-    if vals[groups['10']] and vals[groups['20']]:\r
-        if len(vals[groups['10']]) > 1 and len(vals[groups['20']]) == len(vals[groups['10']]):\r
-            path = 'M %f,%f' % (vals[groups['10']][0], vals[groups['20']][0])\r
-            for i in range (1, len(vals[groups['10']])):\r
-                path += ' %f,%f' % (vals[groups['10']][i], vals[groups['20']][i])\r
-            attribs = {'d': path, 'style': style}\r
-            inkex.etree.SubElement(layer, 'path', attribs)\r
-\r
-def export_LWPOLYLINE():\r
-    # mandatory group codes : (10, 20, 70) (x, y, flags)\r
-    if vals[groups['10']] and vals[groups['20']] and vals[groups['70']]:\r
-        if len(vals[groups['10']]) > 1 and len(vals[groups['20']]) == len(vals[groups['10']]):\r
-            # optional group codes : (42) (bulge)\r
-            iseqs = 0\r
-            ibulge = 0\r
-            while seqs[iseqs] != '20':\r
-                iseqs += 1\r
-            path = 'M %f,%f' % (vals[groups['10']][0], vals[groups['20']][0])\r
-            xold = vals[groups['10']][0]\r
-            yold = vals[groups['20']][0]\r
-            for i in range (1, len(vals[groups['10']])):\r
-                bulge = 0\r
-                iseqs += 1\r
-                while seqs[iseqs] != '20':\r
-                    if seqs[iseqs] == '42':\r
-                        bulge = vals[groups['42']][ibulge]\r
-                        ibulge += 1\r
-                    iseqs += 1\r
-                if bulge:\r
-                    sweep = 0                   # sweep CCW\r
-                    if bulge < 0:\r
-                        sweep = 1               # sweep CW\r
-                        bulge = -bulge\r
-                    large = 0                   # large-arc-flag\r
-                    if bulge > 1:\r
-                        large = 1\r
-                    r = math.sqrt((vals[groups['10']][i] - xold)**2 + (vals[groups['20']][i] - yold)**2)\r
-                    r = 0.25*r*(bulge + 1.0/bulge)\r
-                    path += ' A %f,%f 0.0 %d %d %f,%f' % (r, r, large, sweep, vals[groups['10']][i], vals[groups['20']][i])\r
-                else:\r
-                    path += ' L %f,%f' % (vals[groups['10']][i], vals[groups['20']][i])\r
-                xold = vals[groups['10']][i]\r
-                yold = vals[groups['20']][i]\r
-            if vals[groups['70']][0] == 1:      # closed path\r
-                path += ' z'\r
-            attribs = {'d': path, 'style': style}\r
-            inkex.etree.SubElement(layer, 'path', attribs)\r
-\r
-def export_HATCH():\r
-    # mandatory group codes : (10, 20, 72, 93) (x, y, Edge Type, Number of edges)\r
-    if vals[groups['10']] and vals[groups['20']] and vals[groups['72']] and vals[groups['93']]:\r
-        if len(vals[groups['10']]) > 1 and len(vals[groups['20']]) == len(vals[groups['10']]):\r
-            # optional group codes : (11, 21, 40, 50, 51, 73) (x, y, r, angle1, angle2, CCW)\r
-            i10 = 1    # count start points\r
-            i11 = 0    # count line end points\r
-            i40 = 0    # count circles\r
-            i72 = 0    # count edge type flags\r
-            path = ''\r
-            for i in range (0, len(vals[groups['93']])):\r
-                xc = vals[groups['10']][i10]\r
-                yc = vals[groups['20']][i10]\r
-                if vals[groups['72']][i72] == 2:            # arc\r
-                    rm = scale*vals[groups['40']][i40]\r
-                    a1 = vals[groups['50']][i40]\r
-                    path += 'M %f,%f ' % (xc + rm*math.cos(a1*math.pi/180.0), yc + rm*math.sin(a1*math.pi/180.0))\r
-                else:\r
-                    a1 = 0\r
-                    path += 'M %f,%f ' % (xc, yc)\r
-                for j in range(0, vals[groups['93']][i]):\r
-                    if vals[groups['72']][i72] == 2:        # arc\r
-                        xc = vals[groups['10']][i10]\r
-                        yc = vals[groups['20']][i10]\r
-                        rm = scale*vals[groups['40']][i40]\r
-                        a2 = vals[groups['51']][i40]\r
-                        diff = (a2 - a1 + 360) % (360)\r
-                        sweep = 1 - vals[groups['73']][i40] # sweep CCW\r
-                        large = 0                           # large-arc-flag\r
-                        if diff:\r
-                            path += 'A %f,%f 0.0 %d %d %f,%f ' % (rm, rm, large, sweep, xc + rm*math.cos(a2*math.pi/180.0), yc + rm*math.sin(a2*math.pi/180.0))\r
-                        else:\r
-                            path += 'A %f,%f 0.0 %d %d %f,%f ' % (rm, rm, large, sweep, xc + rm*math.cos((a1+180.0)*math.pi/180.0), yc + rm*math.sin((a1+180.0)*math.pi/180.0))\r
-                            path += 'A %f,%f 0.0 %d %d %f,%f ' % (rm, rm, large, sweep, xc + rm*math.cos(a1*math.pi/180.0), yc + rm*math.sin(a1*math.pi/180.0))\r
-                        i40 += 1\r
-                        i72 += 1\r
-                    elif vals[groups['72']][i72] == 1:      # line\r
-                        path += 'L %f,%f ' % (scale*(vals[groups['11']][i11] - xmin), -scale*(vals[groups['21']][i11] - ymax))\r
-                        i11 += 1\r
-                        i72 += 1\r
-                    elif vals[groups['72']][i72] == 0:      # polyline\r
-                        if j > 0:\r
-                            path += 'L %f,%f ' % (vals[groups['10']][i10], vals[groups['20']][i10])\r
-                        if j == vals[groups['93']][i] - 1:\r
-                            i72 += 1\r
-                    i10 += 1\r
-                path += "z "\r
-            style = simplestyle.formatStyle({'fill': '%s' % color})\r
-            attribs = {'d': path, 'style': style}\r
-            inkex.etree.SubElement(layer, 'path', attribs)\r
-\r
-def export_DIMENSION():\r
-    # mandatory group codes : (10, 11, 13, 14, 20, 21, 23, 24) (x1..4, y1..4)\r
-    if vals[groups['10']] and vals[groups['11']] and vals[groups['13']] and vals[groups['14']] and vals[groups['20']] and vals[groups['21']] and vals[groups['23']] and vals[groups['24']]:\r
-        dx = abs(vals[groups['10']][0] - vals[groups['13']][0])\r
-        dy = abs(vals[groups['20']][0] - vals[groups['23']][0])\r
-        if (vals[groups['10']][0] == vals[groups['14']][0]) and dx > 0.00001:\r
-            d = dx/scale\r
-            dy = 0\r
-            path = 'M %f,%f %f,%f' % (vals[groups['10']][0], vals[groups['20']][0], vals[groups['13']][0], vals[groups['20']][0])\r
-        elif (vals[groups['20']][0] == vals[groups['24']][0]) and dy > 0.00001:\r
-            d = dy/scale\r
-            dx = 0\r
-            path = 'M %f,%f %f,%f' % (vals[groups['10']][0], vals[groups['20']][0], vals[groups['10']][0], vals[groups['23']][0])\r
-        else:\r
-            return\r
-        attribs = {'d': path, 'style': style + '; marker-start: url(#DistanceX); marker-end: url(#DistanceX)'}\r
-        inkex.etree.SubElement(layer, 'path', attribs)\r
-        x = scale*(vals[groups['11']][0] - xmin)\r
-        y = - scale*(vals[groups['21']][0] - ymax)\r
-        size = 3                    # default fontsize in px\r
-        attribs = {'x': '%f' % x, 'y': '%f' % y, 'style': 'font-size: %dpx; fill: %s' % (size, color)}\r
-        if dx == 0:\r
-            attribs.update({'transform': 'rotate (%f %f %f)' % (-90, x, y)})\r
-        node = inkex.etree.SubElement(layer, 'text', attribs)\r
-        tspan = inkex.etree.SubElement(node , 'tspan', {inkex.addNS('role','sodipodi'): 'line'})\r
-        tspan.text = '%.2f' % d\r
-\r
-def generate_ellipse(xc, yc, xm, ym, w, a1, a2):\r
-    rm = math.sqrt(xm*xm + ym*ym)\r
-    a = math.atan2(ym, xm)\r
-    diff = (a2 - a1 + 2*math.pi) % (2*math.pi)\r
-    if diff:                        # open arc\r
-        large = 0                   # large-arc-flag\r
-        if diff > math.pi:\r
-            large = 1\r
-        xt = rm*math.cos(a1)\r
-        yt = w*rm*math.sin(a1)\r
-        x1 = xt*math.cos(a) - yt*math.sin(a)\r
-        y1 = xt*math.sin(a) + yt*math.cos(a)\r
-        xt = rm*math.cos(a2)\r
-        yt = w*rm*math.sin(a2)\r
-        x2 = xt*math.cos(a) - yt*math.sin(a)\r
-        y2 = xt*math.sin(a) + yt*math.cos(a)\r
-        path = 'M %f,%f A %f,%f %f %d 0 %f,%f' % (xc+x1, yc-y1, rm, w*rm, -180.0*a/math.pi, large, xc+x2, yc-y2)\r
-    else:                           # closed arc\r
-        path = 'M %f,%f A %f,%f %f 1 0 %f,%f %f,%f %f 1 0 %f,%f z' % (xc+xm, yc-ym, rm, w*rm, -180.0*a/math.pi, xc-xm, yc+ym, rm, w*rm, -180.0*a/math.pi, xc+xm, yc-ym)\r
-    attribs = {'d': path, 'style': style}\r
-    inkex.etree.SubElement(layer, 'path', attribs)\r
-\r
-def get_line():\r
-    return (stream.readline().strip(), stream.readline().strip())\r
-\r
-def get_group(group):\r
-    line = get_line()\r
-    if line[0] == group:\r
-        return float(line[1])\r
-    else:\r
-        return 0.0\r
-\r
-#   define DXF Entities and specify which Group Codes to monitor\r
-\r
-entities = {'MTEXT': export_MTEXT, 'TEXT': export_MTEXT, 'POINT': export_POINT, 'LINE': export_LINE, 'SPLINE': export_SPLINE, 'CIRCLE': export_CIRCLE, 'ARC': export_ARC, 'ELLIPSE': export_ELLIPSE, 'LEADER': export_LEADER, 'LWPOLYLINE': export_LWPOLYLINE, 'HATCH': export_HATCH, 'DIMENSION': export_DIMENSION, 'ENDSEC': ''}\r
-groups = {'1': 0, '8': 1, '10': 2, '11': 3, '13': 4, '14': 5, '20': 6, '21': 7, '23': 8, '24': 9, '40': 10, '41': 11, '42': 12, '50': 13, '51': 14, '62': 15, '70': 16, '72': 17, '73': 18, '93': 19, '370': 20}\r
-colors = {  1: '#FF0000',   2: '#FFFF00',   3: '#00FF00',   4: '#00FFFF',   5: '#0000FF',\r
-            6: '#FF00FF',   8: '#414141',   9: '#808080',  30: '#FF7F00',\r
-          250: '#333333', 251: '#505050', 252: '#696969', 253: '#828282', 254: '#BEBEBE', 255: '#FFFFFF'}\r
-\r
-doc = inkex.etree.parse(StringIO('<svg xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"></svg>'))\r
-defs = inkex.etree.SubElement(doc.getroot(), 'defs', {} )\r
-marker = inkex.etree.SubElement(defs, 'marker', {'id': 'DistanceX', 'orient': 'auto', 'refX': '0.0', 'refY': '0.0', 'style': 'overflow:visible'})\r
-inkex.etree.SubElement(marker, 'path', {'d': 'M 3,-3 L -3,3 M 0,-5 L  0,5', 'style': 'stroke:#000000; stroke-width:0.5'})\r
-stream = open(inkex.sys.argv[1], 'r')\r
-xmax = xmin = 0.0\r
-ymax = 297.0                                        # default A4 height in mm\r
-line = get_line()\r
-flag = 0\r
-layer_colors = {}                                   # store colors by layer\r
-layer_nodes = {}                                    # store nodes by layer\r
-while line[0] and line[1] != 'ENTITIES':\r
-    line = get_line()\r
-    if line[1] == '$EXTMIN':\r
-        xmin = get_group('10')\r
-    if line[1] == '$EXTMAX':\r
-        xmax = get_group('10')\r
-        ymax = get_group('20')\r
-    if flag and line[0] == '2':\r
-        name = unicode(line[1], "iso-8859-1")\r
-        attribs = {inkex.addNS('groupmode','inkscape'): 'layer', inkex.addNS('label','inkscape'): '%s' % name}\r
-        layer_nodes[name] = inkex.etree.SubElement(doc.getroot(), 'g', attribs)\r
-    if line[0] == '2' and line[1] == 'LAYER':\r
-        flag = 1\r
-    if flag and line[0] == '62':\r
-        layer_colors[name] = int(line[1])\r
-    if line[0] == '0' and line[1] == 'ENDTAB':\r
-        flag = 0\r
-\r
-scale = 90.0/25.4                                   # default convert from mm to pixels\r
-if xmax > xmin:\r
-    scale *= 210.0/(xmax - xmin)                    # scale to A4 width\r
-entity = ''\r
-while line[0] and line[1] != 'ENDSEC':\r
-    line = get_line()\r
-    if entity and groups.has_key(line[0]):\r
-        seqs.append(line[0])                        # list of group codes\r
-        if line[0] == '1' or line[0] == '8':        # text value\r
-            val = line[1].replace('\~', ' ')\r
-            val = inkex.re.sub( '\\\\A.*;', '', val)\r
-            val = inkex.re.sub( '\\\\H.*;', '', val)\r
-            val = inkex.re.sub( '\\\\S.*;', '', val)\r
-            val = inkex.re.sub( '\\\\W.*;', '', val)\r
-            val = unicode(val, "iso-8859-1")\r
-        elif line[0] == '62' or line[0] == '70' or line[0] == '93':\r
-            val = int(line[1])\r
-        elif line[0] == '10' or line[0] == '13' or line[0] == '14': # scaled float x value\r
-            val = scale*(float(line[1]) - xmin)\r
-        elif line[0] == '20' or line[0] == '23' or line[0] == '24': # scaled float y value\r
-            val = - scale*(float(line[1]) - ymax)\r
-        else:                                       # unscaled float value\r
-            val = float(line[1])\r
-        vals[groups[line[0]]].append(val)\r
-    elif entities.has_key(line[1]):\r
-        if entities.has_key(entity):\r
-            color = '#000000'                       # default color\r
-            if vals[groups['8']]:                   # Common Layer Name\r
-                layer = layer_nodes[vals[groups['8']][0]]\r
-                if layer_colors.has_key(vals[groups['8']][0]):\r
-                    if colors.has_key(layer_colors[vals[groups['8']][0]]):\r
-                        color = colors[layer_colors[vals[groups['8']][0]]]\r
-            if vals[groups['62']]:                  # Common Color Number\r
-                if colors.has_key(vals[groups['62']][0]):\r
-                    color = colors[vals[groups['62']][0]]\r
-            style = simplestyle.formatStyle({'stroke': '%s' % color, 'fill': 'none'})\r
-            w = 0.5                                 # default lineweight for POINT\r
-            if vals[groups['370']]:                 # Common Lineweight\r
-                if vals[groups['370']][0] > 0:\r
-                    w = 90.0/25.4*vals[groups['370']][0]/100.0\r
-                    if w < 0.5:\r
-                        w = 0.5\r
-                    style = simplestyle.formatStyle({'stroke': '%s' % color, 'fill': 'none', 'stroke-width': '%.1f' % w})\r
-            entities[entity]()\r
-        entity = line[1]\r
-        vals = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]\r
-        seqs = []\r
-\r
-doc.write(inkex.sys.stdout)\r
-\r
-# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99\r
+#!/usr/bin/env python
+'''
+dxf_input.py - input a DXF file >= (AutoCAD Release 13 == AC1012)
+
+Copyright (C) 2008, 2009 Alvin Penner, penner@vaxxine.com
+Copyright (C) 2009 Christian Mayer, inkscape@christianmayer.de
+- thanks to Aaron Spike for inkex.py and simplestyle.py
+- without which this would not have been possible
+
+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
+'''
+
+import inkex, simplestyle, math
+from StringIO import StringIO
+
+def export_MTEXT():
+    # mandatory group codes : (1, 10, 20) (text, x, y)
+    if vals[groups['1']] and vals[groups['10']] and vals[groups['20']]:
+        x = vals[groups['10']][0]
+        y = vals[groups['20']][0]
+        # optional group codes : (40, 50) (text height mm, text angle)
+        size = 12                       # default fontsize in px
+        if vals[groups['40']]:
+            size = scale*vals[groups['40']][0]
+        attribs = {'x': '%f' % x, 'y': '%f' % y, 'style': 'font-size: %dpx; fill: %s' % (size, color)}
+        angle = 0                       # default angle in degrees
+        if vals[groups['50']]:
+            angle = vals[groups['50']][0]
+            attribs.update({'transform': 'rotate (%f %f %f)' % (-angle, x, y)})
+        attribs.update({inkex.addNS('linespacing','sodipodi'): '125%'})
+        node = inkex.etree.SubElement(layer, 'text', attribs)
+        text = vals[groups['1']][0]
+        found = text.find('\P')         # new line
+        while found > -1:
+            tspan = inkex.etree.SubElement(node , 'tspan', {inkex.addNS('role','sodipodi'): 'line'})
+            tspan.text = text[:found]
+            text = text[(found+2):]
+            found = text.find('\P')
+        tspan = inkex.etree.SubElement(node , 'tspan', {inkex.addNS('role','sodipodi'): 'line'})
+        tspan.text = text
+
+def export_POINT():
+    # mandatory group codes : (10, 20) (x, y)
+    if vals[groups['10']] and vals[groups['20']]:
+        generate_ellipse(vals[groups['10']][0], vals[groups['20']][0], w/2, 0.0, 1.0, 0.0, 0.0)
+
+def export_LINE():
+    # mandatory group codes : (10, 11, 20, 21) (x1, x2, y1, y2)
+    if vals[groups['10']] and vals[groups['11']] and vals[groups['20']] and vals[groups['21']]:
+        path = 'M %f,%f %f,%f' % (vals[groups['10']][0], vals[groups['20']][0], scale*(vals[groups['11']][0] - xmin), - scale*(vals[groups['21']][0] - ymax))
+        attribs = {'d': path, 'style': style}
+        inkex.etree.SubElement(layer, 'path', attribs)
+
+def export_SPLINE():
+    # mandatory group codes : (10, 20, 70) (x, y, flags)
+    if vals[groups['10']] and vals[groups['20']] and vals[groups['70']]:
+        if not (vals[groups['70']][0] & 3) and len(vals[groups['10']]) == 4 and len(vals[groups['20']]) == 4:
+            path = 'M %f,%f C %f,%f %f,%f %f,%f' % (vals[groups['10']][0], vals[groups['20']][0], vals[groups['10']][1], vals[groups['20']][1], vals[groups['10']][2], vals[groups['20']][2], vals[groups['10']][3], vals[groups['20']][3])
+            attribs = {'d': path, 'style': style}
+            inkex.etree.SubElement(layer, 'path', attribs)
+        if not (vals[groups['70']][0] & 3) and len(vals[groups['10']]) == 3 and len(vals[groups['20']]) == 3:
+            path = 'M %f,%f Q %f,%f %f,%f' % (vals[groups['10']][0], vals[groups['20']][0], vals[groups['10']][1], vals[groups['20']][1], vals[groups['10']][2], vals[groups['20']][2])
+            attribs = {'d': path, 'style': style}
+            inkex.etree.SubElement(layer, 'path', attribs)
+
+def export_CIRCLE():
+    # mandatory group codes : (10, 20, 40) (x, y, radius)
+    if vals[groups['10']] and vals[groups['20']] and vals[groups['40']]:
+        generate_ellipse(vals[groups['10']][0], vals[groups['20']][0], scale*vals[groups['40']][0], 0.0, 1.0, 0.0, 0.0)
+
+def export_ARC():
+    # mandatory group codes : (10, 20, 40, 50, 51) (x, y, radius, angle1, angle2)
+    if vals[groups['10']] and vals[groups['20']] and vals[groups['40']] and vals[groups['50']] and vals[groups['51']]:
+        generate_ellipse(vals[groups['10']][0], vals[groups['20']][0], scale*vals[groups['40']][0], 0.0, 1.0, vals[groups['50']][0]*math.pi/180.0, vals[groups['51']][0]*math.pi/180.0)
+
+def export_ELLIPSE():
+    # mandatory group codes : (10, 11, 20, 21, 40, 41, 42) (xc, xm, yc, ym, width ratio, angle1, angle2)
+    if vals[groups['10']] and vals[groups['11']] and vals[groups['20']] and vals[groups['21']] and vals[groups['40']] and vals[groups['41']] and vals[groups['42']]:
+        generate_ellipse(vals[groups['10']][0], vals[groups['20']][0], scale*vals[groups['11']][0], scale*vals[groups['21']][0], vals[groups['40']][0], vals[groups['41']][0], vals[groups['42']][0])
+
+def export_LEADER():
+    # mandatory group codes : (10, 20) (x, y)
+    if vals[groups['10']] and vals[groups['20']]:
+        if len(vals[groups['10']]) > 1 and len(vals[groups['20']]) == len(vals[groups['10']]):
+            path = 'M %f,%f' % (vals[groups['10']][0], vals[groups['20']][0])
+            for i in range (1, len(vals[groups['10']])):
+                path += ' %f,%f' % (vals[groups['10']][i], vals[groups['20']][i])
+            attribs = {'d': path, 'style': style}
+            inkex.etree.SubElement(layer, 'path', attribs)
+
+def export_LWPOLYLINE():
+    # mandatory group codes : (10, 20, 70) (x, y, flags)
+    if vals[groups['10']] and vals[groups['20']] and vals[groups['70']]:
+        if len(vals[groups['10']]) > 1 and len(vals[groups['20']]) == len(vals[groups['10']]):
+            # optional group codes : (42) (bulge)
+            iseqs = 0
+            ibulge = 0
+            while seqs[iseqs] != '20':
+                iseqs += 1
+            path = 'M %f,%f' % (vals[groups['10']][0], vals[groups['20']][0])
+            xold = vals[groups['10']][0]
+            yold = vals[groups['20']][0]
+            for i in range (1, len(vals[groups['10']])):
+                bulge = 0
+                iseqs += 1
+                while seqs[iseqs] != '20':
+                    if seqs[iseqs] == '42':
+                        bulge = vals[groups['42']][ibulge]
+                        ibulge += 1
+                    iseqs += 1
+                if bulge:
+                    sweep = 0                   # sweep CCW
+                    if bulge < 0:
+                        sweep = 1               # sweep CW
+                        bulge = -bulge
+                    large = 0                   # large-arc-flag
+                    if bulge > 1:
+                        large = 1
+                    r = math.sqrt((vals[groups['10']][i] - xold)**2 + (vals[groups['20']][i] - yold)**2)
+                    r = 0.25*r*(bulge + 1.0/bulge)
+                    path += ' A %f,%f 0.0 %d %d %f,%f' % (r, r, large, sweep, vals[groups['10']][i], vals[groups['20']][i])
+                else:
+                    path += ' L %f,%f' % (vals[groups['10']][i], vals[groups['20']][i])
+                xold = vals[groups['10']][i]
+                yold = vals[groups['20']][i]
+            if vals[groups['70']][0] == 1:      # closed path
+                path += ' z'
+            attribs = {'d': path, 'style': style}
+            inkex.etree.SubElement(layer, 'path', attribs)
+
+def export_HATCH():
+    # mandatory group codes : (10, 20, 72, 93) (x, y, Edge Type, Number of edges)
+    if vals[groups['10']] and vals[groups['20']] and vals[groups['72']] and vals[groups['93']]:
+        if len(vals[groups['10']]) > 1 and len(vals[groups['20']]) == len(vals[groups['10']]):
+            # optional group codes : (11, 21, 40, 50, 51, 73) (x, y, r, angle1, angle2, CCW)
+            i10 = 1    # count start points
+            i11 = 0    # count line end points
+            i40 = 0    # count circles
+            i72 = 0    # count edge type flags
+            path = ''
+            for i in range (0, len(vals[groups['93']])):
+                xc = vals[groups['10']][i10]
+                yc = vals[groups['20']][i10]
+                if vals[groups['72']][i72] == 2:            # arc
+                    rm = scale*vals[groups['40']][i40]
+                    a1 = vals[groups['50']][i40]
+                    path += 'M %f,%f ' % (xc + rm*math.cos(a1*math.pi/180.0), yc + rm*math.sin(a1*math.pi/180.0))
+                else:
+                    a1 = 0
+                    path += 'M %f,%f ' % (xc, yc)
+                for j in range(0, vals[groups['93']][i]):
+                    if vals[groups['72']][i72] == 2:        # arc
+                        xc = vals[groups['10']][i10]
+                        yc = vals[groups['20']][i10]
+                        rm = scale*vals[groups['40']][i40]
+                        a2 = vals[groups['51']][i40]
+                        diff = (a2 - a1 + 360) % (360)
+                        sweep = 1 - vals[groups['73']][i40] # sweep CCW
+                        large = 0                           # large-arc-flag
+                        if diff:
+                            path += 'A %f,%f 0.0 %d %d %f,%f ' % (rm, rm, large, sweep, xc + rm*math.cos(a2*math.pi/180.0), yc + rm*math.sin(a2*math.pi/180.0))
+                        else:
+                            path += 'A %f,%f 0.0 %d %d %f,%f ' % (rm, rm, large, sweep, xc + rm*math.cos((a1+180.0)*math.pi/180.0), yc + rm*math.sin((a1+180.0)*math.pi/180.0))
+                            path += 'A %f,%f 0.0 %d %d %f,%f ' % (rm, rm, large, sweep, xc + rm*math.cos(a1*math.pi/180.0), yc + rm*math.sin(a1*math.pi/180.0))
+                        i40 += 1
+                        i72 += 1
+                    elif vals[groups['72']][i72] == 1:      # line
+                        path += 'L %f,%f ' % (scale*(vals[groups['11']][i11] - xmin), -scale*(vals[groups['21']][i11] - ymax))
+                        i11 += 1
+                        i72 += 1
+                    elif vals[groups['72']][i72] == 0:      # polyline
+                        if j > 0:
+                            path += 'L %f,%f ' % (vals[groups['10']][i10], vals[groups['20']][i10])
+                        if j == vals[groups['93']][i] - 1:
+                            i72 += 1
+                    i10 += 1
+                path += "z "
+            style = simplestyle.formatStyle({'fill': '%s' % color})
+            attribs = {'d': path, 'style': style}
+            inkex.etree.SubElement(layer, 'path', attribs)
+
+def export_DIMENSION():
+    # mandatory group codes : (10, 11, 13, 14, 20, 21, 23, 24) (x1..4, y1..4)
+    if vals[groups['10']] and vals[groups['11']] and vals[groups['13']] and vals[groups['14']] and vals[groups['20']] and vals[groups['21']] and vals[groups['23']] and vals[groups['24']]:
+        dx = abs(vals[groups['10']][0] - vals[groups['13']][0])
+        dy = abs(vals[groups['20']][0] - vals[groups['23']][0])
+        if (vals[groups['10']][0] == vals[groups['14']][0]) and dx > 0.00001:
+            d = dx/scale
+            dy = 0
+            path = 'M %f,%f %f,%f' % (vals[groups['10']][0], vals[groups['20']][0], vals[groups['13']][0], vals[groups['20']][0])
+        elif (vals[groups['20']][0] == vals[groups['24']][0]) and dy > 0.00001:
+            d = dy/scale
+            dx = 0
+            path = 'M %f,%f %f,%f' % (vals[groups['10']][0], vals[groups['20']][0], vals[groups['10']][0], vals[groups['23']][0])
+        else:
+            return
+        attribs = {'d': path, 'style': style + '; marker-start: url(#DistanceX); marker-end: url(#DistanceX)'}
+        inkex.etree.SubElement(layer, 'path', attribs)
+        x = scale*(vals[groups['11']][0] - xmin)
+        y = - scale*(vals[groups['21']][0] - ymax)
+        size = 3                    # default fontsize in px
+        attribs = {'x': '%f' % x, 'y': '%f' % y, 'style': 'font-size: %dpx; fill: %s' % (size, color)}
+        if dx == 0:
+            attribs.update({'transform': 'rotate (%f %f %f)' % (-90, x, y)})
+        node = inkex.etree.SubElement(layer, 'text', attribs)
+        tspan = inkex.etree.SubElement(node , 'tspan', {inkex.addNS('role','sodipodi'): 'line'})
+        tspan.text = '%.2f' % d
+
+def generate_ellipse(xc, yc, xm, ym, w, a1, a2):
+    rm = math.sqrt(xm*xm + ym*ym)
+    a = math.atan2(ym, xm)
+    diff = (a2 - a1 + 2*math.pi) % (2*math.pi)
+    if diff:                        # open arc
+        large = 0                   # large-arc-flag
+        if diff > math.pi:
+            large = 1
+        xt = rm*math.cos(a1)
+        yt = w*rm*math.sin(a1)
+        x1 = xt*math.cos(a) - yt*math.sin(a)
+        y1 = xt*math.sin(a) + yt*math.cos(a)
+        xt = rm*math.cos(a2)
+        yt = w*rm*math.sin(a2)
+        x2 = xt*math.cos(a) - yt*math.sin(a)
+        y2 = xt*math.sin(a) + yt*math.cos(a)
+        path = 'M %f,%f A %f,%f %f %d 0 %f,%f' % (xc+x1, yc-y1, rm, w*rm, -180.0*a/math.pi, large, xc+x2, yc-y2)
+    else:                           # closed arc
+        path = 'M %f,%f A %f,%f %f 1 0 %f,%f %f,%f %f 1 0 %f,%f z' % (xc+xm, yc-ym, rm, w*rm, -180.0*a/math.pi, xc-xm, yc+ym, rm, w*rm, -180.0*a/math.pi, xc+xm, yc-ym)
+    attribs = {'d': path, 'style': style}
+    inkex.etree.SubElement(layer, 'path', attribs)
+
+def get_line():
+    return (stream.readline().strip(), stream.readline().strip())
+
+def get_group(group):
+    line = get_line()
+    if line[0] == group:
+        return float(line[1])
+    else:
+        return 0.0
+
+#   define DXF Entities and specify which Group Codes to monitor
+
+entities = {'MTEXT': export_MTEXT, 'TEXT': export_MTEXT, 'POINT': export_POINT, 'LINE': export_LINE, 'SPLINE': export_SPLINE, 'CIRCLE': export_CIRCLE, 'ARC': export_ARC, 'ELLIPSE': export_ELLIPSE, 'LEADER': export_LEADER, 'LWPOLYLINE': export_LWPOLYLINE, 'HATCH': export_HATCH, 'DIMENSION': export_DIMENSION, 'ENDSEC': ''}
+groups = {'1': 0, '8': 1, '10': 2, '11': 3, '13': 4, '14': 5, '20': 6, '21': 7, '23': 8, '24': 9, '40': 10, '41': 11, '42': 12, '50': 13, '51': 14, '62': 15, '70': 16, '72': 17, '73': 18, '93': 19, '370': 20}
+colors = {  1: '#FF0000',   2: '#FFFF00',   3: '#00FF00',   4: '#00FFFF',   5: '#0000FF',
+            6: '#FF00FF',   8: '#414141',   9: '#808080',  30: '#FF7F00',
+          250: '#333333', 251: '#505050', 252: '#696969', 253: '#828282', 254: '#BEBEBE', 255: '#FFFFFF'}
+
+doc = inkex.etree.parse(StringIO('<svg xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"></svg>'))
+defs = inkex.etree.SubElement(doc.getroot(), 'defs', {} )
+marker = inkex.etree.SubElement(defs, 'marker', {'id': 'DistanceX', 'orient': 'auto', 'refX': '0.0', 'refY': '0.0', 'style': 'overflow:visible'})
+inkex.etree.SubElement(marker, 'path', {'d': 'M 3,-3 L -3,3 M 0,-5 L  0,5', 'style': 'stroke:#000000; stroke-width:0.5'})
+stream = open(inkex.sys.argv[1], 'r')
+xmax = xmin = 0.0
+ymax = 297.0                                        # default A4 height in mm
+line = get_line()
+flag = 0
+layer_colors = {}                                   # store colors by layer
+layer_nodes = {}                                    # store nodes by layer
+while line[0] and line[1] != 'ENTITIES':
+    line = get_line()
+    if line[1] == '$EXTMIN':
+        xmin = get_group('10')
+    if line[1] == '$EXTMAX':
+        xmax = get_group('10')
+        ymax = get_group('20')
+    if flag and line[0] == '2':
+        name = unicode(line[1], "iso-8859-1")
+        attribs = {inkex.addNS('groupmode','inkscape'): 'layer', inkex.addNS('label','inkscape'): '%s' % name}
+        layer_nodes[name] = inkex.etree.SubElement(doc.getroot(), 'g', attribs)
+    if line[0] == '2' and line[1] == 'LAYER':
+        flag = 1
+    if flag and line[0] == '62':
+        layer_colors[name] = int(line[1])
+    if line[0] == '0' and line[1] == 'ENDTAB':
+        flag = 0
+
+scale = 90.0/25.4                                   # default convert from mm to pixels
+if xmax > xmin:
+    scale *= 210.0/(xmax - xmin)                    # scale to A4 width
+entity = ''
+while line[0] and line[1] != 'ENDSEC':
+    line = get_line()
+    if entity and groups.has_key(line[0]):
+        seqs.append(line[0])                        # list of group codes
+        if line[0] == '1' or line[0] == '8':        # text value
+            val = line[1].replace('\~', ' ')
+            val = inkex.re.sub( '\\\\A.*;', '', val)
+            val = inkex.re.sub( '\\\\H.*;', '', val)
+            val = inkex.re.sub( '\\\\S.*;', '', val)
+            val = inkex.re.sub( '\\\\W.*;', '', val)
+            val = unicode(val, "iso-8859-1")
+        elif line[0] == '62' or line[0] == '70' or line[0] == '93':
+            val = int(line[1])
+        elif line[0] == '10' or line[0] == '13' or line[0] == '14': # scaled float x value
+            val = scale*(float(line[1]) - xmin)
+        elif line[0] == '20' or line[0] == '23' or line[0] == '24': # scaled float y value
+            val = - scale*(float(line[1]) - ymax)
+        else:                                       # unscaled float value
+            val = float(line[1])
+        vals[groups[line[0]]].append(val)
+    elif entities.has_key(line[1]):
+        if entities.has_key(entity):
+            color = '#000000'                       # default color
+            if vals[groups['8']]:                   # Common Layer Name
+                layer = layer_nodes[vals[groups['8']][0]]
+                if layer_colors.has_key(vals[groups['8']][0]):
+                    if colors.has_key(layer_colors[vals[groups['8']][0]]):
+                        color = colors[layer_colors[vals[groups['8']][0]]]
+            if vals[groups['62']]:                  # Common Color Number
+                if colors.has_key(vals[groups['62']][0]):
+                    color = colors[vals[groups['62']][0]]
+            style = simplestyle.formatStyle({'stroke': '%s' % color, 'fill': 'none'})
+            w = 0.5                                 # default lineweight for POINT
+            if vals[groups['370']]:                 # Common Lineweight
+                if vals[groups['370']][0] > 0:
+                    w = 90.0/25.4*vals[groups['370']][0]/100.0
+                    if w < 0.5:
+                        w = 0.5
+                    style = simplestyle.formatStyle({'stroke': '%s' % color, 'fill': 'none', 'stroke-width': '%.1f' % w})
+            entities[entity]()
+        entity = line[1]
+        vals = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]
+        seqs = []
+
+doc.write(inkex.sys.stdout)
+
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 35694731705ec2b326ff68bb975bd22762f59d80..e53bc8b7490ab0a382da1387632fa1ac4f68de3d 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
   <_name>Foldable Box</_name>
-  <id>org.inkscape.render.foldable-box</id>\r
+  <id>org.inkscape.render.foldable-box</id>
   <dependency type="executable" location="extensions">foldable-box.py</dependency>
   <dependency type="executable" location="extensions">inkex.py</dependency>
   <param name="width"  type="float" min="0.1" max="1000.0" _gui-text="Width">10.0</param>
@@ -9,14 +9,14 @@
   <param name="depth"  type="float" min="0.1" max="1000.0" _gui-text="Depth">3.0</param>
   <param name="paper-thickness" type="float" min="0.0" max="100.0" _gui-text="Paper Thickness">0.01</param>
   <param name="tab-proportion" type="float" min="0.1" max="1.0" _gui-text="Tab Proportion">0.6</param>
-  <param name="unit"   type="enum" _gui-text="Unit">\r
-    <item>px</item>\r
-    <item>pt</item>\r
-    <item>in</item>\r
-    <item>cm</item>\r
-    <item>mm</item>\r
-  </param>\r
-  <param name="guide-line" type="boolean" _gui-text="Add Guide Lines">true</param>\r
+  <param name="unit"   type="enum" _gui-text="Unit">
+    <item>px</item>
+    <item>pt</item>
+    <item>in</item>
+    <item>cm</item>
+    <item>mm</item>
+  </param>
+  <param name="guide-line" type="boolean" _gui-text="Add Guide Lines">true</param>
   <effect>
          <object-type>all</object-type>
     <effects-menu>
index 576d131a917f7d54cd91b497e671d07c36ad0086..ecec105de054e98ff1e0abcd5d9d5b62dad9b3eb 100644 (file)
@@ -1,36 +1,36 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">\r
-    <_name>Cartesian Grid</_name>\r
-    <id>grid.cartesian</id>\r
-    <dependency type="executable" location="extensions">grid_cartesian.py</dependency>\r
-    <dependency type="executable" location="extensions">inkex.py</dependency>\r
-    <param name="x_divs"          type="int"     min="1" max="1000" _gui-text="Major X Divisions">6</param>\r
-    <param name="dx"              type="float"   min="1" max="1000" _gui-text="Major X Division Spacing [px]">100.0</param>\r
-    <param name="x_subdivs"       type="int"     min="1" max="1000" _gui-text="Subdivisions per Major X Division">2</param>\r
-    <param name="x_log"           type="boolean"                    _gui-text="Logarithmic X Subdiv. (Base given by entry above)">false</param>\r
-    <param name="x_subsubdivs"    type="int"     min="1" max="1000" _gui-text="Subsubdivs. per X Subdivision">5</param>\r
-    <param name="x_half_freq"     type="int"     min="1" max="1000" _gui-text="Halve X Subsubdiv. Frequency after 'n' Subdivs. (log only)">4</param>\r
-    <param name="x_divs_th"       type="float"   min="0" max="1000" _gui-text="Major X Division Thickness [px]">2</param>\r
-    <param name="x_subdivs_th"    type="float"   min="0" max="1000" _gui-text="Minor X Division Thickness [px]">1</param>\r
-    <param name="x_subsubdivs_th" type="float"   min="0" max="1000" _gui-text="Subminor X Division Thickness [px]">0.3</param>\r
-    <param name="y_divs"          type="int"     min="1" max="1000" _gui-text="Major Y Divisions">5</param>\r
-    <param name="dy"              type="float"   min="1" max="1000" _gui-text="Major Y Division Spacing [px]">100.0</param>\r
-    <param name="y_subdivs"       type="int"     min="1" max="1000" _gui-text="Subdivisions per Major Y Division">1</param>\r
-    <param name="y_log"           type="boolean"                    _gui-text="Logarithmic Y Subdiv. (Base given by entry above)">false</param>\r
-    <param name="y_subsubdivs"    type="int"     min="1" max="1000" _gui-text="Subsubdivs. per Y Subdivision">5</param>\r
-    <param name="y_half_freq"     type="int"     min="1" max="1000" _gui-text="Halve Y Subsubdiv. Frequency after 'n' Subdivs. (log only)">4</param>\r
-    <param name="y_divs_th"       type="float"   min="0" max="1000" _gui-text="Major Y Division Thickness [px]">2</param>\r
-    <param name="y_subdivs_th"    type="float"   min="0" max="1000" _gui-text="Minor Y Division Thickness [px]">1</param>\r
-    <param name="y_subsubdivs_th" type="float"   min="0" max="1000" _gui-text="Subminor Y Division Thickness [px]">0.3</param>\r
-    <param name="border_th"       type="float"   min="0" max="1000" _gui-text="Border Thickness [px]">3</param>\r
-    \r
-    <effect>\r
-        <object-type>all</object-type>\r
-                <effects-menu>\r
-                    <submenu _name="Render"/>\r
-                </effects-menu>\r
-    </effect>\r
-    <script>\r
-        <command reldir="extensions" interpreter="python">grid_cartesian.py</command>\r
-    </script>\r
-</inkscape-extension>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+    <_name>Cartesian Grid</_name>
+    <id>grid.cartesian</id>
+    <dependency type="executable" location="extensions">grid_cartesian.py</dependency>
+    <dependency type="executable" location="extensions">inkex.py</dependency>
+    <param name="x_divs"          type="int"     min="1" max="1000" _gui-text="Major X Divisions">6</param>
+    <param name="dx"              type="float"   min="1" max="1000" _gui-text="Major X Division Spacing [px]">100.0</param>
+    <param name="x_subdivs"       type="int"     min="1" max="1000" _gui-text="Subdivisions per Major X Division">2</param>
+    <param name="x_log"           type="boolean"                    _gui-text="Logarithmic X Subdiv. (Base given by entry above)">false</param>
+    <param name="x_subsubdivs"    type="int"     min="1" max="1000" _gui-text="Subsubdivs. per X Subdivision">5</param>
+    <param name="x_half_freq"     type="int"     min="1" max="1000" _gui-text="Halve X Subsubdiv. Frequency after 'n' Subdivs. (log only)">4</param>
+    <param name="x_divs_th"       type="float"   min="0" max="1000" _gui-text="Major X Division Thickness [px]">2</param>
+    <param name="x_subdivs_th"    type="float"   min="0" max="1000" _gui-text="Minor X Division Thickness [px]">1</param>
+    <param name="x_subsubdivs_th" type="float"   min="0" max="1000" _gui-text="Subminor X Division Thickness [px]">0.3</param>
+    <param name="y_divs"          type="int"     min="1" max="1000" _gui-text="Major Y Divisions">5</param>
+    <param name="dy"              type="float"   min="1" max="1000" _gui-text="Major Y Division Spacing [px]">100.0</param>
+    <param name="y_subdivs"       type="int"     min="1" max="1000" _gui-text="Subdivisions per Major Y Division">1</param>
+    <param name="y_log"           type="boolean"                    _gui-text="Logarithmic Y Subdiv. (Base given by entry above)">false</param>
+    <param name="y_subsubdivs"    type="int"     min="1" max="1000" _gui-text="Subsubdivs. per Y Subdivision">5</param>
+    <param name="y_half_freq"     type="int"     min="1" max="1000" _gui-text="Halve Y Subsubdiv. Frequency after 'n' Subdivs. (log only)">4</param>
+    <param name="y_divs_th"       type="float"   min="0" max="1000" _gui-text="Major Y Division Thickness [px]">2</param>
+    <param name="y_subdivs_th"    type="float"   min="0" max="1000" _gui-text="Minor Y Division Thickness [px]">1</param>
+    <param name="y_subsubdivs_th" type="float"   min="0" max="1000" _gui-text="Subminor Y Division Thickness [px]">0.3</param>
+    <param name="border_th"       type="float"   min="0" max="1000" _gui-text="Border Thickness [px]">3</param>
+    
+    <effect>
+        <object-type>all</object-type>
+                <effects-menu>
+                    <submenu _name="Render"/>
+                </effects-menu>
+    </effect>
+    <script>
+        <command reldir="extensions" interpreter="python">grid_cartesian.py</command>
+    </script>
+</inkscape-extension>
index fa4098bf4892384b7a412aaf1e44b433d5179e7a..ec73681faaa813658f275cd221cbb2772f0788bf 100644 (file)
@@ -1,35 +1,35 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">\r
-    <_name>Polar Grid</_name>\r
-    <id>grids.polar</id>\r
-    <dependency type="executable" location="extensions">grid_polar.py</dependency>\r
-    <dependency type="executable" location="extensions">inkex.py</dependency>\r
-    <param name="r_divs"       type="int"   min="1" max="1000" _gui-text="Major Circular Divisions">5</param>\r
-    <param name="dr"           type="float" min="1" max="1000" _gui-text="Major Circular Division Spacing [px]">50.0</param>\r
-    <param name="r_subdivs"    type="int"   min="1" max="1000" _gui-text="Subdivisions per Major Circular Division">3</param>\r
-    <param name="r_log"        type="boolean"                  _gui-text="Logarithmic Subdiv. (Base given by entry above)">false</param>\r
-    <param name="r_divs_th"    type="float" min="0" max="1000" _gui-text="Major Circular Division Thickness [px]">2</param>\r
-    <param name="r_subdivs_th" type="float" min="0" max="1000" _gui-text="Minor Circular Division Thickness [px]">1</param>\r
-    <param name="a_divs"       type="int"   min="1" max="1000" _gui-text="Angle Divisions">24</param>\r
-    <param name="a_divs_cent"  type="int"   min="1" max="1000" _gui-text="Angle Divisions at Centre">4</param>\r
-    <param name="a_subdivs"    type="int"   min="1" max="1000" _gui-text="Subdivisions per Major Angular Division">1</param>\r
-    <param name="a_subdivs_cent"  type="int"   min="0" max="1000" _gui-text="Minor Angle Division End 'n' Divs. Before Centre">2</param>\r
-    <param name="a_divs_th"    type="float" min="0" max="1000" _gui-text="Major Angular Division Thickness [px]">2</param>\r
-    <param name="a_subdivs_th" type="float" min="0" max="1000" _gui-text="Minor Angular Division Thickness [px]">1</param>\r
-    <param name="c_dot_dia"    type="float" min="1" max="1000" _gui-text="Centre Dot Diameter [px]">5.0</param>\r
-    <param name="a_labels"     type="optiongroup"              _gui-text="Circumferential Labels">\r
-        <_option value="none">None</_option>\r
-        <_option value="deg">Degrees</_option></param>\r
-    <param name="a_label_size"   type="int"   min="1" max="1000" _gui-text="Circumferential Label Size [px]">18</param>\r
-    <param name="a_label_outset" type="float" min="0" max="1000" _gui-text="Circumferential Label Outset [px]">24</param>\r
-    \r
-    <effect>\r
-        <object-type>all</object-type>\r
-                <effects-menu>\r
-                    <submenu _name="Render"/>\r
-                </effects-menu>\r
-    </effect>\r
-    <script>\r
-        <command reldir="extensions" interpreter="python">grid_polar.py</command>\r
-    </script>\r
-</inkscape-extension>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+    <_name>Polar Grid</_name>
+    <id>grids.polar</id>
+    <dependency type="executable" location="extensions">grid_polar.py</dependency>
+    <dependency type="executable" location="extensions">inkex.py</dependency>
+    <param name="r_divs"       type="int"   min="1" max="1000" _gui-text="Major Circular Divisions">5</param>
+    <param name="dr"           type="float" min="1" max="1000" _gui-text="Major Circular Division Spacing [px]">50.0</param>
+    <param name="r_subdivs"    type="int"   min="1" max="1000" _gui-text="Subdivisions per Major Circular Division">3</param>
+    <param name="r_log"        type="boolean"                  _gui-text="Logarithmic Subdiv. (Base given by entry above)">false</param>
+    <param name="r_divs_th"    type="float" min="0" max="1000" _gui-text="Major Circular Division Thickness [px]">2</param>
+    <param name="r_subdivs_th" type="float" min="0" max="1000" _gui-text="Minor Circular Division Thickness [px]">1</param>
+    <param name="a_divs"       type="int"   min="1" max="1000" _gui-text="Angle Divisions">24</param>
+    <param name="a_divs_cent"  type="int"   min="1" max="1000" _gui-text="Angle Divisions at Centre">4</param>
+    <param name="a_subdivs"    type="int"   min="1" max="1000" _gui-text="Subdivisions per Major Angular Division">1</param>
+    <param name="a_subdivs_cent"  type="int"   min="0" max="1000" _gui-text="Minor Angle Division End 'n' Divs. Before Centre">2</param>
+    <param name="a_divs_th"    type="float" min="0" max="1000" _gui-text="Major Angular Division Thickness [px]">2</param>
+    <param name="a_subdivs_th" type="float" min="0" max="1000" _gui-text="Minor Angular Division Thickness [px]">1</param>
+    <param name="c_dot_dia"    type="float" min="1" max="1000" _gui-text="Centre Dot Diameter [px]">5.0</param>
+    <param name="a_labels"     type="optiongroup"              _gui-text="Circumferential Labels">
+        <_option value="none">None</_option>
+        <_option value="deg">Degrees</_option></param>
+    <param name="a_label_size"   type="int"   min="1" max="1000" _gui-text="Circumferential Label Size [px]">18</param>
+    <param name="a_label_outset" type="float" min="0" max="1000" _gui-text="Circumferential Label Outset [px]">24</param>
+    
+    <effect>
+        <object-type>all</object-type>
+                <effects-menu>
+                    <submenu _name="Render"/>
+                </effects-menu>
+    </effect>
+    <script>
+        <command reldir="extensions" interpreter="python">grid_polar.py</command>
+    </script>
+</inkscape-extension>
index 1ec0a6584122bf4735d866e3d263f50926eae309..23fed9d56b1a74c5b5467b4303408f743e702181 100644 (file)
         <param name="vertical_guides" type="optiongroup" appearance="minimal" _gui-text="Vertical guide each">
                <_option value="0">None</_option>
                <_option value="2">1/2</_option>
-               <_option value="3">1/3</_option>\r
+               <_option value="3">1/3</_option>
                 <_option value="4">1/4</_option>
                <_option value="5">1/5</_option>
                <_option value="6">1/6</_option>
                <_option value="7">1/7</_option>
-               <_option value="8">1/8</_option>\r
+               <_option value="8">1/8</_option>
                 <_option value="9">1/9</_option>
                <_option value="10">1/10</_option>
        </param>
        <param name="horizontal_guides" type="optiongroup" appearance="minimal" _gui-text="Horizontal guide each">
                <_option value="0">None</_option>
                <_option value="2">1/2</_option>
-               <_option value="3">1/3</_option>\r
+               <_option value="3">1/3</_option>
                 <_option value="4">1/4</_option>
                <_option value="5">1/5</_option>
                <_option value="6">1/6</_option>
                <_option value="7">1/7</_option>
-               <_option value="8">1/8</_option>\r
+               <_option value="8">1/8</_option>
                 <_option value="9">1/9</_option>
                <_option value="10">1/10</_option>
        </param>
index f327df2f909da31293ef734efa28a34be0cac1c7..306fc0e8bcad79212732815baa9e13ba68a824f7 100644 (file)
@@ -1,48 +1,48 @@
-#!/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'\r
-        for node in self.document.getroot().xpath(path, namespaces=inkex.NSS):\r
-            d = node.get('d')\r
-            if len(simplepath.parsePath(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()\r
+#!/usr/bin/env python 
+'''
+Copyright (C) 2008 Aaron Spike, aaron@ekips.org
+
+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
+'''
+import inkex, cubicsuperpath, simplepath, cspsubdiv
+
+class MyEffect(inkex.Effect):
+    def __init__(self):
+        inkex.Effect.__init__(self)
+        self.OptionParser.add_option("-f", "--flatness",
+                        action="store", type="float", 
+                        dest="flat", default=10.0,
+                        help="Minimum flatness of the subdivided curves")
+        self.hpgl = ['IN;SP1;']
+    def output(self):
+        print ''.join(self.hpgl)
+    def effect(self):
+        path = '//svg:path'
+        for node in self.document.getroot().xpath(path, namespaces=inkex.NSS):
+            d = node.get('d')
+            if len(simplepath.parsePath(d)):
+                p = cubicsuperpath.parsePath(d)
+                cspsubdiv.cspsubdiv(p, self.options.flat)
+                for sp in p:
+                    first = True
+                    for csp in sp:
+                        cmd = 'PD'
+                        if first:
+                            cmd = 'PU'
+                        first = False
+                        self.hpgl.append('%s%s,%s;' % (cmd,csp[1][0],csp[1][1]))
+
+e = MyEffect()
+e.affect()
index 17c80814e497b57ba2754a83c959e8a6591ed878..4f1de90c7506be6ed760aac3bd1bf767c5612998 100644 (file)
@@ -1,98 +1,98 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">\r
-    <_name>3D Polyhedron</_name>\r
-    <id>math.polyhedron.3d</id>\r
-    <dependency type="executable" location="extensions">polyhedron_3d.py</dependency>\r
-    <dependency type="executable" location="extensions">inkex.py</dependency>\r
-    <param name="tab" type="notebook">\r
-        <page name="common" _gui-text="Model File">\r
-            <param name="obj" type="optiongroup" appearance="minimal" _gui-text="Object:">\r
-                <_option value="cube">Cube</_option>\r
-                <_option value="trunc_cube">Truncated Cube</_option>\r
-                <_option value="snub_cube">Snub Cube</_option>\r
-                <_option value="cuboct">Cuboctohedron</_option>\r
-                <_option value="tet">Tetrahedron</_option>\r
-                <_option value="trunc_tet">Truncated Tetrahedron</_option>\r
-                <_option value="oct">Octahedron</_option>\r
-                <_option value="trunc_oct">Truncated Octahedron</_option>\r
-                <_option value="icos">Icosahedron</_option>\r
-                <_option value="trunc_icos">Truncated Icosahedron</_option>\r
-                <_option value="small_triam_icos">Small Triambic Icosahedron</_option>\r
-                <_option value="dodec">Dodecahedron</_option>\r
-                <_option value="trunc_dodec">Truncated Dodecahedron</_option>\r
-                <_option value="snub_dodec">Snub Dodecahedron</_option>\r
-                <_option value="great_dodec">Great Dodecahedron</_option>\r
-                <_option value="great_stel_dodec">Great Stellated Dodecahedron</_option>\r
-                <_option value="from_file">Load From File</_option>\r
-                </param>\r
-            <param name="spec_file" type="string"  _gui-text="Filename:">great_rhombicuboct.obj</param>\r
-            <param name="type" type="optiongroup" appearance="minimal" _gui-text="Object Type">\r
-                <_option value="face">Face-Specified</_option>\r
-                <_option value="edge">Edge-Specified</_option></param>\r
-            <param name="cw_wound"  type="boolean" _gui-text="Clockwise Wound Object">0</param>\r
-         </page>\r
-         <page name="view" _gui-text="View">\r
-            <param name="r1_ax" type="optiongroup" appearance="minimal" _gui-text="Rotate Around:">\r
-                <_option value="x">X-Axis</_option>\r
-                <_option value="y">Y-Axis</_option>\r
-                <_option value="z">Z-Axis</_option></param>\r
-            <param name="r1_ang"  type="float"   min="-360" max="360"   _gui-text="Rotation / Degrees">0</param>\r
-            <param name="r2_ax" type="optiongroup" appearance="minimal" _gui-text="Then Rotate Around:">\r
-                <_option value="x">X-Axis</_option>\r
-                <_option value="y">Y-Axis</_option>\r
-                <_option value="z">Z-Axis</_option></param>\r
-            <param name="r2_ang"  type="float"   min="-360" max="360"   _gui-text="Rotation / Degrees">0</param>\r
-            <param name="r3_ax" type="optiongroup" appearance="minimal" _gui-text="Then Rotate Around:">\r
-                <_option value="x">X-Axis</_option>\r
-                <_option value="y">Y-Axis</_option>\r
-                <_option value="z">Z-Axis</_option></param>\r
-            <param name="r3_ang"  type="float"   min="-360" max="360"   _gui-text="Rotation / Degrees">0</param>\r
-            <param name="r4_ax" type="optiongroup" appearance="minimal" _gui-text="Rotate Around:">\r
-                <_option value="x">X-Axis</_option>\r
-                <_option value="y">Y-Axis</_option>\r
-                <_option value="z">Z-Axis</_option></param>\r
-            <param name="r4_ang"  type="float"   min="-360" max="360"   _gui-text="Rotation / Degrees">0</param>\r
-            <param name="r5_ax" type="optiongroup" appearance="minimal" _gui-text="Then Rotate Around:">\r
-                <_option value="x">X-Axis</_option>\r
-                <_option value="y">Y-Axis</_option>\r
-                <_option value="z">Z-Axis</_option></param>\r
-            <param name="r5_ang"  type="float"   min="-360" max="360"   _gui-text="Rotation / Degrees">0</param>\r
-            <param name="r6_ax" type="optiongroup" appearance="minimal" _gui-text="Then Rotate Around:">\r
-                <_option value="x">X-Axis</_option>\r
-                <_option value="y">Y-Axis</_option>\r
-                <_option value="z">Z-Axis</_option></param>\r
-            <param name="r6_ang"  type="float"   min="-360" max="360"   _gui-text="Rotation / Degrees">0</param>\r
-        </page>\r
-        <page name="style" _gui-text="Style">\r
-            <param name="scl"    type="float"   min="0"    max="10000" _gui-text="Scaling Factor">100</param>\r
-            <param name="f_r"  type="int"   min="0" max="255" _gui-text="Fill Colour (Red)">255</param>\r
-            <param name="f_g"  type="int"   min="0" max="255" _gui-text="Fill Colour (Green)">0</param>\r
-            <param name="f_b"  type="int"   min="0" max="255" _gui-text="Fill Colour (Blue)">0</param>\r
-            <param name="f_opac" type="int" min="0" max="100" _gui-text="Fill Opacity/ %">100</param>\r
-            <param name="s_opac" type="int" min="0" max="100" _gui-text="Stroke Opacity/ %">100</param>\r
-            <param name="th"   type="float" min="0" max="100" _gui-text="Line Thickness / px">2</param>\r
-            <param name="shade"  type="boolean" _gui-text="Shading">0</param>\r
-            <param name="lv_x" type="float" min="-100" max="100" _gui-text="Light x-Position">1</param>\r
-            <param name="lv_y" type="float" min="-100" max="100" _gui-text="Light y-Position">1</param>\r
-            <param name="lv_z" type="float" min="-100" max="100" _gui-text="Light z-Position">-2</param>\r
-            <param name="show" type="optiongroup" appearance="minimal" _gui-text="Show:">\r
-                <_option value="vtx">Vertices</_option>\r
-                <_option value="edg">Edges</_option>\r
-                <_option value="fce">Faces</_option></param>\r
-            <param name="back"  type="boolean" _gui-text="Draw Back-Facing Polygons">0</param>\r
-            <param name="z_sort" type="optiongroup" appearance="minimal" _gui-text="Z-Sort Faces By:">\r
-                <_option value="max">Maximum</_option>\r
-                <_option value="min">Minimum</_option>\r
-                <_option value="mean">Mean</_option></param>\r
-        </page>\r
-    </param>\r
-    <effect>\r
-        <object-type>all</object-type>\r
-                <effects-menu>\r
-                    <submenu _name="Render"/>\r
-                </effects-menu>\r
-    </effect>\r
-    <script>\r
-        <command reldir="extensions" interpreter="python">polyhedron_3d.py</command>\r
-    </script>\r
-</inkscape-extension>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+    <_name>3D Polyhedron</_name>
+    <id>math.polyhedron.3d</id>
+    <dependency type="executable" location="extensions">polyhedron_3d.py</dependency>
+    <dependency type="executable" location="extensions">inkex.py</dependency>
+    <param name="tab" type="notebook">
+        <page name="common" _gui-text="Model File">
+            <param name="obj" type="optiongroup" appearance="minimal" _gui-text="Object:">
+                <_option value="cube">Cube</_option>
+                <_option value="trunc_cube">Truncated Cube</_option>
+                <_option value="snub_cube">Snub Cube</_option>
+                <_option value="cuboct">Cuboctohedron</_option>
+                <_option value="tet">Tetrahedron</_option>
+                <_option value="trunc_tet">Truncated Tetrahedron</_option>
+                <_option value="oct">Octahedron</_option>
+                <_option value="trunc_oct">Truncated Octahedron</_option>
+                <_option value="icos">Icosahedron</_option>
+                <_option value="trunc_icos">Truncated Icosahedron</_option>
+                <_option value="small_triam_icos">Small Triambic Icosahedron</_option>
+                <_option value="dodec">Dodecahedron</_option>
+                <_option value="trunc_dodec">Truncated Dodecahedron</_option>
+                <_option value="snub_dodec">Snub Dodecahedron</_option>
+                <_option value="great_dodec">Great Dodecahedron</_option>
+                <_option value="great_stel_dodec">Great Stellated Dodecahedron</_option>
+                <_option value="from_file">Load From File</_option>
+                </param>
+            <param name="spec_file" type="string"  _gui-text="Filename:">great_rhombicuboct.obj</param>
+            <param name="type" type="optiongroup" appearance="minimal" _gui-text="Object Type">
+                <_option value="face">Face-Specified</_option>
+                <_option value="edge">Edge-Specified</_option></param>
+            <param name="cw_wound"  type="boolean" _gui-text="Clockwise Wound Object">0</param>
+         </page>
+         <page name="view" _gui-text="View">
+            <param name="r1_ax" type="optiongroup" appearance="minimal" _gui-text="Rotate Around:">
+                <_option value="x">X-Axis</_option>
+                <_option value="y">Y-Axis</_option>
+                <_option value="z">Z-Axis</_option></param>
+            <param name="r1_ang"  type="float"   min="-360" max="360"   _gui-text="Rotation / Degrees">0</param>
+            <param name="r2_ax" type="optiongroup" appearance="minimal" _gui-text="Then Rotate Around:">
+                <_option value="x">X-Axis</_option>
+                <_option value="y">Y-Axis</_option>
+                <_option value="z">Z-Axis</_option></param>
+            <param name="r2_ang"  type="float"   min="-360" max="360"   _gui-text="Rotation / Degrees">0</param>
+            <param name="r3_ax" type="optiongroup" appearance="minimal" _gui-text="Then Rotate Around:">
+                <_option value="x">X-Axis</_option>
+                <_option value="y">Y-Axis</_option>
+                <_option value="z">Z-Axis</_option></param>
+            <param name="r3_ang"  type="float"   min="-360" max="360"   _gui-text="Rotation / Degrees">0</param>
+            <param name="r4_ax" type="optiongroup" appearance="minimal" _gui-text="Rotate Around:">
+                <_option value="x">X-Axis</_option>
+                <_option value="y">Y-Axis</_option>
+                <_option value="z">Z-Axis</_option></param>
+            <param name="r4_ang"  type="float"   min="-360" max="360"   _gui-text="Rotation / Degrees">0</param>
+            <param name="r5_ax" type="optiongroup" appearance="minimal" _gui-text="Then Rotate Around:">
+                <_option value="x">X-Axis</_option>
+                <_option value="y">Y-Axis</_option>
+                <_option value="z">Z-Axis</_option></param>
+            <param name="r5_ang"  type="float"   min="-360" max="360"   _gui-text="Rotation / Degrees">0</param>
+            <param name="r6_ax" type="optiongroup" appearance="minimal" _gui-text="Then Rotate Around:">
+                <_option value="x">X-Axis</_option>
+                <_option value="y">Y-Axis</_option>
+                <_option value="z">Z-Axis</_option></param>
+            <param name="r6_ang"  type="float"   min="-360" max="360"   _gui-text="Rotation / Degrees">0</param>
+        </page>
+        <page name="style" _gui-text="Style">
+            <param name="scl"    type="float"   min="0"    max="10000" _gui-text="Scaling Factor">100</param>
+            <param name="f_r"  type="int"   min="0" max="255" _gui-text="Fill Colour (Red)">255</param>
+            <param name="f_g"  type="int"   min="0" max="255" _gui-text="Fill Colour (Green)">0</param>
+            <param name="f_b"  type="int"   min="0" max="255" _gui-text="Fill Colour (Blue)">0</param>
+            <param name="f_opac" type="int" min="0" max="100" _gui-text="Fill Opacity/ %">100</param>
+            <param name="s_opac" type="int" min="0" max="100" _gui-text="Stroke Opacity/ %">100</param>
+            <param name="th"   type="float" min="0" max="100" _gui-text="Line Thickness / px">2</param>
+            <param name="shade"  type="boolean" _gui-text="Shading">0</param>
+            <param name="lv_x" type="float" min="-100" max="100" _gui-text="Light x-Position">1</param>
+            <param name="lv_y" type="float" min="-100" max="100" _gui-text="Light y-Position">1</param>
+            <param name="lv_z" type="float" min="-100" max="100" _gui-text="Light z-Position">-2</param>
+            <param name="show" type="optiongroup" appearance="minimal" _gui-text="Show:">
+                <_option value="vtx">Vertices</_option>
+                <_option value="edg">Edges</_option>
+                <_option value="fce">Faces</_option></param>
+            <param name="back"  type="boolean" _gui-text="Draw Back-Facing Polygons">0</param>
+            <param name="z_sort" type="optiongroup" appearance="minimal" _gui-text="Z-Sort Faces By:">
+                <_option value="max">Maximum</_option>
+                <_option value="min">Minimum</_option>
+                <_option value="mean">Mean</_option></param>
+        </page>
+    </param>
+    <effect>
+        <object-type>all</object-type>
+                <effects-menu>
+                    <submenu _name="Render"/>
+                </effects-menu>
+    </effect>
+    <script>
+        <command reldir="extensions" interpreter="python">polyhedron_3d.py</command>
+    </script>
+</inkscape-extension>
index a893dedd6d7ff4d67c3a7cda149c67cc0cd0a650..c8ebad377fc8f3f0a611bc855bd093025ee74329 100644 (file)
@@ -1,49 +1,49 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">\r
-  <_name>Printing Marks</_name>\r
-  <id>org.inkscape.printing.marks</id>\r
-  <dependency type="executable" location="extensions">printing-marks.py</dependency>\r
-  <dependency type="executable" location="extensions">inkex.py</dependency>\r
-\r
-  <param name="tab" type="notebook">\r
-    <page name="tab" _gui-text="Marks">\r
-      <param name="crop_marks"          type="boolean"    _gui-text="Crop Marks">true</param>\r
-      <param name="bleed_marks"         type="boolean"    _gui-text="Bleed Marks">false</param>\r
-      <param name="registration_marks"  type="boolean"    _gui-text="Registration Marks">true</param>\r
-      <param name="star_target"         type="boolean"    _gui-text="Star Target">false</param>\r
-      <param name="colour_bars"         type="boolean"    _gui-text="Colour Bars">true</param>\r
-      <param name="page_info"           type="boolean"    _gui-text="Page Information">false</param>\r
-    </page>\r
-    <page name="tab" _gui-text="Positioning">\r
-      <param name="where" type="enum" _gui-text="Set crop marks to">\r
-        <_item value="selection">Selection</_item>\r
-        <_item value="canvas">Canvas</_item>\r
-      </param>\r
-      <param name="unit" type="enum" _gui-text="Unit">\r
-        <item>px</item>\r
-        <item>pt</item>\r
-        <item>in</item>\r
-        <item>cm</item>\r
-        <item>mm</item>\r
-      </param>\r
-      <param name="crop_offset"     type="float"  min="0.0"  max="9999.0"  _gui-text="Offset:">5</param>\r
-      <_param name="bleed_settings" type="description">Bleed Margin</_param>\r
-      <param name="bleed_top"       type="float"  min="0.0"  max="9999.0"  _gui-text="Top:">5</param>\r
-      <param name="bleed_bottom"    type="float"  min="0.0"  max="9999.0"  _gui-text="Bottom:">5</param>\r
-      <param name="bleed_left"      type="float"  min="0.0"  max="9999.0"  _gui-text="Left:">5</param>\r
-      <param name="bleed_right"     type="float"  min="0.0"  max="9999.0"  _gui-text="Right:">5</param>\r
-    </page>\r
-  </param>\r
-\r
-  <effect>\r
-    <object-type>all</object-type>\r
-    <effects-menu>\r
-      <submenu _name="Render"/>\r
-    </effects-menu>\r
-  </effect>\r
-\r
-  <script>\r
-    <command reldir="extensions" interpreter="python">printing-marks.py</command>\r
-  </script>\r
-\r
-</inkscape-extension>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+  <_name>Printing Marks</_name>
+  <id>org.inkscape.printing.marks</id>
+  <dependency type="executable" location="extensions">printing-marks.py</dependency>
+  <dependency type="executable" location="extensions">inkex.py</dependency>
+
+  <param name="tab" type="notebook">
+    <page name="tab" _gui-text="Marks">
+      <param name="crop_marks"          type="boolean"    _gui-text="Crop Marks">true</param>
+      <param name="bleed_marks"         type="boolean"    _gui-text="Bleed Marks">false</param>
+      <param name="registration_marks"  type="boolean"    _gui-text="Registration Marks">true</param>
+      <param name="star_target"         type="boolean"    _gui-text="Star Target">false</param>
+      <param name="colour_bars"         type="boolean"    _gui-text="Colour Bars">true</param>
+      <param name="page_info"           type="boolean"    _gui-text="Page Information">false</param>
+    </page>
+    <page name="tab" _gui-text="Positioning">
+      <param name="where" type="enum" _gui-text="Set crop marks to">
+        <_item value="selection">Selection</_item>
+        <_item value="canvas">Canvas</_item>
+      </param>
+      <param name="unit" type="enum" _gui-text="Unit">
+        <item>px</item>
+        <item>pt</item>
+        <item>in</item>
+        <item>cm</item>
+        <item>mm</item>
+      </param>
+      <param name="crop_offset"     type="float"  min="0.0"  max="9999.0"  _gui-text="Offset:">5</param>
+      <_param name="bleed_settings" type="description">Bleed Margin</_param>
+      <param name="bleed_top"       type="float"  min="0.0"  max="9999.0"  _gui-text="Top:">5</param>
+      <param name="bleed_bottom"    type="float"  min="0.0"  max="9999.0"  _gui-text="Bottom:">5</param>
+      <param name="bleed_left"      type="float"  min="0.0"  max="9999.0"  _gui-text="Left:">5</param>
+      <param name="bleed_right"     type="float"  min="0.0"  max="9999.0"  _gui-text="Right:">5</param>
+    </page>
+  </param>
+
+  <effect>
+    <object-type>all</object-type>
+    <effects-menu>
+      <submenu _name="Render"/>
+    </effects-menu>
+  </effect>
+
+  <script>
+    <command reldir="extensions" interpreter="python">printing-marks.py</command>
+  </script>
+
+</inkscape-extension>
index 710b71b1c7df5503ac0660d6166843dee81a7e95..6128d7027c9bd231dffaa5021f14866abeecc2a2 100644 (file)
-#!/usr/bin/env python\r
-'''\r
-This extension allows you to draw crop, registration and other\r
-printing marks in Inkscape.\r
-\r
-Authors:\r
-  Nicolas Dufour - Association Inkscape-fr\r
-  Aurelio A. Heckert <aurium(a)gmail.com>\r
-\r
-Copyright (C) 2008 Authors\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
-\r
-import inkex, simplestyle, math\r
-\r
-class Printing_Marks (inkex.Effect):\r
-\r
-    # Default parameters\r
-    stroke_width = 0.25\r
-    mark_size = inkex.unittouu('1cm')\r
-    min_mark_margin = inkex.unittouu('3mm')\r
-\r
-    def __init__(self):\r
-        inkex.Effect.__init__(self)\r
-        self.OptionParser.add_option("--tab",\r
-                                     action="store", type="string",\r
-                                     dest="tab")\r
-        self.OptionParser.add_option("--where",\r
-                                     action="store", type="string",\r
-                                     dest="where_to_crop", default=True,\r
-                                     help="Apply crop marks to...")\r
-        self.OptionParser.add_option("--crop_marks",\r
-                                     action="store", type="inkbool",\r
-                                     dest="crop_marks", default=True,\r
-                                     help="Draw crop Marks?")\r
-        self.OptionParser.add_option("--bleed_marks",\r
-                                     action="store", type="inkbool",\r
-                                     dest="bleed_marks", default=False,\r
-                                     help="Draw Bleed Marks?")\r
-        self.OptionParser.add_option("--registration_marks",\r
-                                     action="store", type="inkbool",\r
-                                     dest="reg_marks", default=False,\r
-                                     help="Draw Registration Marks?")\r
-        self.OptionParser.add_option("--star_target",\r
-                                     action="store", type="inkbool",\r
-                                     dest="star_target", default=False,\r
-                                     help="Draw Star Target?")\r
-        self.OptionParser.add_option("--colour_bars",\r
-                                     action="store", type="inkbool",\r
-                                     dest="colour_bars", default=False,\r
-                                     help="Draw Colour Bars?")\r
-        self.OptionParser.add_option("--page_info",\r
-                                     action="store", type="inkbool",\r
-                                     dest="page_info", default=False,\r
-                                     help="Draw Page Information?")\r
-        self.OptionParser.add_option("--unit",\r
-                                     action="store", type="string",\r
-                                     dest="unit", default=100.0,\r
-                                     help="Draw measurment")\r
-        self.OptionParser.add_option("--crop_offset",\r
-                                     action="store", type="float",\r
-                                     dest="crop_offset", default=0,\r
-                                     help="Offset")\r
-        self.OptionParser.add_option("--bleed_top",\r
-                                     action="store", type="float",\r
-                                     dest="bleed_top", default=0,\r
-                                     help="Bleed Top Size")\r
-        self.OptionParser.add_option("--bleed_bottom",\r
-                                     action="store", type="float",\r
-                                     dest="bleed_bottom", default=0,\r
-                                     help="Bleed Bottom Size")\r
-        self.OptionParser.add_option("--bleed_left",\r
-                                     action="store", type="float",\r
-                                     dest="bleed_left", default=0,\r
-                                     help="Bleed Left Size")\r
-        self.OptionParser.add_option("--bleed_right",\r
-                                     action="store", type="float",\r
-                                     dest="bleed_right", default=0,\r
-                                     help="Bleed Right Size")\r
-\r
-\r
-    def draw_crop_line(self, x1, y1, x2, y2, name, parent):\r
-        style = { 'stroke': '#000000', 'stroke-width': str(self.stroke_width),\r
-                  'fill': 'none'}\r
-        line_attribs = {'style': simplestyle.formatStyle(style),\r
-                        'id': name,\r
-                        'd': 'M '+str(x1)+','+str(y1)+' L '+str(x2)+','+str(y2)}\r
-        inkex.etree.SubElement(parent, 'path', line_attribs)\r
-\r
-    def draw_bleed_line(self, x1, y1, x2, y2, name, parent):\r
-        style = { 'stroke': '#000000', 'stroke-width': str(self.stroke_width),\r
-                  'fill': 'none',\r
-                  'stroke-miterlimit': '4', 'stroke-dasharray': '4, 2, 1, 2',\r
-                  'stroke-dashoffset': '0' }\r
-        line_attribs = {'style': simplestyle.formatStyle(style),\r
-                        'id': name,\r
-                        'd': 'M '+str(x1)+','+str(y1)+' L '+str(x2)+','+str(y2)}\r
-        inkex.etree.SubElement(parent, 'path', line_attribs)\r
-\r
-    def draw_reg_circles(self, cx, cy, r, name, colours, parent):\r
-        for i in range(len(colours)):\r
-            style = {'stroke':colours[i], 'stroke-width':str(r / len(colours)),\r
-                     'fill':'none'}\r
-            circle_attribs = {'style':simplestyle.formatStyle(style),\r
-                              inkex.addNS('label','inkscape'):name,\r
-                              'cx':str(cx), 'cy':str(cy),\r
-                              'r':str((r / len(colours)) * (i + 0.5))}\r
-            inkex.etree.SubElement(parent, inkex.addNS('circle','svg'),\r
-                                   circle_attribs)\r
-\r
-    def draw_reg_marks(self, cx, cy, rotate, name, parent):\r
-        colours = ['#000000','#00ffff','#ff00ff','#ffff00','#000000']\r
-        g = inkex.etree.SubElement(parent, 'g', { 'id': name })\r
-        for i in range(len(colours)):\r
-            style = {'fill':colours[i], 'fill-opacity':'1', 'stroke':'none'}\r
-            r = (self.mark_size/2)\r
-            step = r\r
-            stroke = r / len(colours)\r
-            regoffset = stroke * i\r
-            regmark_attribs = {'style': simplestyle.formatStyle(style),\r
-                               'd': 'm' +\\r
-                               ' '+str(-regoffset)+','+str(r)  +\\r
-                               ' '+str(-stroke)   +',0'        +\\r
-                               ' '+str(step)      +','+str(-r) +\\r
-                               ' '+str(-step)     +','+str(-r) +\\r
-                               ' '+str(stroke)    +',0'        +\\r
-                               ' '+str(step)      +','+str(r)  +\\r
-                               ' '+str(-step)     +','+str(r)  +\\r
-                               ' z',\r
-                               'transform': 'translate('+str(cx)+','+str(cy)+ \\r
-                                            ') rotate('+str(rotate)+')'}\r
-            inkex.etree.SubElement(g, 'path', regmark_attribs)\r
-\r
-    def draw_star_target(self, cx, cy, name, parent):\r
-        r = (self.mark_size/2)\r
-        style = {'fill':'#000', 'fill-opacity':'1', 'stroke':'none'}\r
-        d = ' M 0,0'\r
-        i = 0\r
-        while i < ( 2 * math.pi ):\r
-            i += math.pi / 16\r
-            d += ' L 0,0 ' +\\r
-                 ' L '+ str(math.sin(i)*r) +','+ str(math.cos(i)*r) +\\r
-                 ' L '+ str(math.sin(i+0.09)*r) +','+ str(math.cos(i+0.09)*r)\r
-        regmark_attribs = {'style':simplestyle.formatStyle(style),\r
-                          inkex.addNS('label','inkscape'):name,\r
-                          'transform':'translate('+str(cx)+','+str(cy)+')',\r
-                          'd':d}\r
-        inkex.etree.SubElement(parent, inkex.addNS('path','svg'),\r
-                               regmark_attribs)\r
-\r
-    def draw_coluor_bars(self, cx, cy, rotate, name, parent):\r
-        g = inkex.etree.SubElement(parent, 'g', {\r
-                'id':name,\r
-                'transform':'translate('+str(cx)+','+str(cy)+\\r
-                            ') rotate('+str(rotate)+')' })\r
-        l = min( self.mark_size / 3, max(self.width,self.height) / 45 )\r
-        for bar in [{'c':'*', 'stroke':'#000', 'x':0,        'y':-(l+1)},\r
-                    {'c':'r', 'stroke':'#0FF', 'x':0,        'y':0},\r
-                    {'c':'g', 'stroke':'#F0F', 'x':(l*11)+1, 'y':-(l+1)},\r
-                    {'c':'b', 'stroke':'#FF0', 'x':(l*11)+1, 'y':0}\r
-                   ]:\r
-            i = 0\r
-            while i <= 1:\r
-                cr = '255'\r
-                cg = '255'\r
-                cb = '255'\r
-                if bar['c'] == 'r' or bar['c'] == '*' : cr = str(255*i)\r
-                if bar['c'] == 'g' or bar['c'] == '*' : cg = str(255*i)\r
-                if bar['c'] == 'b' or bar['c'] == '*' : cb = str(255*i)\r
-                r_att = {'fill':'rgb('+cr+','+cg+','+cb+')',\r
-                         'stroke':bar['stroke'],\r
-                         'stroke-width':'0.5',\r
-                         'x':str((l*i*10)+bar['x']), 'y':str(bar['y']),\r
-                         'width':str(l), 'height':str(l)}\r
-                r = inkex.etree.SubElement(g, 'rect', r_att)\r
-                i += 0.1\r
-\r
-    def effect(self):\r
-\r
-        if self.options.where_to_crop == 'selection' :\r
-            inkex.errormsg('Sory, the crop to selection is a TODO feature')\r
-\r
-        # Get SVG document dimensions\r
-        svg = self.document.getroot()\r
-        self.width  = width  = inkex.unittouu(svg.get('width'))\r
-        self.height = height = inkex.unittouu(svg.attrib['height'])\r
-\r
-        # Convert parameters to user unit\r
-        offset = inkex.unittouu(str(self.options.crop_offset) + \\r
-                                self.options.unit)\r
-        bt = inkex.unittouu(str(self.options.bleed_top)    + self.options.unit)\r
-        bb = inkex.unittouu(str(self.options.bleed_bottom) + self.options.unit)\r
-        bl = inkex.unittouu(str(self.options.bleed_left)   + self.options.unit)\r
-        br = inkex.unittouu(str(self.options.bleed_right)  + self.options.unit)\r
-        # Bleed margin\r
-        if bt < offset : bmt = 0\r
-        else :           bmt = bt - offset\r
-        if bb < offset : bmb = 0\r
-        else :           bmb = bb - offset\r
-        if bl < offset : bml = 0\r
-        else :           bml = bl - offset\r
-        if br < offset : bmr = 0\r
-        else :           bmr = br - offset\r
-\r
-        # Define the new document limits\r
-        left   = - offset\r
-        right  = width + offset\r
-        top    = - offset\r
-        bottom = height + offset\r
-\r
-        # Test if printing-marks layer existis\r
-        layer = self.document.xpath(\r
-                     '//*[@id="printing-marks" and @inkscape:groupmode="layer"]',\r
-                     namespaces=inkex.NSS)\r
-        if layer: svg.remove(layer[0]) # remove if it existis\r
-        # Create a new layer\r
-        layer = inkex.etree.SubElement(svg, 'g')\r
-        layer.set('id', 'printing-marks')\r
-        layer.set(inkex.addNS('label', 'inkscape'), 'Printing Marks')\r
-        layer.set(inkex.addNS('groupmode', 'inkscape'), 'layer')\r
-        layer.set(inkex.addNS('insensitive', 'sodipodi'), 'true')\r
-\r
-        # Crop Mark\r
-        if self.options.crop_marks == True:\r
-            # Create a group for Crop Mark\r
-            g_attribs = {inkex.addNS('label','inkscape'):'CropMarks',\r
-                                                    'id':'CropMarks'}\r
-            g_crops = inkex.etree.SubElement(layer, 'g', g_attribs)\r
-\r
-            # Top left Mark\r
-            self.draw_crop_line(0, top,\r
-                                0, top - self.mark_size,\r
-                                'cropTL1', g_crops)\r
-            self.draw_crop_line(left, 0,\r
-                                left - self.mark_size, 0,\r
-                                'cropTL2', g_crops)\r
-\r
-            # Top right Mark\r
-            self.draw_crop_line(width, top,\r
-                                width , top - self.mark_size,\r
-                                'cropTR1', g_crops)\r
-            self.draw_crop_line(right, 0,\r
-                                right + self.mark_size, 0,\r
-                                'cropTR2', g_crops)\r
-\r
-            # Bottom left Mark\r
-            self.draw_crop_line(0, bottom,\r
-                                0, bottom + self.mark_size,\r
-                                'cropBL1', g_crops)\r
-            self.draw_crop_line(left, height,\r
-                                left - self.mark_size, height,\r
-                                'cropBL2', g_crops)\r
-\r
-            # Bottom right Mark\r
-            self.draw_crop_line(width, bottom,\r
-                                width, bottom + self.mark_size,\r
-                                'cropBR1', g_crops)\r
-            self.draw_crop_line(right, height,\r
-                                right + self.mark_size, height,\r
-                                'cropBR2', g_crops)\r
-\r
-        # Bleed Mark\r
-        if self.options.bleed_marks == True:\r
-            # Create a group for Bleed Mark\r
-            g_attribs = {inkex.addNS('label','inkscape'):'BleedMarks',\r
-                                                    'id':'BleedMarks'}\r
-            g_bleed = inkex.etree.SubElement(layer, 'g', g_attribs)\r
-\r
-            # Top left Mark\r
-            self.draw_bleed_line(-bl, top - bmt,\r
-                                 -bl, top - bmt - self.mark_size,\r
-                                 'bleedTL1', g_bleed)\r
-            self.draw_bleed_line(left - bml, -bt,\r
-                                 left - bml - self.mark_size, -bt,\r
-                                 'bleedTL2', g_bleed)\r
-\r
-            # Top right Mark\r
-            self.draw_bleed_line(width + br, top - bmt,\r
-                                 width + br, top - bmt - self.mark_size,\r
-                                 'bleedTR1', g_bleed)\r
-            self.draw_bleed_line(right + bmr, -bt,\r
-                                 right + bmr + self.mark_size, -bt,\r
-                                 'bleedTR2', g_bleed)\r
-\r
-            # Bottom left Mark\r
-            self.draw_bleed_line(-bl, bottom + bmb,\r
-                                 -bl, bottom + bmb + self.mark_size,\r
-                                 'bleedBL1', g_bleed)\r
-            self.draw_bleed_line(left - bml, height + bb,\r
-                                 left - bml - self.mark_size, height + bb,\r
-                                 'bleedBL2', g_bleed)   \r
-\r
-            # Bottom right Mark\r
-            self.draw_bleed_line(width + br, bottom + bmb,\r
-                                 width + br, bottom + bmb + self.mark_size,\r
-                                 'bleedBR1', g_bleed)\r
-            self.draw_bleed_line(right + bmr, height + bb,\r
-                                 right + bmr + self.mark_size, height + bb,\r
-                                 'bleedBR2', g_bleed)\r
-\r
-        # Registration Mark\r
-        if self.options.reg_marks == True:\r
-            # Create a group for Registration Mark\r
-            g_attribs = {inkex.addNS('label','inkscape'):'RegistrationMarks',\r
-                                                    'id':'RegistrationMarks'}\r
-            g_center = inkex.etree.SubElement(layer, 'g', g_attribs)\r
-\r
-            # Left Mark\r
-            cx = max( bml + offset, self.min_mark_margin )\r
-            self.draw_reg_marks(-cx - (self.mark_size/2),\r
-                                (height/2) - self.mark_size*1.5,\r
-                                '0', 'regMarkL', g_center)\r
-\r
-            # Right Mark\r
-            cx = max( bmr + offset, self.min_mark_margin )\r
-            self.draw_reg_marks(width + cx + (self.mark_size/2),\r
-                                (height/2) - self.mark_size*1.5,\r
-                                '180', 'regMarkR', g_center)\r
-\r
-            # Top Mark\r
-            cy = max( bmt + offset, self.min_mark_margin )\r
-            self.draw_reg_marks((width/2),\r
-                                -cy - (self.mark_size/2),\r
-                                '90', 'regMarkT', g_center)\r
-\r
-            # Bottom Mark\r
-            cy = max( bmb + offset, self.min_mark_margin )\r
-            self.draw_reg_marks((width/2),\r
-                                height + cy + (self.mark_size/2),\r
-                                '-90', 'regMarkB', g_center)\r
-\r
-        # Star Target\r
-        if self.options.star_target == True:\r
-            # Create a group for Star Target\r
-            g_attribs = {inkex.addNS('label','inkscape'):'StarTarget',\r
-                                                    'id':'StarTarget'}\r
-            g_center = inkex.etree.SubElement(layer, 'g', g_attribs)\r
-\r
-            if height < width :\r
-                # Left Star\r
-                cx = max( bml + offset, self.min_mark_margin )\r
-                self.draw_star_target(-cx - (self.mark_size/2),\r
-                                      (height/2),\r
-                                      'starTargetL', g_center)\r
-                # Right Star\r
-                cx = max( bmr + offset, self.min_mark_margin )\r
-                self.draw_star_target(width + cx + (self.mark_size/2),\r
-                                      (height/2),\r
-                                      'starTargetR', g_center)\r
-            else :\r
-                # Top Star\r
-                cy = max( bmt + offset, self.min_mark_margin )\r
-                self.draw_star_target((width/2) - self.mark_size*1.5,\r
-                                      -cy - (self.mark_size/2),\r
-                                      'starTargetT', g_center)\r
-                # Bottom Star\r
-                cy = max( bmb + offset, self.min_mark_margin )\r
-                self.draw_star_target((width/2) - self.mark_size*1.5,\r
-                                      height + cy + (self.mark_size/2),\r
-                                      'starTargetB', g_center)\r
-\r
-\r
-        # Colour Bars\r
-        if self.options.colour_bars == True:\r
-            # Create a group for Colour Bars\r
-            g_attribs = {inkex.addNS('label','inkscape'):'ColourBars',\r
-                                                    'id':'PrintingColourBars'}\r
-            g_center = inkex.etree.SubElement(layer, 'g', g_attribs)\r
-\r
-            if height > width :\r
-                # Left Bars\r
-                cx = max( bml + offset, self.min_mark_margin )\r
-                self.draw_coluor_bars(-cx - (self.mark_size/2),\r
-                                      height/2,\r
-                                      90,\r
-                                      'PrintingColourBarsL', g_center)\r
-                # Right Bars\r
-                cx = max( bmr + offset, self.min_mark_margin )\r
-                self.draw_coluor_bars(width + cx + (self.mark_size/2),\r
-                                      height/2,\r
-                                      90,\r
-                                      'PrintingColourBarsR', g_center)\r
-            else :\r
-                # Top Bars\r
-                cy = max( bmt + offset, self.min_mark_margin )\r
-                self.draw_coluor_bars(width/2,\r
-                                      -cy - (self.mark_size/2),\r
-                                      0,\r
-                                      'PrintingColourBarsT', g_center)\r
-                # Bottom Bars\r
-                cy = max( bmb + offset, self.min_mark_margin )\r
-                self.draw_coluor_bars(width/2,\r
-                                      height + cy + (self.mark_size/2),\r
-                                      0,\r
-                                      'PrintingColourBarsB', g_center)\r
-\r
-\r
-        # Page Information\r
-        if self.options.page_info == True:\r
-            # Create a group for Page Information\r
-            g_attribs = {inkex.addNS('label','inkscape'):'PageInformation',\r
-                                                    'id':'PageInformation'}\r
-            g_pag_info = inkex.etree.SubElement(layer, 'g', g_attribs)\r
-            y_margin = max( bmb + offset, self.min_mark_margin )\r
-            txt_attribs = {'style':'font-size:12px;font-style:normal;font-weight:normal;fill:#000000;font-family:Bitstream Vera Sans,sans-serif;text-anchor:middle;text-align:center',\r
-                           'x':str(width/2), 'y':str(height+y_margin+self.mark_size+20)}\r
-            txt = inkex.etree.SubElement(g_pag_info, 'text', txt_attribs)\r
-            txt.text = 'Page size: ' +\\r
-                       str(round(inkex.uutounit(width,self.options.unit),2)) +\\r
-                       'x' +\\r
-                       str(round(inkex.uutounit(height,self.options.unit),2)) +\\r
-                       ' ' + self.options.unit\r
-\r
-\r
-if __name__ == '__main__':\r
-    e = Printing_Marks()\r
-    e.affect()\r
+#!/usr/bin/env python
+'''
+This extension allows you to draw crop, registration and other
+printing marks in Inkscape.
+
+Authors:
+  Nicolas Dufour - Association Inkscape-fr
+  Aurelio A. Heckert <aurium(a)gmail.com>
+
+Copyright (C) 2008 Authors
+
+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
+'''
+
+import inkex, simplestyle, math
+
+class Printing_Marks (inkex.Effect):
+
+    # Default parameters
+    stroke_width = 0.25
+    mark_size = inkex.unittouu('1cm')
+    min_mark_margin = inkex.unittouu('3mm')
+
+    def __init__(self):
+        inkex.Effect.__init__(self)
+        self.OptionParser.add_option("--tab",
+                                     action="store", type="string",
+                                     dest="tab")
+        self.OptionParser.add_option("--where",
+                                     action="store", type="string",
+                                     dest="where_to_crop", default=True,
+                                     help="Apply crop marks to...")
+        self.OptionParser.add_option("--crop_marks",
+                                     action="store", type="inkbool",
+                                     dest="crop_marks", default=True,
+                                     help="Draw crop Marks?")
+        self.OptionParser.add_option("--bleed_marks",
+                                     action="store", type="inkbool",
+                                     dest="bleed_marks", default=False,
+                                     help="Draw Bleed Marks?")
+        self.OptionParser.add_option("--registration_marks",
+                                     action="store", type="inkbool",
+                                     dest="reg_marks", default=False,
+                                     help="Draw Registration Marks?")
+        self.OptionParser.add_option("--star_target",
+                                     action="store", type="inkbool",
+                                     dest="star_target", default=False,
+                                     help="Draw Star Target?")
+        self.OptionParser.add_option("--colour_bars",
+                                     action="store", type="inkbool",
+                                     dest="colour_bars", default=False,
+                                     help="Draw Colour Bars?")
+        self.OptionParser.add_option("--page_info",
+                                     action="store", type="inkbool",
+                                     dest="page_info", default=False,
+                                     help="Draw Page Information?")
+        self.OptionParser.add_option("--unit",
+                                     action="store", type="string",
+                                     dest="unit", default=100.0,
+                                     help="Draw measurment")
+        self.OptionParser.add_option("--crop_offset",
+                                     action="store", type="float",
+                                     dest="crop_offset", default=0,
+                                     help="Offset")
+        self.OptionParser.add_option("--bleed_top",
+                                     action="store", type="float",
+                                     dest="bleed_top", default=0,
+                                     help="Bleed Top Size")
+        self.OptionParser.add_option("--bleed_bottom",
+                                     action="store", type="float",
+                                     dest="bleed_bottom", default=0,
+                                     help="Bleed Bottom Size")
+        self.OptionParser.add_option("--bleed_left",
+                                     action="store", type="float",
+                                     dest="bleed_left", default=0,
+                                     help="Bleed Left Size")
+        self.OptionParser.add_option("--bleed_right",
+                                     action="store", type="float",
+                                     dest="bleed_right", default=0,
+                                     help="Bleed Right Size")
+
+
+    def draw_crop_line(self, x1, y1, x2, y2, name, parent):
+        style = { 'stroke': '#000000', 'stroke-width': str(self.stroke_width),
+                  'fill': 'none'}
+        line_attribs = {'style': simplestyle.formatStyle(style),
+                        'id': name,
+                        'd': 'M '+str(x1)+','+str(y1)+' L '+str(x2)+','+str(y2)}
+        inkex.etree.SubElement(parent, 'path', line_attribs)
+
+    def draw_bleed_line(self, x1, y1, x2, y2, name, parent):
+        style = { 'stroke': '#000000', 'stroke-width': str(self.stroke_width),
+                  'fill': 'none',
+                  'stroke-miterlimit': '4', 'stroke-dasharray': '4, 2, 1, 2',
+                  'stroke-dashoffset': '0' }
+        line_attribs = {'style': simplestyle.formatStyle(style),
+                        'id': name,
+                        'd': 'M '+str(x1)+','+str(y1)+' L '+str(x2)+','+str(y2)}
+        inkex.etree.SubElement(parent, 'path', line_attribs)
+
+    def draw_reg_circles(self, cx, cy, r, name, colours, parent):
+        for i in range(len(colours)):
+            style = {'stroke':colours[i], 'stroke-width':str(r / len(colours)),
+                     'fill':'none'}
+            circle_attribs = {'style':simplestyle.formatStyle(style),
+                              inkex.addNS('label','inkscape'):name,
+                              'cx':str(cx), 'cy':str(cy),
+                              'r':str((r / len(colours)) * (i + 0.5))}
+            inkex.etree.SubElement(parent, inkex.addNS('circle','svg'),
+                                   circle_attribs)
+
+    def draw_reg_marks(self, cx, cy, rotate, name, parent):
+        colours = ['#000000','#00ffff','#ff00ff','#ffff00','#000000']
+        g = inkex.etree.SubElement(parent, 'g', { 'id': name })
+        for i in range(len(colours)):
+            style = {'fill':colours[i], 'fill-opacity':'1', 'stroke':'none'}
+            r = (self.mark_size/2)
+            step = r
+            stroke = r / len(colours)
+            regoffset = stroke * i
+            regmark_attribs = {'style': simplestyle.formatStyle(style),
+                               'd': 'm' +\
+                               ' '+str(-regoffset)+','+str(r)  +\
+                               ' '+str(-stroke)   +',0'        +\
+                               ' '+str(step)      +','+str(-r) +\
+                               ' '+str(-step)     +','+str(-r) +\
+                               ' '+str(stroke)    +',0'        +\
+                               ' '+str(step)      +','+str(r)  +\
+                               ' '+str(-step)     +','+str(r)  +\
+                               ' z',
+                               'transform': 'translate('+str(cx)+','+str(cy)+ \
+                                            ') rotate('+str(rotate)+')'}
+            inkex.etree.SubElement(g, 'path', regmark_attribs)
+
+    def draw_star_target(self, cx, cy, name, parent):
+        r = (self.mark_size/2)
+        style = {'fill':'#000', 'fill-opacity':'1', 'stroke':'none'}
+        d = ' M 0,0'
+        i = 0
+        while i < ( 2 * math.pi ):
+            i += math.pi / 16
+            d += ' L 0,0 ' +\
+                 ' L '+ str(math.sin(i)*r) +','+ str(math.cos(i)*r) +\
+                 ' L '+ str(math.sin(i+0.09)*r) +','+ str(math.cos(i+0.09)*r)
+        regmark_attribs = {'style':simplestyle.formatStyle(style),
+                          inkex.addNS('label','inkscape'):name,
+                          'transform':'translate('+str(cx)+','+str(cy)+')',
+                          'd':d}
+        inkex.etree.SubElement(parent, inkex.addNS('path','svg'),
+                               regmark_attribs)
+
+    def draw_coluor_bars(self, cx, cy, rotate, name, parent):
+        g = inkex.etree.SubElement(parent, 'g', {
+                'id':name,
+                'transform':'translate('+str(cx)+','+str(cy)+\
+                            ') rotate('+str(rotate)+')' })
+        l = min( self.mark_size / 3, max(self.width,self.height) / 45 )
+        for bar in [{'c':'*', 'stroke':'#000', 'x':0,        'y':-(l+1)},
+                    {'c':'r', 'stroke':'#0FF', 'x':0,        'y':0},
+                    {'c':'g', 'stroke':'#F0F', 'x':(l*11)+1, 'y':-(l+1)},
+                    {'c':'b', 'stroke':'#FF0', 'x':(l*11)+1, 'y':0}
+                   ]:
+            i = 0
+            while i <= 1:
+                cr = '255'
+                cg = '255'
+                cb = '255'
+                if bar['c'] == 'r' or bar['c'] == '*' : cr = str(255*i)
+                if bar['c'] == 'g' or bar['c'] == '*' : cg = str(255*i)
+                if bar['c'] == 'b' or bar['c'] == '*' : cb = str(255*i)
+                r_att = {'fill':'rgb('+cr+','+cg+','+cb+')',
+                         'stroke':bar['stroke'],
+                         'stroke-width':'0.5',
+                         'x':str((l*i*10)+bar['x']), 'y':str(bar['y']),
+                         'width':str(l), 'height':str(l)}
+                r = inkex.etree.SubElement(g, 'rect', r_att)
+                i += 0.1
+
+    def effect(self):
+
+        if self.options.where_to_crop == 'selection' :
+            inkex.errormsg('Sory, the crop to selection is a TODO feature')
+
+        # Get SVG document dimensions
+        svg = self.document.getroot()
+        self.width  = width  = inkex.unittouu(svg.get('width'))
+        self.height = height = inkex.unittouu(svg.attrib['height'])
+
+        # Convert parameters to user unit
+        offset = inkex.unittouu(str(self.options.crop_offset) + \
+                                self.options.unit)
+        bt = inkex.unittouu(str(self.options.bleed_top)    + self.options.unit)
+        bb = inkex.unittouu(str(self.options.bleed_bottom) + self.options.unit)
+        bl = inkex.unittouu(str(self.options.bleed_left)   + self.options.unit)
+        br = inkex.unittouu(str(self.options.bleed_right)  + self.options.unit)
+        # Bleed margin
+        if bt < offset : bmt = 0
+        else :           bmt = bt - offset
+        if bb < offset : bmb = 0
+        else :           bmb = bb - offset
+        if bl < offset : bml = 0
+        else :           bml = bl - offset
+        if br < offset : bmr = 0
+        else :           bmr = br - offset
+
+        # Define the new document limits
+        left   = - offset
+        right  = width + offset
+        top    = - offset
+        bottom = height + offset
+
+        # Test if printing-marks layer existis
+        layer = self.document.xpath(
+                     '//*[@id="printing-marks" and @inkscape:groupmode="layer"]',
+                     namespaces=inkex.NSS)
+        if layer: svg.remove(layer[0]) # remove if it existis
+        # Create a new layer
+        layer = inkex.etree.SubElement(svg, 'g')
+        layer.set('id', 'printing-marks')
+        layer.set(inkex.addNS('label', 'inkscape'), 'Printing Marks')
+        layer.set(inkex.addNS('groupmode', 'inkscape'), 'layer')
+        layer.set(inkex.addNS('insensitive', 'sodipodi'), 'true')
+
+        # Crop Mark
+        if self.options.crop_marks == True:
+            # Create a group for Crop Mark
+            g_attribs = {inkex.addNS('label','inkscape'):'CropMarks',
+                                                    'id':'CropMarks'}
+            g_crops = inkex.etree.SubElement(layer, 'g', g_attribs)
+
+            # Top left Mark
+            self.draw_crop_line(0, top,
+                                0, top - self.mark_size,
+                                'cropTL1', g_crops)
+            self.draw_crop_line(left, 0,
+                                left - self.mark_size, 0,
+                                'cropTL2', g_crops)
+
+            # Top right Mark
+            self.draw_crop_line(width, top,
+                                width , top - self.mark_size,
+                                'cropTR1', g_crops)
+            self.draw_crop_line(right, 0,
+                                right + self.mark_size, 0,
+                                'cropTR2', g_crops)
+
+            # Bottom left Mark
+            self.draw_crop_line(0, bottom,
+                                0, bottom + self.mark_size,
+                                'cropBL1', g_crops)
+            self.draw_crop_line(left, height,
+                                left - self.mark_size, height,
+                                'cropBL2', g_crops)
+
+            # Bottom right Mark
+            self.draw_crop_line(width, bottom,
+                                width, bottom + self.mark_size,
+                                'cropBR1', g_crops)
+            self.draw_crop_line(right, height,
+                                right + self.mark_size, height,
+                                'cropBR2', g_crops)
+
+        # Bleed Mark
+        if self.options.bleed_marks == True:
+            # Create a group for Bleed Mark
+            g_attribs = {inkex.addNS('label','inkscape'):'BleedMarks',
+                                                    'id':'BleedMarks'}
+            g_bleed = inkex.etree.SubElement(layer, 'g', g_attribs)
+
+            # Top left Mark
+            self.draw_bleed_line(-bl, top - bmt,
+                                 -bl, top - bmt - self.mark_size,
+                                 'bleedTL1', g_bleed)
+            self.draw_bleed_line(left - bml, -bt,
+                                 left - bml - self.mark_size, -bt,
+                                 'bleedTL2', g_bleed)
+
+            # Top right Mark
+            self.draw_bleed_line(width + br, top - bmt,
+                                 width + br, top - bmt - self.mark_size,
+                                 'bleedTR1', g_bleed)
+            self.draw_bleed_line(right + bmr, -bt,
+                                 right + bmr + self.mark_size, -bt,
+                                 'bleedTR2', g_bleed)
+
+            # Bottom left Mark
+            self.draw_bleed_line(-bl, bottom + bmb,
+                                 -bl, bottom + bmb + self.mark_size,
+                                 'bleedBL1', g_bleed)
+            self.draw_bleed_line(left - bml, height + bb,
+                                 left - bml - self.mark_size, height + bb,
+                                 'bleedBL2', g_bleed)   
+
+            # Bottom right Mark
+            self.draw_bleed_line(width + br, bottom + bmb,
+                                 width + br, bottom + bmb + self.mark_size,
+                                 'bleedBR1', g_bleed)
+            self.draw_bleed_line(right + bmr, height + bb,
+                                 right + bmr + self.mark_size, height + bb,
+                                 'bleedBR2', g_bleed)
+
+        # Registration Mark
+        if self.options.reg_marks == True:
+            # Create a group for Registration Mark
+            g_attribs = {inkex.addNS('label','inkscape'):'RegistrationMarks',
+                                                    'id':'RegistrationMarks'}
+            g_center = inkex.etree.SubElement(layer, 'g', g_attribs)
+
+            # Left Mark
+            cx = max( bml + offset, self.min_mark_margin )
+            self.draw_reg_marks(-cx - (self.mark_size/2),
+                                (height/2) - self.mark_size*1.5,
+                                '0', 'regMarkL', g_center)
+
+            # Right Mark
+            cx = max( bmr + offset, self.min_mark_margin )
+            self.draw_reg_marks(width + cx + (self.mark_size/2),
+                                (height/2) - self.mark_size*1.5,
+                                '180', 'regMarkR', g_center)
+
+            # Top Mark
+            cy = max( bmt + offset, self.min_mark_margin )
+            self.draw_reg_marks((width/2),
+                                -cy - (self.mark_size/2),
+                                '90', 'regMarkT', g_center)
+
+            # Bottom Mark
+            cy = max( bmb + offset, self.min_mark_margin )
+            self.draw_reg_marks((width/2),
+                                height + cy + (self.mark_size/2),
+                                '-90', 'regMarkB', g_center)
+
+        # Star Target
+        if self.options.star_target == True:
+            # Create a group for Star Target
+            g_attribs = {inkex.addNS('label','inkscape'):'StarTarget',
+                                                    'id':'StarTarget'}
+            g_center = inkex.etree.SubElement(layer, 'g', g_attribs)
+
+            if height < width :
+                # Left Star
+                cx = max( bml + offset, self.min_mark_margin )
+                self.draw_star_target(-cx - (self.mark_size/2),
+                                      (height/2),
+                                      'starTargetL', g_center)
+                # Right Star
+                cx = max( bmr + offset, self.min_mark_margin )
+                self.draw_star_target(width + cx + (self.mark_size/2),
+                                      (height/2),
+                                      'starTargetR', g_center)
+            else :
+                # Top Star
+                cy = max( bmt + offset, self.min_mark_margin )
+                self.draw_star_target((width/2) - self.mark_size*1.5,
+                                      -cy - (self.mark_size/2),
+                                      'starTargetT', g_center)
+                # Bottom Star
+                cy = max( bmb + offset, self.min_mark_margin )
+                self.draw_star_target((width/2) - self.mark_size*1.5,
+                                      height + cy + (self.mark_size/2),
+                                      'starTargetB', g_center)
+
+
+        # Colour Bars
+        if self.options.colour_bars == True:
+            # Create a group for Colour Bars
+            g_attribs = {inkex.addNS('label','inkscape'):'ColourBars',
+                                                    'id':'PrintingColourBars'}
+            g_center = inkex.etree.SubElement(layer, 'g', g_attribs)
+
+            if height > width :
+                # Left Bars
+                cx = max( bml + offset, self.min_mark_margin )
+                self.draw_coluor_bars(-cx - (self.mark_size/2),
+                                      height/2,
+                                      90,
+                                      'PrintingColourBarsL', g_center)
+                # Right Bars
+                cx = max( bmr + offset, self.min_mark_margin )
+                self.draw_coluor_bars(width + cx + (self.mark_size/2),
+                                      height/2,
+                                      90,
+                                      'PrintingColourBarsR', g_center)
+            else :
+                # Top Bars
+                cy = max( bmt + offset, self.min_mark_margin )
+                self.draw_coluor_bars(width/2,
+                                      -cy - (self.mark_size/2),
+                                      0,
+                                      'PrintingColourBarsT', g_center)
+                # Bottom Bars
+                cy = max( bmb + offset, self.min_mark_margin )
+                self.draw_coluor_bars(width/2,
+                                      height + cy + (self.mark_size/2),
+                                      0,
+                                      'PrintingColourBarsB', g_center)
+
+
+        # Page Information
+        if self.options.page_info == True:
+            # Create a group for Page Information
+            g_attribs = {inkex.addNS('label','inkscape'):'PageInformation',
+                                                    'id':'PageInformation'}
+            g_pag_info = inkex.etree.SubElement(layer, 'g', g_attribs)
+            y_margin = max( bmb + offset, self.min_mark_margin )
+            txt_attribs = {'style':'font-size:12px;font-style:normal;font-weight:normal;fill:#000000;font-family:Bitstream Vera Sans,sans-serif;text-anchor:middle;text-align:center',
+                           'x':str(width/2), 'y':str(height+y_margin+self.mark_size+20)}
+            txt = inkex.etree.SubElement(g_pag_info, 'text', txt_attribs)
+            txt.text = 'Page size: ' +\
+                       str(round(inkex.uutounit(width,self.options.unit),2)) +\
+                       'x' +\
+                       str(round(inkex.uutounit(height,self.options.unit),2)) +\
+                       ' ' + self.options.unit
+
+
+if __name__ == '__main__':
+    e = Printing_Marks()
+    e.affect()
index 8d8f2d5670c8d3fcdf70f2c97844596253e3f901..e01666870c05ae368b452ff3e2184f2a0277c7e6 100644 (file)
-<?xml version="1.0" encoding="UTF-8"?>\r
-<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">\r
-  <_name>Calendar</_name>\r
-  <id>org.inkscape.render.calendar</id>\r
-\r
-  <dependency type="executable" location="extensions">svgcalendar.py</dependency>\r
-  <dependency type="executable" location="extensions">inkex.py</dependency>\r
-\r
-  <param name="tab" type="notebook">\r
-    <page name="tab" _gui-text="Configuration">\r
-      <param name="month" type="int" min="0" max="12" _gui-text="Month (0 for all)">0</param>\r
-      <param name="year" type="int" min="0" max="3000" _gui-text="Year (0 for current)">0</param>\r
-      <param name="fill-empty-day-boxes" type="boolean" _gui-text="Fill empty day boxes with next month's days">true</param>\r
-      <param name="start-day" type="enum" _gui-text="Week start day">\r
-        <_item value="sun">Sunday</_item>\r
-        <_item value="mon">Monday</_item>\r
-      </param>\r
-      <param name="weekend" type="enum" _gui-text="Weekend">\r
-        <_item value="sat+sun">Saturday and Sunday</_item>\r
-        <_item value="sat">Saturday</_item>\r
-        <_item value="sun">Sunday</_item>\r
-      </param>\r
-    </page>\r
-    <page name="tab" _gui-text="Organization">\r
-      <param name="auto-organize" type="boolean" _gui-text="Set authomaticaly the size and positions">true</param>\r
-      <_param name="organize-help" type="description">The options above has no value with the upper checked.</_param>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+  <_name>Calendar</_name>
+  <id>org.inkscape.render.calendar</id>
+
+  <dependency type="executable" location="extensions">svgcalendar.py</dependency>
+  <dependency type="executable" location="extensions">inkex.py</dependency>
+
+  <param name="tab" type="notebook">
+    <page name="tab" _gui-text="Configuration">
+      <param name="month" type="int" min="0" max="12" _gui-text="Month (0 for all)">0</param>
+      <param name="year" type="int" min="0" max="3000" _gui-text="Year (0 for current)">0</param>
+      <param name="fill-empty-day-boxes" type="boolean" _gui-text="Fill empty day boxes with next month's days">true</param>
+      <param name="start-day" type="enum" _gui-text="Week start day">
+        <_item value="sun">Sunday</_item>
+        <_item value="mon">Monday</_item>
+      </param>
+      <param name="weekend" type="enum" _gui-text="Weekend">
+        <_item value="sat+sun">Saturday and Sunday</_item>
+        <_item value="sat">Saturday</_item>
+        <_item value="sun">Sunday</_item>
+      </param>
+    </page>
+    <page name="tab" _gui-text="Organization">
+      <param name="auto-organize" type="boolean" _gui-text="Set authomaticaly the size and positions">true</param>
+      <_param name="organize-help" type="description">The options above has no value with the upper checked.</_param>
       <param name="months-per-line" type="int" min="1" max="12" _gui-text="Months per line">3</param>
       <param name="month-width" type="string" _gui-text="Month Width">6cm</param>
-      <param name="month-margin" type="string" _gui-text="Month Margin">1cm</param>\r
-    </page>\r
-    <page name="tab" _gui-text="Colors">\r
-      <param name="color-year"     type="string" _gui-text="Year color">#808080</param>\r
-      <param name="color-month"    type="string" _gui-text="Month color">#686868</param>\r
-      <param name="color-day-name" type="string" _gui-text="Weekday name color ">#909090</param>\r
-      <param name="color-day"      type="string" _gui-text="Day color">#000000</param>\r
-      <param name="color-weekend"  type="string" _gui-text="Weekend day color">#787878</param>\r
-      <param name="color-nmd"      type="string" _gui-text="Next month day color">#B0B0B0</param>\r
-    </page>\r
-    <page name="tab" _gui-text="Localization">\r
-      <_param name="l10n-help" type="description">You may change the names for other languages:</_param>\r
-      <_param name="month-names"  type="string" _gui-text="Month names">January February March April May June July August September October November December</_param>\r
-      <_param name="day-names"  type="string" _gui-text="Day names">Sun Mon Tue Wed Thu Fri Sat</_param>\r
-      <_param name="day-names-help" type="description">(The day names list must start from Sunday)</_param>\r
-      <param name="encoding" type="enum" _gui-text="Char Encoding">\r
-        <item>arabic</item>\r
-        <item>big5-tw</item>\r
-        <item>big5-hkscs</item>\r
-        <item>chinese</item>\r
-        <item>cp737</item>\r
-        <item>cp856</item>\r
-        <item>cp874</item>\r
-        <item>cp875</item>\r
-        <item>cp1006</item>\r
-        <item>cyrillic</item>\r
-        <item>cyrillic-asian</item>\r
-        <item>eucjis2004</item>\r
-        <item>eucjisx0213</item>\r
-        <item>gbk</item>\r
-        <item>gb18030-2000</item>\r
-        <item>greek</item>\r
-        <item>hebrew</item>\r
-        <item>hz-gb</item>\r
-        <item>IBM037</item>\r
-        <item>IBM424</item>\r
-        <item>IBM437</item>\r
-        <item>IBM500</item>\r
-        <item>IBM775</item>\r
-        <item>IBM850</item>\r
-        <item>IBM852</item>\r
-        <item>IBM855</item>\r
-        <item>IBM857</item>\r
-        <item>IBM860</item>\r
-        <item>IBM861</item>\r
-        <item>IBM862</item>\r
-        <item>IBM863</item>\r
-        <item>IBM864</item>\r
-        <item>IBM865</item>\r
-        <item>IBM866</item>\r
-        <item>IBM869</item>\r
-        <item>IBM1026</item>\r
-        <item>IBM1140</item>\r
-        <item>iso-2022-jp</item>\r
-        <item>iso-2022-jp-1</item>\r
-        <item>iso-2022-jp-2</item>\r
-        <item>iso-2022-jp-2004</item>\r
-        <item>iso-2022-jp-3</item>\r
-        <item>iso-2022-jp-ext</item>\r
-        <item>iso-2022-kr</item>\r
-        <item>johab</item>\r
-        <item>korean</item>\r
-        <item>koi8_r</item>\r
-        <item>koi8_u</item>\r
-        <item>latin1</item>\r
-        <item>latin2</item>\r
-        <item>latin3</item>\r
-        <item>latin4</item>\r
-        <item>latin5</item>\r
-        <item>latin6</item>\r
-        <item>latin8</item>\r
-        <item value="iso-8859-15">Latin - iso-8859-15 - Western Europe</item>\r
-        <item>macgreek</item>\r
-        <item>maciceland</item>\r
-        <item>maccentraleurope</item>\r
-        <item>macroman</item>\r
-        <item>macturkish</item>\r
-        <item>ms932</item>\r
-        <item>ms949</item>\r
-        <item>ms950</item>\r
-        <item>sjis</item>\r
-        <item>sjis2004</item>\r
-        <item>sjisx0213</item>\r
-        <item>u-jis</item>\r
-        <item>us-ascii</item>\r
-        <item value="windows-1250">Windows - Central and Eastern Europe</item>\r
-        <item value="windows-1251">Windows - Russian and more</item>\r
-        <item value="windows-1252">Windows - Western Europe</item>\r
-        <item value="windows-1253">Windows - Greek</item>\r
-        <item value="windows-1254">Windows - Turkish</item>\r
-        <item value="windows-1255">Windows - Hebrew</item>\r
-        <item value="windows-1256">Windows - Arabic</item>\r
-        <item value="windows-1257">Windows - Baltic languages</item>\r
-        <item value="windows-1258">Windows - Vietnamese</item>\r
-        <item value="utf_32">UTF-32 - All languages</item>\r
-        <item value="utf_16">UTF-16 - All languages</item>\r
-        <item value="utf_8">UTF-8 - All languages</item>\r
-      </param>\r
-      <_param name="encoding-help" type="description">(Select your system encoding. More information at http://docs.python.org/library/codecs.html#standard-encodings)</_param>\r
-    </page>\r
-  </param>\r
-  <effect>\r
-    <object-type>all</object-type>\r
-    <effects-menu>\r
-      <submenu _name="Render"/>\r
-    </effects-menu>\r
-  </effect>\r
-  <script>\r
-    <command reldir="extensions" interpreter="python">svgcalendar.py</command>\r
-  </script>\r
-</inkscape-extension>\r
+      <param name="month-margin" type="string" _gui-text="Month Margin">1cm</param>
+    </page>
+    <page name="tab" _gui-text="Colors">
+      <param name="color-year"     type="string" _gui-text="Year color">#808080</param>
+      <param name="color-month"    type="string" _gui-text="Month color">#686868</param>
+      <param name="color-day-name" type="string" _gui-text="Weekday name color ">#909090</param>
+      <param name="color-day"      type="string" _gui-text="Day color">#000000</param>
+      <param name="color-weekend"  type="string" _gui-text="Weekend day color">#787878</param>
+      <param name="color-nmd"      type="string" _gui-text="Next month day color">#B0B0B0</param>
+    </page>
+    <page name="tab" _gui-text="Localization">
+      <_param name="l10n-help" type="description">You may change the names for other languages:</_param>
+      <_param name="month-names"  type="string" _gui-text="Month names">January February March April May June July August September October November December</_param>
+      <_param name="day-names"  type="string" _gui-text="Day names">Sun Mon Tue Wed Thu Fri Sat</_param>
+      <_param name="day-names-help" type="description">(The day names list must start from Sunday)</_param>
+      <param name="encoding" type="enum" _gui-text="Char Encoding">
+        <item>arabic</item>
+        <item>big5-tw</item>
+        <item>big5-hkscs</item>
+        <item>chinese</item>
+        <item>cp737</item>
+        <item>cp856</item>
+        <item>cp874</item>
+        <item>cp875</item>
+        <item>cp1006</item>
+        <item>cyrillic</item>
+        <item>cyrillic-asian</item>
+        <item>eucjis2004</item>
+        <item>eucjisx0213</item>
+        <item>gbk</item>
+        <item>gb18030-2000</item>
+        <item>greek</item>
+        <item>hebrew</item>
+        <item>hz-gb</item>
+        <item>IBM037</item>
+        <item>IBM424</item>
+        <item>IBM437</item>
+        <item>IBM500</item>
+        <item>IBM775</item>
+        <item>IBM850</item>
+        <item>IBM852</item>
+        <item>IBM855</item>
+        <item>IBM857</item>
+        <item>IBM860</item>
+        <item>IBM861</item>
+        <item>IBM862</item>
+        <item>IBM863</item>
+        <item>IBM864</item>
+        <item>IBM865</item>
+        <item>IBM866</item>
+        <item>IBM869</item>
+        <item>IBM1026</item>
+        <item>IBM1140</item>
+        <item>iso-2022-jp</item>
+        <item>iso-2022-jp-1</item>
+        <item>iso-2022-jp-2</item>
+        <item>iso-2022-jp-2004</item>
+        <item>iso-2022-jp-3</item>
+        <item>iso-2022-jp-ext</item>
+        <item>iso-2022-kr</item>
+        <item>johab</item>
+        <item>korean</item>
+        <item>koi8_r</item>
+        <item>koi8_u</item>
+        <item>latin1</item>
+        <item>latin2</item>
+        <item>latin3</item>
+        <item>latin4</item>
+        <item>latin5</item>
+        <item>latin6</item>
+        <item>latin8</item>
+        <item value="iso-8859-15">Latin - iso-8859-15 - Western Europe</item>
+        <item>macgreek</item>
+        <item>maciceland</item>
+        <item>maccentraleurope</item>
+        <item>macroman</item>
+        <item>macturkish</item>
+        <item>ms932</item>
+        <item>ms949</item>
+        <item>ms950</item>
+        <item>sjis</item>
+        <item>sjis2004</item>
+        <item>sjisx0213</item>
+        <item>u-jis</item>
+        <item>us-ascii</item>
+        <item value="windows-1250">Windows - Central and Eastern Europe</item>
+        <item value="windows-1251">Windows - Russian and more</item>
+        <item value="windows-1252">Windows - Western Europe</item>
+        <item value="windows-1253">Windows - Greek</item>
+        <item value="windows-1254">Windows - Turkish</item>
+        <item value="windows-1255">Windows - Hebrew</item>
+        <item value="windows-1256">Windows - Arabic</item>
+        <item value="windows-1257">Windows - Baltic languages</item>
+        <item value="windows-1258">Windows - Vietnamese</item>
+        <item value="utf_32">UTF-32 - All languages</item>
+        <item value="utf_16">UTF-16 - All languages</item>
+        <item value="utf_8">UTF-8 - All languages</item>
+      </param>
+      <_param name="encoding-help" type="description">(Select your system encoding. More information at http://docs.python.org/library/codecs.html#standard-encodings)</_param>
+    </page>
+  </param>
+  <effect>
+    <object-type>all</object-type>
+    <effects-menu>
+      <submenu _name="Render"/>
+    </effects-menu>
+  </effect>
+  <script>
+    <command reldir="extensions" interpreter="python">svgcalendar.py</command>
+  </script>
+</inkscape-extension>
index 0cd12c8337a3c9444d2b251ae72142eed064bae1..3c79ca42ca03cf1ca373db620aea7c59df87d751 100644 (file)
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">\r
-    <_name>Triangle</_name>\r
-    <id>math.triangle</id>\r
-    <dependency type="executable" location="extensions">triangle.py</dependency>\r
-    <dependency type="executable" location="extensions">inkex.py</dependency>\r
-    <param name="s_a"       type="float"   min="0.01" max="10000" _gui-text="Side Length a / px">100.0</param>\r
-    <param name="s_b"       type="float"   min="0.01" max="10000" _gui-text="Side Length b / px">100.0</param>\r
-    <param name="s_c"       type="float"   min="0.01" max="10000" _gui-text="Side Length c / px">100.0</param>\r
-    <param name="a_a"       type="float"   min="0"    max="180"   _gui-text="Angle a / deg">60</param>\r
-    <param name="a_b"       type="float"   min="0"    max="180"   _gui-text="Angle b / deg">30</param>\r
-    <param name="a_c"       type="float"   min="0"    max="180"   _gui-text="Angle c / deg">90</param>\r
-    <param name="mode"      type="optiongroup"                    _gui-text="Mode"  appearance="minimal">\r
-        <_option value="3_sides">From Three Sides</_option>\r
-        <_option value="s_ab_a_c">From Sides a, b and Angle c</_option>\r
-        <_option value="s_ab_a_a">From Sides a, b and Angle a</_option>\r
-        <_option value="s_a_a_ab">From Side a and Angles a, b</_option>\r
-        <_option value="s_c_a_ab">From Side c and Angles a, b</_option></param>\r
-    <effect>\r
-        <object-type>all</object-type>\r
-                <effects-menu>\r
-                    <submenu _name="Render"/>\r
-                </effects-menu>\r
-    </effect>\r
-    <script>\r
-        <command reldir="extensions" interpreter="python">triangle.py</command>\r
-    </script>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+    <_name>Triangle</_name>
+    <id>math.triangle</id>
+    <dependency type="executable" location="extensions">triangle.py</dependency>
+    <dependency type="executable" location="extensions">inkex.py</dependency>
+    <param name="s_a"       type="float"   min="0.01" max="10000" _gui-text="Side Length a / px">100.0</param>
+    <param name="s_b"       type="float"   min="0.01" max="10000" _gui-text="Side Length b / px">100.0</param>
+    <param name="s_c"       type="float"   min="0.01" max="10000" _gui-text="Side Length c / px">100.0</param>
+    <param name="a_a"       type="float"   min="0"    max="180"   _gui-text="Angle a / deg">60</param>
+    <param name="a_b"       type="float"   min="0"    max="180"   _gui-text="Angle b / deg">30</param>
+    <param name="a_c"       type="float"   min="0"    max="180"   _gui-text="Angle c / deg">90</param>
+    <param name="mode"      type="optiongroup"                    _gui-text="Mode"  appearance="minimal">
+        <_option value="3_sides">From Three Sides</_option>
+        <_option value="s_ab_a_c">From Sides a, b and Angle c</_option>
+        <_option value="s_ab_a_a">From Sides a, b and Angle a</_option>
+        <_option value="s_a_a_ab">From Side a and Angles a, b</_option>
+        <_option value="s_c_a_ab">From Side c and Angles a, b</_option></param>
+    <effect>
+        <object-type>all</object-type>
+                <effects-menu>
+                    <submenu _name="Render"/>
+                </effects-menu>
+    </effect>
+    <script>
+        <command reldir="extensions" interpreter="python">triangle.py</command>
+    </script>
 </inkscape-extension>