I want to know if someone can help me please to create a script to calculate the pourcentage of windows and wall exterior area for each Unit
I have a project of 250 residential units and i need to calculate for each unit % Windows vs Wall
Hello and welcome to the forum!
First up, this isn’t a great ‘first graph’ to tackle as it’s got a complex data structure and will require a good amount of grouping, sorting, and filtering. Hopefully you’re ready to take on a challenge or are ‘new to the forum but not new to computational design’. Either way the community will be able to help periodically if you post your attempts and enough insight for us to see where you’re going. I’m going to assume you can easily collect the rooms which you’re after as a starting point, so…
From your list of the rooms to analyze, try working along these steps:
- Use the Room.Boundaries node (Clockwork package) to get the bounding elements of each room.
- Get the category for each bounding element
- Filter out bounding elements which are not walls using a comparison to the associated category.
- Get the type of the included walls from the resulting category filter.
- Get the use parameter from the list of wall types.
- Filter out walls which are not exterior use from the filtered bounding elements (step 3’s ‘in’ output) using a comparison to the use parameters.
- Get the Element ID of the exterior wall elements which remain in the list.
- Get the Element ID of the bounding elements (step 1)
- Get the index of the exterior IDs in the bounding elements list
- Get the boundary lines of the room using a List.GetItemAtIndex node.
- If your walls are plumb and a consistent height in each room, multiply the room’s height by the length of each exterior boundary line (step 10); if not get the room geometry, explode it to base surfaces, filter out the floor and ceiling surfaces using the Z component of their normal, filter the remaining wall surfaces by including only surfaces which intersect with the boundary lines, and finally get the area of each and sum the values. This is your exterior wall area for each room.
- Create a dictionary of areas by the associated room IDs.
- Get all the windows in the project.
- Get the room which each window is in using a Window.Rooms node (Clockwork package).
- Get the Element ID of the window’s rooms
- Get the area of each window using whatever parameter fits your project.
- Group the window area by their associated room ID.
- Sum the sublists of window areas into a single value. This is the area of windows in each room.
- Use the “unique keys” from the group by key node (step 17) to find the room associated with each window area.
- Use the unique keys to pull the relevant exterior wall area from the dictionary or exterior wall areas by room (12)
- If you went with the multiplication of curve length and height in step 11 divide the window areas (step 19) by the exterior wall areas (step 11) to get the % of the exterior envelope which is a window. If you went the geometry route, divide the window area by the sum of the window area and the exterior wall area to get the desired value.
- To do the analysis by ‘unit’ instead of room, get the IDs from the unique keys (this list is still ordered), and use a Element.ByID node (Clockwork) to get the rooms, get which unit each room is in, group the window areas (step 18) and room areas (11) by these values, sum them, and repeat a version of step 21 to get the percentage of exterior envelope which is a window in each unit. Alternatively you could just select your rooms by unit early on instead of trying to process all rooms, sum the window and exterior wall values before performing the analysis in step 21 and use the result as the % for that unit. Note that this means you’ll need to run the graph 250 times though, so there is a degree of scale which is desirable the other way. Also alternatively you could assign the values of the window and exterior envelope to values int eh room, and then use a room schedule to update the calculations.