How to Alternate Family Instance from A List

Hi,

I have some elements arrayed along multiple curves and I’d like to swap every other curve with an alternating starting family:

The List.TakeEveryNthItem is actually working as intended, so I think the tweak must be some kind of simple math that’s right in front of me.

If my understanding is right, the List.TakeEveryNthItem is going through the whole list of elements in order and processing it through:

So perhaps split the list by each line (with something like List.chop, and then alternating twice with an offset by each line? Hoping there might be a simpler solution?

Also wanted to say big thanks to everyone that’s been helping me out over the past few weeks on this forum. Everyone’s been super helpful at explaining and providing tips! Really appreciate it!

Paver Path Array MOD.dyn (282.0 KB)
Test Paver Path Array.rvt (588 KB)

Hi @sascari ,

With List.ShiftIndices you can shift every item one (or more) indices in your list.

Otherwise List.GetItemAtIndex/ List.RemoveItemAtIndex and List.AddItemToFront/End should also work :smiley:

I think with List.ShiftIndices the stack remains the same. I’m going to give GetItemAtIndex a shot.

@Daan : These are all very handy nodes, but I’m not sure where they fit in the graph.

I don’t want to remove or add any of the elements, so not sure where RemoveItemAtIndex or AddItemToFront/End would help either…Sorry maybe I’m missing something really obvious!

If I could filter by every other sub list I think I could solve this problem. In this example I have 4 L2 sublists. If I could grab every other sub list, that could work because then I could run the EveryNthItem separately on each sub list (although this too seems a bit overly complicated). Would a filter bool mask work?

Thanks.

Good News! I was able to split the lists successfully, but it feels very convoluted as method. If anyone wants to offer suggestions on how to simplify, I’d be grateful. I prefer simpler solutions to complex ones, but this seems to work! Thanks!

Paver Path Array MOD.dyn (249.3 KB)

Test Paver Path Array.rvt (592 KB)

1 Like