Inkscape.org
Beginners' Questions Sorting paths by name
  1. #1
    AstroSpice AstroSpice @AstroSpice

    Hi all,

    I'm trying to create a font.  I have drawn the glyphs and named them A-Z in the XML for both the pathid and Inkscape label.   I was fooling around with the layers and they are now out of alphabetical order.  Is there a way sort these paths by the either the pathid or the inkscapelabel?   It would be really time consuming to sort these manually.

    I've found the Restack extension but nothing to sort the layers based on id or label.

    Thanks in advance

  2. #2
    inklinea inklinea @inklinea⛰️

    Sort alphabetically by path id/label or layers by id/label ? ( layers are groups with a special attribute )

    or sort layers by path id/label ? ( assuming 1 object per layer )

  3. #3
    dorky dorky @dorky

    Hi there,

    I would be also interested by such a code. In my case, sorting just the direct children of a selected group by their Inkscape label would be fantastic. :)

  4. #4
    inklinea inklinea @inklinea⛰️
    *

    Give this a go:

    Seems to mostly work.

    https://gitlab.com/inklinea/restack-by-name

    I would advise using on a copy of your work (File>Save As Copy)

    In case it breaks the original file.

    -----

    I should add, it uses basic python sorting for the names. 

    So path3994 would come before path897, just by the way it sorts 3 before 8. Would need some more complex sorting code to get around that.

  5. #5
    dorky dorky @dorky

    Thank you so much Inklinea!

    You are awesome! There will be imperfections with special characters and the case sensitivity but this code will already save me a big bunch of time. Have a fantastic day!

    PS: Introducing this functionality in the core of Inkscape layer menu would be a great up as many users are looking for this. :)

    Cheers!

    Dorky.