Some elegant Element Renaming in Inkscape (0.41)?
![](https://secure.gravatar.com/avatar/a16b105cb19ccfa50e7e2bff0e606a35.jpg?s=120&d=mm&r=g)
hi all,
i am a very happy user of inkscape for all my SVG needs, and have been using it for the last few releases very happily. thank you for all your hard work, you make wonderful things possible!
one thing that i haven't been able to work out how to do, is properly name my objects. i use SVG as a design language, and elements in my SVG document need to be named certain things .. this "rect123" business doesn't really cut it.
usually, i just hand-rename things, but lately i've found that there are some objects for which this method just doesn't work.
how difficult would it be to add a feature in inkscape where you can select multiple elements, and then type in a 'name template', and have that applied to all objects? for example, i've got "circ1823", "rect123" and "object23" all selected; i want to group these together and give them a common name scheme that looks like this "object-01", "object-02", "object-03" ..
i remember in some editing apps (was it Canvas or illustrator, i forget) you could multi-select a group of objects, hit 'Rename', and enter C-like expressions for renaming, like "myobject-%d" where %d would be replaced by the # of the object in the list of the selection.
another thing that would be handy is 're-order group', where a group is selected, and you can re-order the name of the elements ("id=" tag) automatically..
is that feasible? should i look at making an extension to do this renaming automatically, would that be the easiest way, or maybe there's a secret hidden feature of inkscape already that allows you to do renaming such as this?
![](https://secure.gravatar.com/avatar/15f5e6abf26f57e1838c29a8356ce7f8.jpg?s=120&d=mm&r=g)
Jay Vaughan wrote:
i remember in some editing apps (was it Canvas or illustrator, i forget) you could multi-select a group of objects, hit 'Rename', and enter C-like expressions for renaming, like "myobject-%d" where %d would be replaced by the # of the object in the list of the selection.
another thing that would be handy is 're-order group', where a group is selected, and you can re-order the name of the elements ("id=" tag) automatically..
is that feasible? should i look at making an extension to do this renaming automatically, would that be the easiest way, or maybe there's a secret hidden feature of inkscape already that allows you to do renaming such as this?
Writing an extension would certainly be the fastest way to get a working prototype of the functionality you desire. It is probably also one of the best ways to show the developers exactly what you want to do. I would be happy to answer any questions you have as well as I can. If I wasn't late for work I'd probably hack something together for you right now. :)
Aaron Spike
![](https://secure.gravatar.com/avatar/8d5128b5b838ecedc34635fba7995f7f.jpg?s=120&d=mm&r=g)
On Wed, Jun 08, 2005 at 08:21:24AM -0500, aaron@...749... wrote:
Jay Vaughan wrote:
i remember in some editing apps (was it Canvas or illustrator, i forget) you could multi-select a group of objects, hit 'Rename', and enter C-like expressions for renaming, like "myobject-%d" where %d would be replaced by the # of the object in the list of the selection.
another thing that would be handy is 're-order group', where a group is selected, and you can re-order the name of the elements ("id=" tag) automatically..
is that feasible? should i look at making an extension to do this renaming automatically, would that be the easiest way, or maybe there's a secret hidden feature of inkscape already that allows you to do renaming such as this?
Writing an extension would certainly be the fastest way to get a working prototype of the functionality you desire. It is probably also one of the best ways to show the developers exactly what you want to do. I would be happy to answer any questions you have as well as I can. If I wasn't late for work I'd probably hack something together for you right now. :)
Aaron's right on the money there. :-) Great idea.
IIRC, long, long ago there was a feature request for adding this... If you look through the early RFE's there might be a discussion about it.
Bryce
![](https://secure.gravatar.com/avatar/a16b105cb19ccfa50e7e2bff0e606a35.jpg?s=120&d=mm&r=g)
Writing an extension would certainly be the fastest way to get a working prototype of the functionality you desire. It is probably also one of the best ways to show the developers exactly what you want to do. I would be happy to answer any questions you have as well as I can. If I wasn't late for work I'd probably hack something together for you right now. :)
Aaron's right on the money there. :-) Great idea.
the thing is, how do i get the 'selection order' from inside an inkscape extension script? i.e., i want to rename the elements that have been selected, 'in the order that they were selected', (not the order in which they appear in the DOM) .. is this feasible?
IIRC, long, long ago there was a feature request for adding this... If you look through the early RFE's there might be a discussion about it.
i remember bringing this up once or twice in the earlier history of inkscape, but never went anywhere with it because i just ended up hacking a PySVG script to sorta do it for me .. but it'd be far more useful for me if there were some sort of 'name/id administration' capabilities within the interface of inkscape itself ..
i can see a future where inkscape might be used by freedesktop types to create 'standard controls' (if not already) .. once things go in this direction, having more powerful 'object/element naming tools' in inkscape itself might be useful?
![](https://secure.gravatar.com/avatar/15f5e6abf26f57e1838c29a8356ce7f8.jpg?s=120&d=mm&r=g)
If you are working with Python, could you please try using inkex.py as the basis for your extension? Not because it is good or the only way to do it, but because you might be able to make it better. :)
Jay Vaughan wrote:
the thing is, how do i get the 'selection order' from inside an inkscape extension script? i.e., i want to rename the elements that have been selected, 'in the order that they were selected', (not the order in which they appear in the DOM) .. is this feasible?
I was playing with this in interp.py this weekend. In the current state of the extensions mechanism you don't need to do a thing. The ids inkscape passes to the script on the command line are passed in the order they were selected. Very useful! I hope it stays this way.
If you don't mind, I would be happy to work on this with you.
Aaron Spike
![](https://secure.gravatar.com/avatar/a16b105cb19ccfa50e7e2bff0e606a35.jpg?s=120&d=mm&r=g)
At 8:26 -0500 13/6/05, aaron@...749... wrote:
If you are working with Python, could you please try using inkex.py as the basis for your extension? Not because it is good or the only way to do it, but because you might be able to make it better. :)
okay, but where do i get inkex.py from? inkscape CVS?
I was playing with this in interp.py this weekend. In the current state of the extensions mechanism you don't need to do a thing. The ids inkscape passes to the script on the command line are passed in the order they were selected. Very useful! I hope it stays this way.
ah, that is quite handy! :)
If you don't mind, I would be happy to work on this with you.
great, well i guess the first thing i have to do is cut my teeth on extensions in inkscape .. i've not used them much. so i'll dig in and let you know what i come up with ..
participants (3)
-
unknown@example.com
-
Bryce Harrington
-
Jay Vaughan