Inkscape.org
Beyond the Basics Can Inkscape do an automated object copy + paste?
  1. #1
    Weslo007 Weslo007 @Weslo007

    Hello everybody,

    i use Inkscape for really long time, this is super tool. I would like to use it more for automated/automatic purposes.

    For example:

    I have database of pictures (saved in master.Svg) . Each picture has unique name and some parameters. Like list of animals - (1-monkey, 2-tiger, 3-lion, 4-donkey, 5-dog, 6-cat, to 10-xxx).

    I would like to make and SW feature which can automatically open inkspace, create new file like (client.svg) and do automated picture copy (from databese) on base of some (list) and paste chosen animals ( something like 1-monkey, 4-donkey, 6-cat)? I have to do it manually. But I do this list really often and it is really boring and can be maybe easily automated.

    I can really easy in Excel Macro (handlig with objects) in MS office products, but i have no experience of this kind of abilities in inkspape. Is something possible to do on inkcape? Like Inscape "macro".

    If not, is possible to connect Excel with inkscape and do this kind of thing - somtehing like inkscape reference?

    Thank you so much for you help.

    David.

     

     

  2. #2
    Tyler Durden Tyler Durden @TylerDurden

    I might keep a master document (template) that has the pictures hidden in position, and un-hide the one I need. Then Save as Client-xxx.svg

  3. #3
    Weslo007 Weslo007 @Weslo007

    Thanks for really nice picture. 

    I just mentioned it like an example, but definition of this task is little bit more complicated. I would like to use it for automation.

    Just imagine that you have some Excel Sheet (database) with 1000 animals. Each animal will have also some specific name.

    Than you have an list of animals for local village (or project) - for Example 50 animals - each animal will have unique name (base on list) and age (base on the list).

    I would like to create some macro or programming handling which will take a look on database an pick animal - copy it and paste it to new svg file.

    like

    Dog - Rex - age 10 - picture of dog

    Cat - Catty - age 3 - picture of cat

    Cat - Tixii - age 2 - picture of cat

     

    This example with animals is really an example. I would like to use it in automation world. To select some electrical devices with some configuration and than place these objects to absolutely new *.svg file.

     

    I am really curious for possibility of programming behind inkscape or connection with Excel VBA World.

    Thank you really for update!

  4. #4
    Tyler Durden Tyler Durden @TylerDurden

    Yes, a bit more complicated than 10 animals, lol.

    Inkscape does have command-line operation that can be script driven. 

    Also note that SVG files are XML, so files can be created dynamically that include svg files or objects.

  5. #5
    berteh berteh @berteh

    If you don't need the result to be an SVG file then there's an easy option with berteh.github.io/ScribusGenerator/ 

    If you need SVG files, you could use any template engine and use xlink href attributes (in inskcape language: link without embedding) in your reference picture to include the animal(s) you want. The template engine would then dynamically replace the link from your dataset. I've had good results generating SVG in such a way using either XSLT or mustache template engine.. but any will do, really. Sorry I don't seem to find these scripts back in less than 3 minutes.

     

     

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Can Inkscape do an automated object copy + paste?