Window placement

Hello everyone
I am working on a set of 17 building typologies
the initial idea is that each apartment has two windows, one on the north facade and the other on the south facade
as I modeled, I realized that certain typologies cannot benefit from this arrangement of windows
so I’m looking if there is a possibility of building a script which goes in this direction of putting two windows in south and north as priority, and in cases where this is not possible, the script automatically puts these two windows in other directions
PS; although there are other apartments which only have one facade which faces the outside, so they will just have one window
I thank you in advance

WINDOW (253.2 KB)

since this is an architectural project - or so it seems - you should really base your window placement on the floorplan of each unit.
you can, for example, represent each space requiring a window by a single point placed, let’s say, at the center of the space, and use that point’s position to determine where to place the window. you can use ray casting to check if you can place a window on the north or south, then if that fails, you check for east/west.

Thank you very much for responding to me. Excuse me, I’m a beginner in grasshopper, I understood the idea you proposed to me, to find the window directions, but I don’t know how I can apply that, can I find a GH file that looks like my case?

Do you have the plan for one of the floors?

In fact I don’t work on architectural details like plans, my work focuses on urban building blocks, that just means the exterior geometric volume, so it’s just a volume of building which contains the window openings, as you see there are no doors or balconies or any kind of details … that’s why I’m really confused