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).

1 thought on “Remove duplicate nodes and join close nodes

Leave a Reply

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