Writing extension

Discussion about writing code for Inkscape.
sgestin
Posts: 1
Joined: Thu Sep 08, 2016 9:22 am

Writing extension

Postby sgestin » Thu Sep 08, 2016 9:43 am

Hi,

I'm really newly in Inkscape extension writing. I'm used with Inkscape drawing and I was facing some iterative task for creating font icons. So I would like to write an extension for automating these repeating actions.

Here is the general description of my goal:

- I'm drawing icon set in an single svg file. Icons are made of parts (paths, objects, texts) which are grouped in g element.
- Selecting a single group (my final icon), I would like a shortcut to create a final and unique path which is an union of all objects of the group.

This extension ideally would use inkscape native actions and perform them in this order:
- clone group selected to working group.
- perform Inkscape's "degroup" action on working group until there is no more group.
- perform Inkscape's convert "object to path" action
- perform Inkscape's "regroup" action on working group until there is no more group (due to text object convertion to path as text is a group of path).
- perform Inkscape's "path union" action with all paths.
- copy final path to clipboard to allow paste on another svg file.

Is this possible with current Inkscape extension SDK?

Best Regards,
S.

Moini
Posts: 2054
Joined: Mon Oct 05, 2015 10:44 am

Re: Writing extension

Postby Moini » Fri Sep 09, 2016 4:22 am

You don't even need to write an extension for that.

There is a 'deep ungroup' extension somewhere on the web, and you can assign a keyboard shortcut to it. After that, select it, do Ctrl+Shift+K, then you'd only have to do a path -> union (unless you're really using clones? You could also just duplicate...).

I'd use the deep ungroup extension in combination with inkscape commandline script to do this for several files at once.

Not sure why you need the regrouping?
Last edited by Moini on Sat Sep 10, 2016 8:14 am, edited 1 time in total.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Moini
Posts: 2054
Joined: Mon Oct 05, 2015 10:44 am

Re: Writing extension

Postby Moini » Fri Sep 09, 2016 5:59 am

Inkscape commandline reference: https://inkscape.org/doc/inkscape-man.html
Deep ungroup extension: will be available in 0.92 (see https://bugs.launchpad.net/inkscape/+bug/171117), original extension can be found here:
https://gitlab.com/mcepl/inkscape_ungro ... ree/master
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests