Extracting indices of a specific item from a list into a tree

I have simple list in grasshopper - it defines two types of element types => N (stands for normal) and Linear(stands for linear Tapered). Some linear elements are bunched together in the list (they are in a group).

I want to extract the the indices of linear elements and place it into a tree, where each brach is the list of linear elements grouped together.

Is it possible to do with grasshopper components? or perhaps a simple VBA / python script will do the trick? Attaching my grasshopper script. Can someone please help.

gh script.gh (3.7 KB)

Give this a try.

gh script-b.gh (21.9 KB)

1 Like

Thanks so much, that works pretty good for me.

I also made a small vb script to loop through the list and find start and end point of “Linear” and used it to create a tree.