dimension.py revision cc4432ab3a75143cee1c437e6e323ffc05c76f21
'''
An Inkscape effect for adding CAD style dimensions to selected objects
in a drawing.
It uses the selection's bounding box, so if the bounding box has empty
space in the x- or y-direction (such as with some stars) the results
will look strange. Strokes might also overlap the edge of the
bounding box.
Path" effect to add measurements.
This code contains snippets from existing effects in the Inkscape
extensions library, and marker data from markers.svg.
Copyright (C) 2007 Peter Lewerin, peter.lewerin@tele2.se
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
'''
# standard library
import sys
try:
except:
# local library
import inkex
import pathmodifier
from simpletransform import *
help="x offset of the vertical dimension arrow")
help="y offset of the horizontal dimension arrow")
help="Bounding box type")
if defs == None:
if rotate:
else:
return line
return line
# query inkscape about the bounding box
exit()
else:
q = {'x':0,'y':0,'width':0,'height':0}
if bsubprocess:
p = Popen('inkscape --query-%s --query-id=%s "%s"' % (query,id,file), shell=True, stdout=PIPE, stderr=PIPE)
else:
f.close()
# Avoid ugly failure on rects and texts.
try:
except TypeError:
exit()
# group = inkex.etree.Element("g")
if __name__ == '__main__':
e = Dimension()
e.affect()
# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99