List structure and flatten problem

Hi Community

 

Im new to Dynamo and struggling with some list problems.

 

Im looking for a flattening solution for the following problem:

 

 

my XYZs output of an intersection event has a structure like this:

 

 

A

 

#B

 

##C (1 point)

 

##C1 (1 point)

 

##C2 (1 point)

 

...

 

#B1

 

##C0 (1 point)

 

##C1 (1 point)

 

##C2 (1 point)

 

 

 

What i actually need is a structure where all C lists are merged to one

 

and empty lists will be deleted (flatten from right to left):

 

 

A

 

#B (12 points)

 

#B1 (8 points)

 

 

But when I tried the flatten component in Dynamo, it gives me a structure like this (flatten from left to right):

 

 

B1

 

#C1

 

B2

 

#C1

 

B3

 

#C1

 

 

 

 

 

 

 

I hope you understand my problem and give me some hints to find a solution.

 

Thanks in Advance

 

Chris

 

map and combine are awesome. Check out the samples in Help>Samples>24 Lists>Passing Functions

that is exactly the solution i was looking for! thank you very much

I think I understand the issue, but not sure. If you want to flatten the contents of each "B" list, you can use a Map node and a Flatten Completely. Map acts to "do this to all of these", passing a function (or "node operation") to all the things in a sequence.