Grouping surfaces by elevation

i am currently looking at how i could group together surfaces based on their elevation (north / south / east / west). i currently have it setup to get the normal direction of the surface but this only works for a simplistic box. Where the floor plate is more complex this method fails.

Any suggestions?

Example model below:

Normal is the way to do it.

Remove the Z component first, and then I believe you would want to sort by a if the angle between the flat vector and the X axis vector, Y axis Vector, -X axis, and -Y axis should do the trick.