# Detect correct wall orientation

Hello guys
I got stuck with my wall orientation, I am trying to detect the wall orientation of a building. But every time I got some wall in the opposite direction. I revised all the topics similar to these questions but the problem remains still. Any suggestion?
See below as an example

Try using a Vector.AngleAboutAxis node: (https://dictionary.dynamobim.com/#/Geometry/Vector/Action/AngleAboutAxis). Take the angle about the Z axis, and use the X axis as your other vector. Feed that into a codeblock along the lines of Math.Ceiling(a/45)and you can then group your content by those values, build a dictionary from the sublists & key combinations (turn the key to a string before using it as the key input for the dictionary), and pull values at the side of each compass angle ([8,1],[2,3],[4,5],[6,7]).

Give it a shot and let us know where you get.

Thank you sir for ur reply, I am afraid I am new in dynamo and most of custom code I did following graphs or tutorial. I tried to follow your suggestion but unfortunately I stuck I couldn’t catch what u mean. It will be my pleasure if you share a screen shoot as example to understand more.

Can you post what you tried? I am away from my CPU so it’ll be a bit before I can respond, and I find people retain it better if they work it out themselves and much of my reason for being involved in the forum is to help others grow in this space.

1 Like

so far this what I could understand from your suggestion, sorry I knew I have a lot to learn

As a start, remove the lines - those aren’t helpoing you here. The ‘vector’ input into the Vector.AngleAboutAxis should be the facing direction pulled from your list of walls (sounded like you had that worked out - if search the forum, there are a few good posts about that).

From there use a division node to divide by 45. Then a Math.Ceiling node to round up to the next whole number. Then use that value as the key, and your list of walls will be the list in a List.GroupByKey node.

1 Like

I will give it a shot and update it later, thank u sir so ever much

I think something appears with a good result, am I right?

Hi @Beltagy,

Maybe this example on the Orchid Github page can point you in the right direction.
https://github.com/erfajo/OrchidForDynamo/blob/master/Samples/Dynamo_2.x.x/Elements/Exterior%20Direction.png

1 Like

Pretty good! Now you just need to gather the lists into a dictionary, using the unique keys as the value. Be sure to set the values as @L3 with longest lacing. From there you can use a single code block node and some design script to pull the right values in the order you want them.
East = dict[[“8”,“1”]];
South = dict[[“2”,“3”]];
West = dict[[“4”,“5”]];
North= dict[[“6”,“7”]];

WHAT I miss here?

Dictionary.ByKeysValues node in between. The keys are the unique keys from the List.GroupByKey node, and the values are the lists from the List.GroupByKey node.

That feeds into the dict input on the code block, and you’re done.

Try @L3 for the list input. Let me know what the error message is if that doesn’t work.

It gives error and null result in List by groupByKey
I tried many options several times but the results are the same.