It looks like you need to look at DBUS work to interactively do what you want. I.e examine state in inkscape and then do something with it. This was linux-only until very recently but now there is a dbus windows release. It needs testing. http://www.freedesktop.org/wiki/Software/dbus
I hope to see it more fully integrated eventually. Alas I can't work on this directly myself. Check out dbus in the inkscape archives for examples. Mark...
On 1/18/2012 10:55 PM, Jasper van de Gronde wrote:
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.
Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel