Вы находитесь на странице: 1из 1

The process of extracting data from embedded lists is pretty much the same as extracting data from

a single list. You can use the list at level setting to specify the level that you want to extract from. In
this exercise, there are nested lists in the List.Create node on the right. There are three levels within
the list. @L1 is the first level. The first level is all of the items in the list. In this example, the items are
the points. The first level will always be the items in the list. @L2 is the second level. In this example,
the second level is the nested lists. And lastly, the third level, @L3, is the main list in this example. In
the node Library, expand Core > List. Next, under Action, find GetItemAtIndex, and then place the
node in the workspace. Move the node to the far right of the graph. Pay attention to the flyout arrows
(>) next to list and index on the List.GetItemAtIndex node. Several nodes in Dynamo have these
buttons available on the inputs. Click the button next to list to display a menu. First, you can choose
whether or not to Use Levels. When this option is selected, a list at level setting will be available next
to the input. This allows you to specify which level of the list to extract from. Keep list structure is
available only when Use Levels is selected. This option allows you to maintain the inputs level
structure. When selected, the list input port highlights in blue. To begin, select Use Levels and
deselect Keep list structure. Next, connect the output of the List.Create node to the list input of the
List.GetItemAtIndex node. For the index input, you need a numeric value to specify the index
number. Double-click the canvas to place a Code Block and enter 0;. Then click in the canvas, and
an output port is created in the Code Block. Connect the output to the index input. Then pin the
output of the GetItemAtIndex node so that you can see the output while you adjust the list at level
setting. Set the list at level to @L3, which is the main list level in this case. Since the index input is 0,
the first item in the third level of the list will be extracted, which is the first nested list. When you
change the list at level to @L2, the first item in each nested list is extracted. This is because the
nested lists are at level two; therefore, the items being extracted are the items in the nested
lists. Lastly, when you change the list at level to @L1, all the items in each nested list are extracted
because all of the items are at level 1. When you change the index input to 1, a warning
appears. This is because the index is out of range for the list that is input. However, you can change
the list at level to @L2 or @L3, and the second item in the list will be extracted.Next, change the list
at level to @L1 and change the index to 0 again. Once again, all the items are extracted and
become a list. However, you can click the arrow (>) next to list and select Keep list structure, and the
nesting structure will be maintained for the items. So be aware that you have options when using
lists and nested lists as inputs. And keep in mind that several nodes have the list at level options.

Вам также может понравиться