Combine nested list items into one multiline string

Hi everyone,
i would like to ask for help with creating multiline string from nested list. In the image below i manage to create list with layers of compound elements. The list contains material and its thickness. I want to create from those items multiline parameter and write it into shared type parameter.
After a lot of searching and experiments i could manage to do it so.
Any idea how to continue? My idea is to manage to create one dimensional list with combined strings with newline element between those values and than use it to set parameter by value.
Thank you for any help.

@Adam_Huleja, use the special character “\n” as a separater, like this:


This way you’ll break down the string to be used in multiline text parameter. There’s a bug with multiline text though, when writing it with API - if you try to edit this text afterwards, you’ll get the single string without breaks.

Hi and thank you for your response.
Right now iam trying to dive more into python. I am still beginner.
But the problem is still the same. I can manage to join items in one list with builtin nodes. The problem i have is, that i want to combine items in those nested list, but still keeping the upper level list structure. And there is also one condition, that every element can have different count of layers. I cant figure out how to “disassemble” that 2d list into those 1d lists, do the combining of items and store it into final 1d list.

Yeah, i thought about that character. Didn’t managed to get the list items combining to try, if Revit will take it correctly, yet:slight_smile:
Still, thank you for your response.

Once again thank you:) but this still gives me result of one string with all of the layers from all of the element types. And what i need is to get a list of strings with same number of items as number of elements (i want to combine only 2nd level of items together, while keeping the 1st level hierarchy of the original list). This is exactly the circle, in which i am whole day :slight_smile: Every approach leads me to only one string with all the layers or some errors :confused:

@Adam_Huleja Would this work for you?

3 Likes

Really?? I swear, that i have tried the String.Join node. Maybe i didnt have brain capacity to solve such a trivial problem.
Thank you and sorry for such a lame problem.
Thank you all:)

Oooh, i see, i didnt use the List.First node before and that was the missing part, which i overlooked.