On 17-01-12 19:58, Trever L. Adams wrote:
... So basically you want to embed information needed to convert a drawing to something that can be embroidered? And you want this information to be visible and manipulable in Inkscape's interface?
Yes, I am starting from information I have found here: http://jumpnslide.tumblr.com/post/2557920924/how-to-use-inkscape-as-a-game-d...
I am missing just a few pieces of information:
- How do I set values in the interface (fetch them from the SVG)? I
have defaults working, etc. 2) How do I insert my custom attributes back into the SVG?
Depending on what exactly you mean, these are not exactly "just a few pieces of information" :) My best guess is that you are talking about the dialog generated based on the INX file. If so, I don't think you can fetch information from SVG there. If you haven't yet, it might be good to have a look here: http://wiki.inkscape.org/wiki/index.php/Script_extensions
The following partial code block doesn't do #2 properly and actually crashes inkscape:
#Loop through all the selected items in Inkscape for id, node in self.selected.iteritems(): #Check if the node is a Group ( "svg:g" tag in XML ) if node.tag == inkex.addNS('g','svg'): #DO SOME THINGS TO GROUPS outputBlock += "Found a Group!" + "\n" children = list(node) for node2 in children: outputBlock += "Group " + str(node) + " contains: "
- str(node2.attrib["id"]) + "\n" node2.attrib["max_stitch_length"] =
str(max_stitch_length)
Slightly more information would help, do you get any error message? (If so, what.) Have you tried commenting out parts of this code block to see where the problem lies? If so, what were the results? (For example, I would definitely try commenting out the last line.) But I never wrote an extension myself, so perhaps someone else will spot something obviously wrong with the above code.
I am sure I am going to have to create an XML schema right? If so can you point me in the right direction?
Please, forget about schemas. Creating a schema will not magically make things work, it is essentially just a description of what your XML is allowed to look like. Actually, I don't think any part of Inkscape even bothers with schemas.
... Can you provide me with any urls which show an example of how to create an XML schema? In the past when I have looked, I just walk away with a headache.
Keep walking :) Seriously, at this point, you really don't need them.
Inkscape itself is not really scriptable. What you can do is write a python extension that essentially gets a piece of SVG to transform. But this is fairly flexible. Also, if you know C/C++ you might be able to write something like an LPE to help out.
LPE? I do know several languages, including C/C++.
Live Path Effect (there is some information on the wiki if you're completely unfamiliar with them).
I thought Inkscape was. I would like to be able to change colors (and maybe remove them in some cases), resize and place objects and save/load files from scripts.
You can do a lot from scripts, but keep in mind that Inkscape extensions are separate programs that are essentially just given some SVG to work with and can return another bit of SVG.