Script for merging nodes

Post about using Inkscape with cutters or plotters.
daqq
Posts: 2
Joined: Thu Jun 28, 2012 7:43 pm

Script for merging nodes

Postby daqq » Sun Nov 04, 2012 10:07 am

Dear Forum,

Is there any script that would automatically take selected nodes and merge those pairs that have same position into one (thereby connecting two separate paths into one)?

I need this because I use Autodesk 123D, which can spit out an SVG. Unfortunately, the output is just individual objects (simple individual lines). My manufacturer has some obscure software which, while can deal with SVGs, it takes the paths one at a time in no optimal order. This increases the manufacturing time significantly - the machine might jump from one side of a rectangle to the opposite side starting at the opposite point. So far I've done the merging by hand, but it's just not fun anymore :D .

Thanks,

David

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Script for merging nodes

Postby brynn » Sun Nov 04, 2012 12:07 pm

Image
Welcome David!

I actually don't know how to write a script. But meanwhile until someone who might know how comes along, there might be an easier way than joining one at a time.

If the nodes to be joined are all end node on top of end node, and you can select them all fairly easily (by dragging a selection box around them) (hold Shift to make multiple selection boxes, if there are multiple lines) (or if the entire document is these straight lines, forget the selection boxes and just do Ctrl + A to select all) then you can switch to the Node tool, and do Ctrl + A to select all the nodes. Now Hold Shift key and click each end node that you don't want joined, which deselects those. So now you should have selected all that nodes that need to be joined. Now just click "Join selected nodes" button on Node tool control bar.

If the entire document is these straight lines and nothing else, it would be as simple as Node tool, Ctrl + A, Ctrl + A, Shift + click, click, click, etc (to deselect endnodes), Join.

Orrrrr....well, actually now that I re-read your message, you didn't say you were doing them one at a time. :oops: You just said "by hand". So maybe that's exactly what you've been doing?

Well, I'll post anyway, just in case it might be more fun, until you can get a script :D

daqq
Posts: 2
Joined: Thu Jun 28, 2012 7:43 pm

Re: Script for merging nodes

Postby daqq » Sun Nov 04, 2012 6:54 pm

Dear Brynn,

Thanks for the warm welcome.

Yes, by hand I did indeed mean that I selected manually TWO of these nodes and then clicked the Join selected nodes button.

I tried your suggestion to select them all at once and then click the tool, it worked perfectly.

Problem solved!

Thanks,

David

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Script for merging nodes

Postby brynn » Sun Nov 04, 2012 11:31 pm

Awesome :D


Return to “Inkscape & Cutters/Plotters”