Hey,
Thanks for the reply. I came up with this, trying to extract all the rectangles from the svg:
import sys sys.path.append('/usr/share/inkscape/extensions') import inkex from simplestyle import *
class RectOutput(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) def output(self): for r in self.rects: print "Rectangle occupying: ", r.attrib.get("x"),",",r.attrib.get("y")," - ",r.attrib.get("width"),",",r.attrib.get("height")
def effect(self): dom_svg = self.document.getroot() self.rects = dom_svg.xpath('//svg:rect',namespaces=inkex.NSS) self.circles = dom_svg.xpath('//svg:circle',namespaces=inkex.NSS) self.polygons = dom_svg.xpath('//svg:polygon',namespaces=inkex.NSS)
if __name__ == "__main__": e = RectOutput() e.affect()
I get something, but I am unsure what its meaning is. What I want to get: - The center of the rectangle - Its width and height - Its rotation angle
I am noticing that when I am rotating my rectangle, the "x" and "y" component change. So what exactly are there meaning? How do I get the rotation angle?
Thanks! Nathan
On 03/20/2011 03:59 AM, Alvin Penner wrote:
in the directory \Inkscape\share\extensions\ there are some examples of Python exporters, for example, .dxf, .hpgl, .xaml
hth, Alvin Penner