Based on the project1 - the Unity Temple, my topic is window width changing. During the design process, we may met the situation that we know the certain plan areas, sometimes which need mutiple changing, certain lighting levels for different rooms based on the functions or directions, and also we want to keep the elevation uniform; which means, keep the constructions and heights of windows the same, change their widths.
In this project, for example, place five same windows into five rooms as shown in the figure1.
Figure 1: the original windows |
Start from the region 2, I'll get objects. I choose ID of each window and write the lines five times by changing the ID numbers. Then, I need create the five rooms element IDs. Fot the other regions and every operations, I type them five times. The formula used here is window width = room area * 0.3 (lighting coefficient, assumption) / 6 (height of the window).
Figure 2 & 3: code |
Here has two problems. First, there is too much repetition work. I can use "loop" to solve it. Second, when the room is too depth, more lighting needed, then the width of window may exceed the width of the room which make an error. So the width of a window should be changed in a range, limited by the maximum of the room width. The formula is to make it choose the smaller one between the caculate result and the width of room substract the wall width.
Figure 4: loop |
Figure 5: interface |
Figure 6 & 7: result |