Inkscape.org
Creating New Extensions How can i write path\combine with python ?
  1. #1
    blueDie blueDie @blueDie

    Hi,

    I'm really bored. 

    I want to write the path/combine operation I made in the inkscape editor in python.

    How can i do that ?  

     

     

  2. #2
    inklinea inklinea @inklinea⛰️

    I believe combine path just combines 'd'

    Make a couple of layers. 

    Draw two paths in the first layer, select, copy. 

    Then Edit>Paste in place in the second layer.

    Combine those two paths, save and compare the contents of both layers. 

    Of course it would have to be 'like with like' so relative with relative or absolute with absolute.

    https://inkscape.gitlab.io/extensions/documentation/source/inkex.paths.html

  3. #3
    inklinea inklinea @inklinea⛰️

    I believe combine path just combines 'd'

    Make a couple of layers. 

    Draw two paths in the first layer, select, copy. 

    Then Edit>Paste in place in the second layer.

    Combine those two paths, save and compare the contents of both layers. 

    Of course it would have to be 'like with like' so relative with relative or absolute with absolute.

    https://inkscape.gitlab.io/extensions/documentation/source/inkex.paths.html

  4. #4
    blueDie blueDie @blueDie

    Actually,

    I'm looking for a small piece of code to write.

    For example 

    combine(self.svg.getElementById("layer1")) 

    But of course the above code doesn't work.

    Do you know of any code that works like this ?

    And addition you know shortcut of combine is ctrl+k in inkscape. 

    Maybe you know a code where i can run the shortcut with python ??

  5. #5
    inklinea inklinea @inklinea⛰️

    The extension system does not naturally have access to the functions which you use in the GUI.

    It has its own system of xml / svg manipulation.

    You can access many of the gui functions, however it requires a 'command call' in which Inkscape is called invisibly the background, operates on a temp file and returns the result.

    Here is a thread which discusses something similar https://inkscape.org/id/forums/extensions/extension-to-call-path-simplify/

    However - path/combine should be possible manually by simply joining 'd' strings provided you are not mixing relative and absolute paths.

  6. #6
    blueDie blueDie @blueDie

    Hi, thank you for your answer but objects what i want to do combine unfortunately are line objects.

    Firstly i need to convert path these objects. 

    But i still haven't converted to path they with any code. 

     

    I guess this cannot be done directly with code. :(

    thanx alot again your answers inklinea

     

Inkscape Inkscape.org Inkscape Forum Creating New Extensions How can i write path\combine with python ?