Get surface area by orientation per room

I’m trying to get a more efficient way to do my code. I would like to not repeat the same code 8 times!

My goal is to have the surface area of walls for all of my eight orientation (N, NE, E, SE, S, SW, W ,NW) per room as shown with the excel file. This is currently what i am exporting.

My code :
I have a list of surface orientation per room and a list of surface area per room. (1)
I get all the indices of my orientations. (2)
If the list is empty (3), i fill list with the exact amount of 0. (4)
If not empty i fill the list with the surface area of that orientation. (5)
I sum the areas per room per orientation (6).
Finaly i join my lists to later transpose.

Thank you

Consider something like this:

  • To each orientation sublist, add N/NE/E…NW. In the corresponding wall area list, add an equivalent amount of 0s. This step is to facilitate the export later (filling in all of the ‘zero’ entries)

  • You can now GroupByKey the wall areas, using the Orientation list as the keys. Then, math.sum the grouped sublists.

  • For each room, you should now have two lists: N/NE/E…BW, and a corresponding equal list of areas. You can sort the sublists so that the ordering is consistent for the export step.

It worked perfectly!

Thank you @Robert_Younger

Can you share your dyn. file if it’s possible? I’m tyring to calculate room surface area including walls, structural elements, floors etc. and your file can help me.