Code block list @ levels

I usually use code blocks to get items from a list, e.g xcoord = list[2];

However i now want to use it to get items from a list at level 2, how can i write this in this format?

lacing in codeblock is available only in Dynamo X2, and it is desired by addind the level after the variable between <>
like myvar<2>

see this link from Dynamo primer
https://primer.dynamobim.org/07_Code-Block/7-2_Design-Script-syntax.html

so i already tried to use x = [list<2>,2];
however this did not work, i am using dynamo for revit 2.0

upload an example file if you can

1 Like

i think i understand you wrong,
if you want to get item in level 2 in code block like this

mylist[0][1]

this will get the item with index 1 inside the list with index 0

but if you want to get all the items in index 1 for example in sublist
you have to use getitematindex

List.GetItemAtIndex(mylst<2>,1)

2 Likes

Cheers mate, i was using this instead but i thought it would be easier to not use getitematindex just because its longer haha! Thanks for clearing it up :slight_smile:

1 Like

To make it easier for yourself, first make the node with the correct lacing levels, select it and use “Node to Code”, the list levels will be transferred to the new Code Block aswell! :slight_smile: