Extend Line to the Closest Curve

Hello everyone,

I am trying to draw lines (extending vertical lines to the nearest horizontal line up and down). I am using Closest Point by extracting the End Points of the vertical curves, however, after I pull the points and cull the duplicates to make a polyline, the lines goes from the bottom horizontal line to the top horizontal line which is not what is intended as shown in the picture:

I want the extended line to stay between two closest horizontal lines as shown in the figure below:

Could anyone please provide me a direction or correct what I am doing wrongly because I was looking at the forum and Pull Point seemed to work fine for those. Your help will be much appreciated.

Thanks a lot!

Lines_1.gh (72.4 KB)

I think it what you want.

Lines_2.gh (67.9 KB)

1 Like

Thank you so much. It works. Could you please help me in closing the curves to form rectangles? I have tried by arranging the start and end points according to z and x axes and then sub-divide the list into a group of 4 points as the vertices of the rectangles but the polyline that is created is irregular, Could you please provide me some guidance here too?

Lines_3.gh (71.2 KB)

Like this?

Lines_3-b.gh (78.0 KB)

1 Like

Exactly, now it seems so simple and I feel stupid. I need to get grip on how to use sets. Thanks a lot Ethan!