Inkscape.org
Creating New Extensions Unionizing the Members of a Group
  1. #1
    gotanidea gotanidea @gotanidea

    Hi Everyone! I hope you guys are doing well

    I want to unionize the members of each selected group, but the contents of the groups are a bit complicated (nested sub-groups and masks). For example, these groups:

    Groups Before Union

    After the union operation, they should look like this (the unionized objects are named based on the names of the groups):

    Unionized Objects

    I asked ChatGPT to create the extension, but it doesn't work at all. Please find attached for the SVG file and the extension

    Could you guys please help me out?

     

  2. #2
    inklinea inklinea @inklinea⛰️

    Do you mean the equivalent of Path>Union but automated for groups or selections of objects ?

    Or something else ?  

    If you can describe how you would do it manually without an extension it may help.

  3. #3
    gotanidea gotanidea @gotanidea

    Hello @inklinea !

    Yes, I need to automate the Path > Union operation for the complex groups in the example above. It's very troublesome to do it manually, since the contents of the groups are kind of complicated

    The manual method would be:

    1. Ungrouping the group until there's no group anymore
    2. If we encounter masked objects during the ungrouping, we will delete the masked objects but keep the mask object
    3. Finally, we combine the objects with Path > Union operation and rename the new object with the name of the original group

    Basically, from this to this

  4. #4
    inklinea inklinea @inklinea⛰️

    The union part requires a command call to the main program from the extension.

    The ungrouping and the deleting of the masked objects can be done in the extension.

    "we will delete the masked objects but keep the mask object"

    Does this mean restore the mask object to the canvas ? The reason I ask is mask objects go to <defs> as <mask> - do you want to convert the <mask> back to a normal object on canvas or just leave it in <defs> ? 

  5. #5
    gotanidea gotanidea @gotanidea

    "we will delete the masked objects but keep the mask object"

    We need to convert the mask object into a normal object, to unionize it with the other objects in the group

Inkscape Inkscape.org Inkscape Forum Creating New Extensions Unionizing the Members of a Group