Remove duplicate nodes and join close nodes

I use Inkscape when designing for my cutting machine. Sometimes there will be a need to clean up the paths for excessive duplicate nodes or join splitted paths. Other inkscape extensions have solved this for real duplicate nodes, but often the duplicates are not exacly the same coordinate and a tolerance is needed. The simplify option in Inkscape might help, but often it ruins the design or do not do what I need it to. So I have written an Inkscape extension that clean up my nodes the way I want it to.

What the extension does

Remove duplicate nodes

As it’s name says, the extension will always remove nodes that have the exact same position within the same (sub)path. As what seem to be exact same position might be slightly different the next options will allow for some discrepancies.

Remove close nodes

You can specify a tolerance for how close the nodes should be to regard them as duplicates. This allow for removing close-to-duplicate nodes . Also use this to reduce the amount of nodes, but for that purpose you might be better off with the built in Simplify tool.

The black path is the original with multiple nodes where the Remove duplicate nodes has been set to interpolate close nodes if a segment is less then the minimum set tolerance. The red path is the result (the extension does not change the color).

Close paths

Specify a tolerance for how close the end nodes of a path should be to regard it as a closed path. The nodes will be interpolated and the path will be closed. This will operate on each subpath separately if your path is combined of multiple subpaths (Ctrl+ K).

Join subpaths

If your path is combined of multiple subpaths (Ctrl+ K) these subpaths can be joined if the end nodes are closer than a specified tolerance. You can join by adding a straight line (sure not to ruin the rest of the design) or by interpolating the end nodes (smoother join). The algorithm will start with the first subpath, find the minimum distance to all other end nodes and join if closer than the tolerance. You may allow for reversing paths.

A) The testpath consisting of several subpaths, B) the testpath visualized with number subpaths (green dots = start node, red dot = end node). C) red line shows result when applied close paths and join subpaths with interpolation. D) same as C but with straight line segments to join subpaths rather than interpolation.

How to download the extension

  • Go to my Inkscape Resources and download the zip file (arrow down button)
    • or if you have an GitLab account you could download from here
  • The zip file containing the files removeDuplicateNodes .inx and .py
  • Unzip and place the files in your User extensions folder. (Check Inkscape Preferences (Shift+Ctrl+P) and find your local User extensions folder specified in the System tab).
  • Restart Inkscape to update with the new extensions. You will find these in menu Extensions > Cutlings > Remove duplicate nodes…

How to use the extension

If you want to join separate paths, make sure to combine these first (select them and Ctrl + K). Select the paths for which you want to clean up nodes. Select Extensions > Cutlings > Remove duplicate nodes… Set your selections and tolerances. Apply (or Live preview to watch what will happen while playing with the settings).

11 thoughts on “Remove duplicate nodes and join close nodes

  1. Hi and thanks

    Remove duplicate nodes, shows up in “Modify Path” and not in Cutlings.

    Best regards
    Asger

  2. I preferred the extension when I could set the distance between nodes. I had it at 0.005 mm, and that worked better for me. Now I have to fix duplicate nodes myself far more often. And I preferred it under “Cutlings” in the Extensions menu. Higher up the menu and fewer extensions in the pop-up list.

    It’s still the best Inkscape extension. I just found it more useful before.

    Thanks!

    1. Sorry to not come back to you straight away – I guess this message drowned in summer vacation. I have edited the precision from 2 decimals to 3 decimals. Hope that works for you. I’ve been trying to add this extension to come by default with Inkscape. That is partly why it is now put in the Modify Path submenu. Read more about the new version in the readme here: https://gitlab.com/EllenWasbo/inkscape-extension-removeduplicatenodes
      You can edit the inx file to force another submenu of your choise. Just eddit the submenu name close to the end of the inx-file.

      1. It’s bizarre. I ran it . . . and it didn’t work. No changes at all.

        It talked to itself for a considerable period (there were several duplicates), but there were no changes, not on “Life preview” or on applying.

        I tried a bunch of different values in the fields and there isn’t any sign of life.

        I’ll try CleanUpPath and see if it works better for me.

      2. CleanUpPath doesn’t work for me either.

        I’ve got some error messages, if you’re interested.

        1. Maybe you can send the error messages and a bit info on your setup (operating system, inkscape version) on email ellen at wasbo.net and I will look into it when I find time – a bit busy these days so please be patient.

  3. hello,

    I installed your extension but got some message errors so that i can not test it.
    I’m 65 and make marquetry.
    I draw with Inkscape and what I’m looking for is the possibility to mark an endnode that is not conencted to anything.
    I need to have all my path connected for my laser and I would like to correct it manually so that all I need is just a marker on the end nodes that are not conencted to any other node.
    Could it be possible for you to make such exension?

    Thank you
    Nicolas

      1. Hello,
        Thank you for your reply.
        I had a look on your extension but now it is possible to create colored markers with the 1.3.2 version of Inkscape so that it is easy to mark start and end nodes.
        My problem is that I need to use the command Path/Fracture that is very useful to create separate pieces for marquetry.
        But this command works only if the nodes are perfectly snapped or if a path is overlapping another.
        Not if a node is snapped to a path (without any connection node).
        But when I draw, I do not reach every time a node on the path that I want to join, then command fracture does not work.
        So that I have to check my drawings and add nodes where I want to connect pathes.
        But my drawings can be quite complex.
        That’s why I’m dreaming about the possibility of highlighting or coloring “orphan end or start nodes”.
        I mean end or start that are not connected to another node so that I spot them rapidly and can correct the problem.
        I had some discussion on the Inskape forum and the best solution we found is to use colored marker with 50% opacity like red and blue so that a node connected is red+blue= purple and a non connected is only red or only blue…
        I guess my explanation are clear…:-(
        Do you another have a solution or some advices?
        Best regards
        Nicolas

Leave a Reply

Your email address will not be published. Required fields are marked *