Create a LoopWhile to list a path of points

Hello everyone!

So, i have a primary list, with two nested lists, of StartPoints (called Mont) and EndPoints (called Juz). This points define a path and i need to create some sort of sublist wich give me the sequence from all EndPoints to the origin, the first of all StartPoint.

At first, i thought it could be done with a LoopWhile node, but when i tried to do that i realized that wouldn’t be that easy.

In this image you can see the List of Points with its geometry:
imagem

Next i prepared the Initial Group and created a sublist to all the EndPoints in order to get the next points of the sequence:
imagem

Then i created what i called the LoopBody. First i get the index of each endpoint on the previous EndPoint list/LoopBody to, if not null, get the item (StartPoint) at that index, on the StartPoints of List of Points (image 1) or previous LoopBody.
imagem

Manually, i did 4 steps until GetItemAtIndex gave me null at all indices, defining that way the path from each EndPoint to the origin.
imagem

So, if anyone could help me, i need to know how can i apply it on the LoopWhile node.

Thanks for your time.

I may be misinterpreting what you are after here, but why not use a polycurve by points, and then explode the results?

Jacob, thanks for your sugestion but it won’t work.

Basically, each point represents an element, as you can see at images 2 and 3.
And i need to create the sequence from each element to the element#0.

Hope to help you to understand the problem.

Ok, I’m lost.

So you want a line network like this:

P0, P1
P0, P1, P2
P0, P1, P2, P3
P0, P1, P2, P3… Pn

Or a line sequence like this:
P0, P1
P0, P2
P0, P3

P0, Pn

Or something else entirely?

The first would be what I suggested with a List.Drop to remove lines off the end of the network (a range from -1 to -(n-1) where n is the count of your list.

The second would be longest lacing where you feed P0 into input 1 and P2…Pn into input 2 of a line.bystartend node.

Ok, let me try to make it easy.

Imagine this cenario:
I have 4 points (P0, P1, P2, P3) creating 3 lines (L0, L1, L2) which represent the T letter.
Now, i want to get a sequence starting from EndPoint of each line to the origin, giving me the list of points resulting from that path.

I guess this image can explain better what i’m trying to say: