Inkscape.org
Creating New Extensions Auto "Symbolizer"
  1. #1
    COD COD @COD

    Greetings -
    I am dire need of an extension that will convert repeating paths into symbols in a document. Not sure if I can explain the process correctly. 

    The extension will grab the first path in the document and compare it to the other paths. If it finds the path is repeated in the document, it will replace all the equal paths to a symbol. It will grab the next path and do the smae thing until all the paths are checked and converted to symbols. 

     

    There are quite a few samples  in "https://inkscape.org/~CelticOneDesign/★celtic-knotwork-construction-kit-for-inkscape" that would benefit from such an extension.

    Basically an  auto "symbolizer" extension.

    Is this possible? 
     

  2. #2
    inklinea inklinea @inklinea⛰️

    Yes it's possible if someone wants to write it.

    Does it need to deal with rotated paths or just translations ? 

  3. #3
    COD COD @COD

    I would imagine both rotated and translations. I generally use preserved transforms instead of optimized. 

    Samples 7 Chains.svg in that collection would be a typical file. 

  4. #4
    inklinea inklinea @inklinea⛰️

    I had a quick go at trying to "relink" paths as clones.

    Clones (use elements) are basically the same as symbols except they do not sit in defs.

    The file size has halved. However all the colours are incorrect. (File attached)

    It would require more code to either remove the colours from the symbol and colour each path, or make a symbol for each colour.

    What is really needed is an extension that can find matching groups and convert them to symbols.

    Samples 7 Chains Path Clones
  5. #5
    COD COD @COD
    *

    Not sure style is important or not. I will have to think about that. I will also have to think about clones vs symbols. 

    Let me download your sample and see how to play with clones. 

     

    Edit - 
    Never really used clones before. I didn't know that I could convert a clone to a symbol. Best of both worlds? 

     

     

  6. #6
    COD COD @COD
    *

    Ok - I can see the difference between clones and symbols. Hopefully I can explain it.

    WIth clones - you can change the style by simply changing the style of the master. That is not an issue because the master is in the same document.

    With symbols- you cannot change the style unless the style is unset to begin with. That is an issue because the symbol could be in a symbol file.  If the symbol style is set, you literally have to unlink it  - change the style - then convert it back to a symbol. 

    Basically a symbol is treated like a clone except you don't have the ease of changing the style of a symbol as you can with a clone.

    Yuck - that really sucks for what I need it for. I wonder if I can bribe  a developer (lol) to have symbols styles not be fixed in v1.4? 

    Edit ; 
    Best to keep the symbols the same in Inkscape. Just in my use - set stroke and fill to unset. 

  7. #7
    inklinea inklinea @inklinea⛰️

    I might be simpler to have all the clone masters in a single layer which can be toggled to display:none

    If you toggle layer display (not master object display), it will work.

    With the code it would be possible to move the master to this layer, with the clones replacing all the copies in any layer.

  8. #8
    COD COD @COD

    Yeah - I thought of that too. Actually played around with that idea. 

    KISS approach. Turn them to unset symbols. My  particular use of symbols only involve  single paths that are grouped. Now if my symbols involved multiple paths with different styles then the coding for the extension would be a nightmare.  

    Lol - I just figured out that  I have 52 symbol libraries to redo. Hahaha. Only been working on this resource since 1995 !!! Would only take a few days to convert them. Geez

    If you code it with unset symbols would the coding  be easier?