Inkscape.org
Beyond the Basics Joining separate lines into one polygon (efficient way?)
  1. #1
    therobster therobster @therobster
    *

    Suppose I have drawn all the sides of a polygon as individual lines and the ends of the lines terminate at vertices so the nodes are paired up. I want to create a single unified polygon from the individual lines. So far I'm doing this by selecting pairs of nodes, one pair at at time, and joining two lines together at once. It can take ages to join the lines of a polygon with many lines this way though. Is there a way to select all the lines at once and just tell Inkscape to create a shape from all the lines and that if nodes are at the same point then assume that those points are the vertex of the shape?

  2. #2
    Tyler Durden Tyler Durden @TylerDurden

    I'd combine all objects into a single compound path, in node-editing mode "n", select all nodes and use the button for "Join selected nodes". Usually works.

  3. #3
    inklinea inklinea @inklinea⛰️

    I do this a lot just using shortcut keys.

    Select the shapes you want.

    Then press F2 or N, then press Ctrl + A, then press Shift + J.

    There are also extensions to close paths ( and Path>Union can work in some circumstances ).

     

  4. #4
    ian ian @Ianp5a

    I just tried it.

    1. Select all the lines
    2. Go Path->Combine
    3. Go to the Node Editor
    4. Select all nodes (CTRL-A)
    5. Click the Join Selected Nodes icon
    6. See it closes all the gaps in one go.

    Nice! Very clever of it to know which ends belong together. Even if crossing or have a large gap.

    Image 2021 02 21 114916
  5. #5
    ian ian @Ianp5a
    *

    Here I moved 2 nodes on the right way apart, and it still works OK.
    The new node position looks like it's the middle point between the 2 nodes.
    Red Before. Blue After

    Image 2021 02 21 120006
  6. #6
    ian ian @Ianp5a
    *

    And here I was mean to it. Making an ambiguous case on the left. So on the right it couldn't get a great result.

     

    Image 2021 02 21 120703
Inkscape Inkscape.org Inkscape Forum Beyond the Basics Joining separate lines into one polygon (efficient way?)