Group Walls by Chain

I feel like this should be simple, but I am coming up blank. Can you help me get “un-stuck”? Thanks.
I have a list of walls (Many). They are in chains. In Revit you can chain select them easily.

Instead of one big flat list, I want them grouped by chain. I used the Archi-lab node: Group Curves which gives exactly what I want. But I now want to apply this structure back to the original list.

I did try using DoesIntersect, and then lindexof, it seems to work, but seems kinda hacky and with cross product lacing, it generates 1.7 million entries and takes quite a while.

I feel like there has to be an easier way to do this? Any assistance is greatly appreciated.

I think I got it. List.Chop with a List.Count seems to do the trick.

Spoke too soon. This might work, but the lists are not in the same order. So now I have to figure out how to reorder them.

1 Like

First try:

GroupByCurve.dyn (19.5 KB)GroupByCurve.rvt (1.3 MB)

Smarter people can probably do this more efficiently. At least it avoides the crosslacing issue.


Thanks! That seems to do the trick. I had tried something similar, but it wasn’t working. I was trying to flatten the list before getting the index. I am still not sure I understand why list at level 2 gives a different result than flattening, but I am fine with list at level 2, so the heck with it. It took me a while to work through the logic of grabbing the bad values (-1) and transposing, but it eventually sunk into my thick skull. So thank you. This will do nicely.

Oops, noticed this later, to answer the orginal question you need to Group the Walls themselves ofcourse.

Yup. I figured that out. Thanks