# Max. envelope of a planned building - sunlight provision to context buildings

Hello,

I am fairly new to LB HB. Currently I work on my masters degree (architecture) project.
Law in my country states that for a residental buildings at least 3h of sunlight (on 21 March and 21 September, between 7.00 - 17.00) should be provided for at least one room of each flat. Although this is not very precise, usually it is calculated for middle point of the window.

Having a site boundary curve and context buildings (with windows) I would like to find out what is the “boundary” that shows where and how high i could build an office building (something like solar envelope), still providing enough hours of sunlinght to residental buildings around. Because i do not know which window belongs to which flat, I decided that mentioned condition has to be met for each window.

I know LB offers solar envelope - but as far as I understand, it takes into account context boundary curve and creates geometry that doesnt shade it in given analysis period. That wouldn’t work for me - I need to check each window in context buildings and make sure that 3h is provided between 10 and 17 (on 21.03 and 21.10). That means it can for example be 10.00-10.30; 12.00-12.30; 16.00-17.00.

I tried using LB sunlight hours + galapagos for that. I divided site surface into subsurfaces and then extruded them with sliders (ranging from 0 to 160m, as this would be max height for that site) - to maximize the volume giving a penalty function (subtract a big number - ex. 100000 from fitness, each time 3h of sunlight is not provided for a window. Unfortunately each time i tried solver stuck in local minima - it never found a solution where each window has at least 3h (and they did without any context).

Next step would be to somehow check the maximum envelope i could build (maybe something like solar envelope or voxels i would cull?). I seriously do not know how to approach that and would like to ask you for an advice - maybe someone tried to do something similar or has a good idea on how to approach that problem. I will be very grateful for your suggestions.

Sorry for such a long post, have a nice weekend.

Hi @Wujo, See this topic and the reply: SunPath

Hello Mostapha, that seems to be exactly what I need. Thank you very much

Hi Mostapha!
Could you share GH file with me?