![](https://secure.gravatar.com/avatar/b2dc087f43d1dd5db52c95b09b601da2.jpg?s=120&d=mm&r=g)
Is there a way in Inkscape (extension/plugin) to automatically set the z-order of a number of objects?
For example, I want to do what is shown by this image: http://www.maj.com/gallery/ffaat/Stuff/howto.png
(The objects here are the same just for convenience. They are not necessarily the same, and are not necessarily in a grid).
Ideally, I could provide a direction/line and have it change the z-order of all the selected objects in that orientation (though I would settle for top->down and left->right as I could just pre- and post- rotate)
I have written script-fu extension for GIMP before, but think that Inkscape is much harder to add to that way...
-Rob A>
![](https://secure.gravatar.com/avatar/bb65b6b3a109d97cf9f8d6c014ede042.jpg?s=120&d=mm&r=g)
On Nov 12, 2007 4:27 PM, Rob Antonishen <rob.antonishen@...155...> wrote:
Is there a way in Inkscape (extension/plugin) to automatically set the z-order of a number of objects?
Not yet, but I'm sure what you propose would be a very useful extension.
Ideally, I could provide a direction/line and have it change the z-order of all the selected objects in that orientation (though I would settle for top->down and left->right as I could just pre- and post- rotate)
Yes, I think choosing horizontal and vertical directions for z-oder increase should be sufficient. Also you need to provide a switch for what to consider for determining the directions, e.g. centers or left/right edges (for horizontal).
I have written script-fu extension for GIMP before, but think that Inkscape is much harder to add to that way...
I dunno about Gimp, but Inkscape extensions are pretty easy. This one however is a bit cumbersome because Inkscape does not pass to the extensions the bboxes of the selected objects. (I proposed to add this to the extensions API; Ted, is there any reason why you don't want to do this?) There's a workaround possible where you call another copy of Inkscape from the extension using the query command line params and parse what is returned - it's quite awkward but it works.
![](https://secure.gravatar.com/avatar/b2dc087f43d1dd5db52c95b09b601da2.jpg?s=120&d=mm&r=g)
On Nov 12, 2007 4:43 PM, bulia byak wrote:
On Nov 12, 2007 4:27 PM, Rob Antonishen wrote:
I have written script-fu extension for GIMP before, but think that Inkscape is much harder to add to that way...
I dunno about Gimp, but Inkscape extensions are pretty easy. This one however is a bit cumbersome because Inkscape does not pass to the extensions the bboxes of the selected objects. (I proposed to add this to the extensions API; Ted, is there any reason why you don't want to do this?) There's a workaround possible where you call another copy of Inkscape from the extension using the query command line params and parse what is returned - it's quite awkward but it works.
That is what I suspected.
Any pointers to a (I am assuming) python extension I could use as a framework to start from?
Programatically, it is trivial...just getting it to work within inkscape is the issue :)
-Rob A>
![](https://secure.gravatar.com/avatar/bb65b6b3a109d97cf9f8d6c014ede042.jpg?s=120&d=mm&r=g)
On Nov 12, 2007 9:37 PM, Rob Antonishen <rob.antonishen@...155...> wrote:
Any pointers to a (I am assuming) python extension I could use as a framework to start from?
A search in share/extensions reveals that the perspective and summernight extensions use this mechanism - querying Inkscape via --query parameters. There are lots of others there, from simplest to pretty complex, so it's a lot of examples for you to start from.
Programatically, it is trivial...just getting it to work within inkscape is the issue :)
Actually no, the interaction of the script with Inkscape is pretty simple, not to say primitive :)
![](https://secure.gravatar.com/avatar/b2dc087f43d1dd5db52c95b09b601da2.jpg?s=120&d=mm&r=g)
Wow-
I am drowning here. Having an idea of python might have helped, but I know enough other languages I figured I could figure this out as I went...
Is there a "Hello Word" extension example or documentation anywhere?
(I did find this site http://www.ekips.org/comp/inkscape/ but ended up even more confused after reading everything there)
-Rob A>
![](https://secure.gravatar.com/avatar/3f054948dfa81d7f46d602ca8a5a3f43.jpg?s=120&d=mm&r=g)
On Nov 13, 2007 10:34 AM, Rob Antonishen <rob.antonishen@...155...> wrote:
Wow-
I am drowning here. Having an idea of python might have helped, but I know enough other languages I figured I could figure this out as I went...
Is there a "Hello Word" extension example or documentation anywhere?
Here's a simple extension I wrote a short while ago in response to someone who wanted bounding boxes automatically added to their document. All it does is find the bounding box of each selected object and create a rectangle at that location and size (and groups the created rectangles). It uses the query-another-Inkscape method of finding the bounding boxes, which unfortunately makes it quite slow for lots of objects. But it should give you a nice example of how to do it.
Kurt
![](https://secure.gravatar.com/avatar/ea82b036a537a86ff8f886e89f2c5944.jpg?s=120&d=mm&r=g)
On Mon, 2007-11-12 at 17:43 -0400, bulia byak wrote:
I dunno about Gimp, but Inkscape extensions are pretty easy. This one however is a bit cumbersome because Inkscape does not pass to the extensions the bboxes of the selected objects. (I proposed to add this to the extensions API; Ted, is there any reason why you don't want to do this?) There's a workaround possible where you call another copy of Inkscape from the extension using the query command line params and parse what is returned - it's quite awkward but it works.
There is no reason that it hasn't been done other than time. I guess that, and deciding a format for it, but I think we've discussed that too (I'd have to go through my mail). This should be a pretty easy task for someone who wants to do it. There is already a loop going through all of the selected items, you'd just need to find the bounding boxes and add that to the parameter list.
--Ted
![](https://secure.gravatar.com/avatar/bb65b6b3a109d97cf9f8d6c014ede042.jpg?s=120&d=mm&r=g)
On Nov 13, 2007 2:21 AM, Ted Gould <ted@...10...> wrote:
On Mon, 2007-11-12 at 17:43 -0400, bulia byak wrote:
I dunno about Gimp, but Inkscape extensions are pretty easy. This one however is a bit cumbersome because Inkscape does not pass to the extensions the bboxes of the selected objects. (I proposed to add this to the extensions API; Ted, is there any reason why you don't want to do this?)
There is no reason that it hasn't been done other than time. I guess that, and deciding a format for it, but I think we've discussed that too (I'd have to go through my mail). This should be a pretty easy task for someone who wants to do it. There is already a loop going through all of the selected items, you'd just need to find the bounding boxes and add that to the parameter list.
Will it require any changes in the existing extensions?
I think it should be done before 0.46 then, because it will make a lot of different extensions easier, and the API changes should be done as early as possible.
![](https://secure.gravatar.com/avatar/01c2dd03530db1afb305df3aaad0fed8.jpg?s=120&d=mm&r=g)
bulia byak wrote:
Will it require any changes in the existing extensions?
I cannot speak for any existing extensions that do not make use of inkex.py. Once inkex.py is updated to understand the new command line syntaxes the dependent effects will work.
Aaron
![](https://secure.gravatar.com/avatar/36f59a376948f639608f365cf1f5f2d9.jpg?s=120&d=mm&r=g)
On Nov 13, 2007 2:07 PM, Aaron Spike <aaron@...476...> wrote:
bulia byak wrote:
Will it require any changes in the existing extensions?
I cannot speak for any existing extensions that do not make use of inkex.py. Once inkex.py is updated to understand the new command line syntaxes the dependent effects will work.
Forgive me if I'm stepping on people's toes or whatnot, but the idea of having a script executing a command-line instance of Inkscape to query the already-opened file seems...how does one say...Perl-ish? [not to knock on my beloved hackfest-that-can-be-Perl].
This is likely a discussion for the dev list rather than users, but wouldn't some type of interface into the already-running instance of Inkscape make more sense? A "webservice" or some other type of RPC API? Are there efforts underway to implement such a beast?
greg.fenton -- greg.fenton ^_at_^ gmail (yes, dot com)
![](https://secure.gravatar.com/avatar/dc940f48c5635785f32941f1fbe6b601.jpg?s=120&d=mm&r=g)
On Nov 13, 2007, at 11:51 AM, greg fenton wrote:
This is likely a discussion for the dev list rather than users, but wouldn't some type of interface into the already-running instance of Inkscape make more sense? A "webservice" or some other type of RPC API? Are there efforts underway to implement such a beast?
A long term goal had been to expose a live DOM view of the document, including DOM events. There are a few ways to achieve that, but it is fairly consistent with SVG use in general.
There are also some UI things that could also be exposed via DOM and XPath functions.
participants (7)
-
Aaron Spike
-
bulia byak
-
greg fenton
-
Jon A. Cruz
-
Kurt Hutchinson
-
Rob Antonishen
-
Ted Gould