diff options
| author | Peter Moulder <peter.moulder@monash.edu> | 2009-04-07 06:42:09 +0000 |
|---|---|---|
| committer | pjrm <pjrm@users.sourceforge.net> | 2009-04-07 06:42:09 +0000 |
| commit | ac1e8e03e98ef457dac3dbf977e32169f2b71818 (patch) | |
| tree | c57633b834d2c880ad6c605de66fe41fb0d6612c | |
| parent | Ctor fixes and misc warning cleanups (diff) | |
| download | inkscape-ac1e8e03e98ef457dac3dbf977e32169f2b71818.tar.gz inkscape-ac1e8e03e98ef457dac3dbf977e32169f2b71818.zip | |
noop: In share/extensions: svn propset svn:eol-style native *.py *.inx
In four cases, there were a mix of end-of-line styles.
(bzr r7651)
| -rw-r--r-- | share/extensions/dxf_input.py | 680 | ||||
| -rw-r--r-- | share/extensions/foldable-box.inx | 18 | ||||
| -rw-r--r-- | share/extensions/grid_cartesian.inx | 72 | ||||
| -rw-r--r-- | share/extensions/grid_polar.inx | 70 | ||||
| -rw-r--r-- | share/extensions/guides_creator.inx | 8 | ||||
| -rw-r--r-- | share/extensions/hpgl_output.py | 96 | ||||
| -rw-r--r-- | share/extensions/polyhedron_3d.inx | 196 | ||||
| -rw-r--r-- | share/extensions/printing-marks.inx | 98 | ||||
| -rw-r--r-- | share/extensions/printing-marks.py | 860 | ||||
| -rw-r--r-- | share/extensions/svgcalendar.inx | 274 | ||||
| -rw-r--r-- | share/extensions/triangle.inx | 54 |
11 files changed, 1213 insertions, 1213 deletions
diff --git a/share/extensions/dxf_input.py b/share/extensions/dxf_input.py index 6937825a2..d2e645ea1 100644 --- a/share/extensions/dxf_input.py +++ b/share/extensions/dxf_input.py @@ -1,340 +1,340 @@ -#!/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
+#!/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 diff --git a/share/extensions/foldable-box.inx b/share/extensions/foldable-box.inx index 356947317..e53bc8b74 100644 --- a/share/extensions/foldable-box.inx +++ b/share/extensions/foldable-box.inx @@ -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>
+ <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">
- <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>
+ <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> diff --git a/share/extensions/grid_cartesian.inx b/share/extensions/grid_cartesian.inx index 576d131a9..ecec105de 100644 --- a/share/extensions/grid_cartesian.inx +++ b/share/extensions/grid_cartesian.inx @@ -1,36 +1,36 @@ -<?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>
+<?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> diff --git a/share/extensions/grid_polar.inx b/share/extensions/grid_polar.inx index fa4098bf4..ec73681fa 100644 --- a/share/extensions/grid_polar.inx +++ b/share/extensions/grid_polar.inx @@ -1,35 +1,35 @@ -<?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>
+<?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> diff --git a/share/extensions/guides_creator.inx b/share/extensions/guides_creator.inx index 1ec0a6584..23fed9d56 100644 --- a/share/extensions/guides_creator.inx +++ b/share/extensions/guides_creator.inx @@ -12,24 +12,24 @@ <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>
+ <_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>
+ <_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>
+ <_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>
+ <_option value="8">1/8</_option> <_option value="9">1/9</_option> <_option value="10">1/10</_option> </param> diff --git a/share/extensions/hpgl_output.py b/share/extensions/hpgl_output.py index f327df2f9..306fc0e8b 100644 --- a/share/extensions/hpgl_output.py +++ b/share/extensions/hpgl_output.py @@ -1,48 +1,48 @@ -#!/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()
+#!/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() diff --git a/share/extensions/polyhedron_3d.inx b/share/extensions/polyhedron_3d.inx index 17c80814e..4f1de90c7 100644 --- a/share/extensions/polyhedron_3d.inx +++ b/share/extensions/polyhedron_3d.inx @@ -1,98 +1,98 @@ -<?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>
+<?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> diff --git a/share/extensions/printing-marks.inx b/share/extensions/printing-marks.inx index a893dedd6..c8ebad377 100644 --- a/share/extensions/printing-marks.inx +++ b/share/extensions/printing-marks.inx @@ -1,49 +1,49 @@ -<?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>
+<?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> diff --git a/share/extensions/printing-marks.py b/share/extensions/printing-marks.py index 710b71b1c..6128d7027 100644 --- a/share/extensions/printing-marks.py +++ b/share/extensions/printing-marks.py @@ -1,430 +1,430 @@ -#!/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()
+#!/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() diff --git a/share/extensions/svgcalendar.inx b/share/extensions/svgcalendar.inx index 8d8f2d567..e01666870 100644 --- a/share/extensions/svgcalendar.inx +++ b/share/extensions/svgcalendar.inx @@ -1,139 +1,139 @@ -<?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>
+<?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>
- </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>
+ <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> diff --git a/share/extensions/triangle.inx b/share/extensions/triangle.inx index 0cd12c833..3c79ca42c 100644 --- a/share/extensions/triangle.inx +++ b/share/extensions/triangle.inx @@ -1,28 +1,28 @@ -<?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>
+<?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> |
