Applying the concept of Rhytm Wall.Direction to windows

Good morning, i created a script using the node Wall.Direction Rhytm in order to obtain the four orientations (North, South, West, East) and consequently color them. I am wondering if there is a way to apply the same concept also to the windows, because using the node FamilyInstance.HandOrientation i only obtain the vector with its components, and not a certain “text” associated to the vector, for example “N” “S” “W” “E”.

Thanks in advance if you can help me!

You could get a windows host (wall) and then obtain the wall orientation from that.

The only potential hangup I see is if the windows are flipped. This won’t account for that, but you can definitely build that out.

Thank you for your suggestion!
What i’m trying to do works really well on walls, because i can override the colors i have associated to them in Revit, but even using this method (if i’m not wrong) i can not associate the various “N” “S” ecc. to windows, but just to the host, which is the wall that i already have.
Is there a way to create a direct link between the four orientations and the windows themselves?

Thanks in advance for your help.

The screenshot I showed above does do it for windows. Give it a try. The only part missing is a “SetParameterByName” node for tying that data to the windows. I showed the green lines to show the relation…

Thank you very much!! In fact i was missing how to use those green lines in the script, now it works really well!