Re: Icon sets
Posted by xnakos on Oct 04, 2012; 12:46am
URL: https://forum.librecad.org/Icon-sets-tp5707060p5707087.html
I think a quick way to go is this. SVG is a text file actually. Open it with a text editor and you can see the organization of groups (layers). It is actually XML. Even without fully parsing the XML, you can create a regular expression to match all stuff like
id="layer104"
inkscape:label="tool_redo"
This (id and name of image to be created) is all you need to call inkscape externally (as a shell command), as Rallaz suggested. Using a script of course. One way to deal with paths is to incorporate the path in the label. For instance, to have something like
id="layer104"
inkscape:label="$dir1$dir2$tool_redo"
("$dir1$dir2$tool_redo" is the layer name in inkscape in this case) $ could be the directory separator, which would mean that dir1/dir2/tool_redo.svg will be the SVG exported for that layer. All non-existing directories would be created. I guess that "/" could be used as the directory separator as well! ;) This approach would, of course, mean that if the directory structure changed, all names of layers under a changing directory should change. So, another approach would be to create dummy (empty) layers that would somehow encode the parent directory path of the following normal layers till another dummy layer comes. Let's say
id="layer103"
inkscape:label="$asdf$jkl"
id="layer104"
inkscape:label="tool_redo"
id="layer105"
inkscape:label="tool_foo"
could mean that asdf/jkl/tool_redo.svg and asdf/jkl/tool_foo.svg would be created. I like this approach better. I could also create a python script for you, if you wish. Although the task is really simple.