Flatten - Pls explain

Can somebody explain what flatten means and how it is use?

2 Likes

see here
http://dictionary.dynamobim.com/#/BuiltIn/Action/Flatten

Flatten simply takes a list of lists (with any number of sublists) and “flattens” it into a single, 1-dimensional list.
There is also a Flatten (n) node which flattens your list of lists by combining n dimensions of a list.

3 Likes

why is there a need to flatten?

List flatten is a easy way to make sure you do not have to worry too much about list structures matching into a input node.

1 Like

Thank you guys…

Is there a way to restructure a flattened list?
@Nick_Boyts @Brendan_Cassidy @erfajo

Hi @erfajo
While I was trying to get a Solution for this Query "
How to change case of headers of a schedule by selecting more than 1 schedule view in revit using dynamo" and have build a graph but its not working .
May you suggest a solution for the same.

Formerly i was using the list flattend node in the below graph due to which all the list got de-structured and hence I asked that question.

That set of nodes is built with a object/list/list input structure. It uses Python so the data has to come in the expected shape. Try sending in the final inputs as L1/L2/L2 for the levels and longest lacing. If you have a list of schedules then a list of lists of headers and names respectively it should work I think.

1 Like

Thankyou so much…It worked

1 Like

can you help me understand the purpose of amount command here?

List Levels and the amt input both do similar things in that they change the structure of the list by changing where in the list the data is being flattened. List Levels works like all other nodes and specifies which level the node recognizes as the input structure (where the function applies). The amt value specifies how many levels the list structure should be reduced by, from the top down. Both respect part of the initial structure and “remove” other parts.

2 Likes