Select top or bottom face of an amount of volumes


I have a bunch of volumes, representing buildings. There could be thousands of them. I need to select their top faces or bottom faces.

I got help from @miauu with something similar over here: Extract shape from selected polygon (script request)

Could someone please help me rewriting that script to do a Select Top Faces and Select Bottom Faces?



Thank you very much!
I thought I had looked all over the internet. Apparently I missed this one. :expressionless:

This script works good for me. If I set the angle to 95 (or less than 175) everything else beside the bottom faces are selected and I can invert to reach those. :+1: