Roof Orientation

Hi Everyone,

Is there a way to grab the top face of a sloped roof, get the roofs center normal vector, then determine if that faces N,S,E,W,NWN,NEN etc based off true north, and write that to a parameter? I have got a compass creation node that can create a 16 point compass, but I am struggling to get the appropriate Vector for the roof.
Image below, need to analyze top face and determine the direction that it is pointing. I have done this successfully with walls, windows and doors. Roofs seem to be quite tricky?
Example

Mitch

  1. Break it down into faces.
  2. Get the surfaces with the largest area and discard the rest using a Surface.Area node, a 3) List.SortByKey and a method for grabbing the last two items in the list.
  3. Get the normals at the 0.5,0.5 parameter of those two faces.
  4. Discard the vector with a negative Z value. The resulting vector is your roofs facing normal.
  5. Compare the X and Y values of that vector to your compass angles using an angle about axis node.
  6. you may have to subtract any values over 180 from 360 to get the correct value. A code block like ang > 180 ? 360 - ang : ang; will help there.
  7. Sort the compass orientation vectors by this value and you have your facing orientation.

You may want to break your roof down some into multiple sub vectors. Roofs with multiple vectors have been a thing for quite awhile.

2 Likes

Hi Jacob,

Worked perfectly, thank you so much!! really appreciate the helpful breakdown!

2 Likes