Extract item from nested list

 

Hi All

very new to dynamo.

I was struggling how to extract items from a nested list.

so lets say, I have the below list, and I want to get all the odd item from each list.

ie I am looking for an end result of

[0]list
[0] 1
[1] 5
[2] 9

[1]
[0] 2
[1] 6
[2] 10

Many thanks

Peter

Hi Peter, here’s an easy way to do it (don’t forget to set the lacing of the takeeverynitem to longest !) . You can play with the offset to switch from odd to even indices.

Many thanks !!

I do have a problem tho, for some reason it doesnt work when use with list.create, but it works with code block ?? I got error message

Warning: List.TakeEveryNthItem operation failed.

Value cannot be null.

Parameter name: source

 

Any idea?
Much appreciated

That’s strange … I don’t get the same result (i’m on 0.9.1) .

I guess you can try with a list.map , but this time the lacing of the takeeverynitem node has to be set to shortest:

 

Many thanks, it was a bit strange. probably just a bug.

its good to know some work around !!