Inkscape.org
Creating New Extensions alphanumeric z-order sorting of objects/paths
  1. #1
    Jan Brocher Jan Brocher @biovoxxel

    Hi all,

    Is there an existing manner, either in form of the UI or via a script to sort objects alphanumerically according to their title or other attributes in the z-order?

    Rationale: I create SVG objects/groups in another software and import them in Inkscape. The files are numbered in the order of their creation sequence (01-....).

    Since I would like to use the super nice grid alignment function on those objects the order is important, so they do not get mixed up.

    On my computer (Win 11) this works perfectly by just selecting the files in the file explorer, dragging them into Inkscape, they maintain the order and I can align.

    However, I figured out that on some computers (and I cannot figure out why) the z-order is mixed up and is not respecting the file numbering. Not sure if that originates from the way the OS is currently sorting files?

    I also tested if the sequence of selecting files before the import makes a difference, and it does not.

    So the question is: In case the z-order of objects is not as desired would there be any possibility to sort it according to title or similar to avoid manual z-ordering or manual pre-alignment?

    If no such function is existing, would it be something for a feature request list?

    Thanks in advance for any tips on this!

  2. #2
    inklinea inklinea @inklinea⛰️

    This would be a starting point for a script

    If you know some basic python you should be able to change the sorting order

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

    I can't find the original thread on the forum though - it might have been something I wrote for another site, can't remember.

    :)

  3. #3
    Tyler Durden Tyler Durden @TylerDurden
    *

    Maybe this extension: https://gitlab.com/inklinea/restack-by-name

     

    inklinea

    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.

    https://inkscape.org/fr/forums/questions/sorting-paths-by-name/

  4. #4
    Jan Brocher Jan Brocher @biovoxxel

    Hey @inklinea and  @TylerDurden,

    thanks a lot for that pointer. I will need to wrap my head around the code, in case I have to change it, since my python abilities are still a little rudimentary but something to get started.

Inkscape Inkscape.org Inkscape Forum Creating New Extensions alphanumeric z-order sorting of objects/paths