How can I choose the lines, whose ends can be detected?

Hi everyone,

As you see the attched pic, I have polylines connected together with the “X” connection and “Y” connection. I want to delete the the lines between the “Y” connection, indicated by the arrows. I have the GH code to find the ends of the “Y” connection, but I don’t know hot to select the lines through GH. (12.6 KB)

Any idea and suggestion is so appreciated!


Check this:


Hi ajarindia,

Thank you for your idea. However, it is still a kind of manual choosing, as you need to find the index of the line manually. I prefer GH to find the lines automatically, because there will be tons of this kind of lines and you can’t choose them by hand.


missing (16.1 KB)

This looks for curve segment endpoints that are duplicated three times (MIndex ‘N’ output equals 3).

2 Likes (16.7 KB)


Thank you so much, Joseph!
I am testing it for large number of lines.

Thank you so much Kim!
That’s really compatible to my previous code!

It will fail if the connecting polyline you want to remove has more than one segment…

Hi Joseph,

The test shows that your code is very good for large amount of lines, and even faster than Kim’s.
Thank you so much again for your kind help.