Combine Lists with Sublists

I am trying to sort elements into sublists, but I am having trouble with the last step:

The goal is to create a list with Air Handling Units that supply air to Zones that contain Spaces. In this case, AHU-1 supplies the East and North Zones, and AHU-2 supplies the South Zone. The East Zone contains Spaces 7 and 11, and so on. The List.Transpose in the middle shows the Spaces categorized by Zones.

How do I combine these lists? I have spent hours trying to find the appropriate thread on this forum, but I can’t find one that matches up with what I’m trying to do. I swear I have tried every combination of List.Create, List.AddItemToEnd, List.AddItemToFront, List.Join, and every other thing I can think of.

Ideally, I would like to solve this problem without using any external packages. I have to distribute this software to users who I can’t guarantee will all be using the same packages.

Hi @ALeavitt,

Welcome to the Dynamo community.

Not sure how exactly you need the output to be but answer to your question lies in utilizing the Levels (@L2, @@L2, etc that you see on the nodes) on your the lists with the nodes you have been using and then flattening the list at desired levels in the end as shown below:

Good Luck!


Thank you! That did it! I’ll admit, no matter how much I try to wrap my head around levels in lists, it always seems like I wind up resorting to trial and error. You provided the exact solution and explained it very clearly. Now I just have to figure out what the heck I was doing, because after a few hours of tinkering, this script is a mess.

1 Like

@ALeavitt We all have been there when it comes to levels. Keep at it and you would very soon have your aha moment.

1 Like