3 ## Copyright (c) 2012 Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
5 ## This program is free software: you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, either version 3 of the License, or
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
18 import inkex, simplepath
22 def parsePaths (filen=None):
27 paths = svg.document.xpath ('//svg:path', namespaces=inkex.NSS)
29 D = simplepath.parsePath (path.attrib['d'])
36 print 'svgpath = struct("cmd","{0}","data",{{{1}}});' \
37 .format(''.join(cmdlst),str(parlst).replace('[[','[').replace(']]',']'))
39 print 'svgpathid = "{0}"; $'.format(path.attrib['id'])
43 # ----------------------------
45 if __name__=="__main__":
48 optlist,args = getopt.getopt(sys.argv[1:],"thdp")
49 except getopt.GetoptError:
57 if opt[0] == "-d": c.debug = 1
58 if opt[0] == "-p": c.plot = 1
59 if opt[0] == "-t": c.triangulate = 1
60 if opt[0] == "-h": doHelp = 1
66 fp = open(args[0],'r')
72 if len(args) > 0: fp.close()
74 if doHelp or len(pts) == 0: