Replacing all <use> tags with command line

Asked by Anshul Bhatnagar

Hi

Version: 0.48.3.1

I have an SVG which reuses a bunch of <use> tags and references the <path> tags to draw an image. I was trying to replace all of these <use> tags with their corresponding <path> tags. The approach I was taking was to select the individual object and do a Edit --> Unlink Clone.

Question 1: Is there a better way to do this?

If not, then this requires me to select each individual object individually and convert it. In command-line mode, I need to know the IDs for all the <use> tags. Ctrl + A or Ctrl + Alt + A does not let me Unlink Clone.

Question 2: Is there a way to select all the individual objects by tags in command line?

The IDs all start with "use", so if can use the --verb DialogFind, that would select all of them.

Question 3: How do pass parameters to --verb=DialogFind ?

If you need more details please let me know. If you would like me to make 3 different questions, I would gladly do that too. A quick response would be extremely appreciated.

Thanks and regards.

Question information

Language:
English Edit question
Status:
Answered
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
su_v (suv-lp) said :
#1

On 2013-05-29 24:41 +0100, Anshul Bhatnagar wrote:
> Question 3: How do pass parameters to --verb=DialogFind ?
>
> If you need more details please let me know. If you would like me to
> make 3 different questions, I would gladly do that too. A quick response
> would be extremely appreciated.

Verbs are rather limited for command line usage (AFAIK they originally
had been designed for internal usage mostly -> e.g. menu items and
keyboard shortcuts): verbs in Inkscape do not take parameters or
arguments at all (known limitation, tracked e.g. in bug #361237 for saving).

Based on above limitation, AFAIU there is no built-in capability right
now to filter objects by partial strings of their ID on the command
line. As workaround you could for example write a (shell, python, …)
script, parse the IDs of the SVG file and then construct calls to
inkscape with the command line arguments based on the resulting list of IDs.

Maybe some of the python extensions shipping with inkscape give you
ideas how to use XPath / lxml for easier filtering (I'm not an expert in
this area myself - but there are plenty of web search results, e.g.
<http://stackoverflow.com/questions/2359317/how-to-find-elements-by-id-field-in-svg-file-using-python>).

References:
<http://tavmjong.free.fr/INKSCAPE/MANUAL/html/CommandLine.html>

Can you help with this problem?

Provide an answer of your own, or ask Anshul Bhatnagar for more information if necessary.

To post a message you must log in.