 |
CLIP Score: 30.33
from AIDL import *
def house_elevation(
house_width: float = 40 * feet,
house_height: float = 20 * feet,
house_footprint: float = 30 * feet,
garage_width: float = 12 * feet,
garage_height: float = 10 * feet,
window_width: float = 4 * feet,
window_height: float = 4 * feet,
window_spacing: float = 10 * feet):
"""
Model of an architect's elevation of a house with a garage and windows.
"""
house = Solid()
garage = Solid(shift=(10*feet, 0)) # Shift the garage to be on the right side
windows = Solid()
house.garage = garage
house.windows = windows
# House body
house.body = Rectangle((0, 0), house_width, house_height)
# Garage
garage.garage_door = Rectangle((0, 0), garage_width, garage_height)
# Windows
num_windows = int(house_width // window_spacing)
for i in range(num_windows):
window_x = (i * window_spacing) - (house_width / 2) + (window_spacing / 2)
window_y = house_height / 4 # Place windows at 1/4 the height from bottom
window = Solid(shift=(window_x, window_y))
window.frame = Rectangle((0, 0), window_width, window_height)
window.panes = [
Line((-window_width / 2, 0), (window_width / 2, 0)), # Horizontal divider
Line((0, -window_height / 2), (0, window_height / 2)) # Vertical divider
]
windows.__setattr__(f'window_{i}', window)
return house
with AIDL_2D:
model = house_elevation()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a architect's elevation of a residential house with garage and windows
To create an architect's elevation of a residential house with a garage and windows in AIDL, we'll have to represent the key structural elements and details. Here's a step-by-step guide to generate the program:
### Step-by-Step Guide
1. **Define the main structure of the house including the walls.**
2. **Add the garage structure with the garage door opening.**
3. **Add windows at specified locations on the house.**
4. **Ensure we have proper drawing elements to represent window frames and other details.**
Let’s start with the program:
```python
from AIDL import *
def house_elevation(
house_width: float = 40 * feet,
house_height: float = 20 * feet,
house_footprint: float = 30 * feet,
garage_width: float = 12 * feet,
garage_height: float = 10 * feet,
window_width: float = 4 * feet,
window_height: float = 4 * feet,
window_spacing: float = 10 * feet):
"""
Model of an architect's elevation of a house with a garage and windows.
"""
house = Solid()
garage = Solid(shift=(10*feet, 0)) # Shift the garage to be on the right side
windows = Solid()
house.garage = garage
house.windows = windows
# House body
house.body = Rectangle((0, 0), house_width, house_height)
# Garage
garage.garage_door = Rectangle((0, 0), garage_width, garage_height)
# Windows
num_windows = int(house_width // window_spacing)
for i in range(num_windows):
window_x = (i * window_spacing) - (house_width / 2) + (window_spacing / 2)
window_y = house_height / 4 # Place windows at 1/4 the height from bottom
window = Solid(shift=(window_x, window_y))
window.frame = Rectangle((0, 0), window_width, window_height)
window.panes = [
Line((-window_width / 2, 0), (window_width / 2, 0)), # Horizontal divider
Line((0, -window_height / 2), (0, window_height / 2)) # Vertical divider
]
windows.__setattr__(f'window_{i}', window)
return house
with AIDL_2D:
model = house_elevation()
print(model.Solve())
model.Render()
```
### Explanation
1. **House Structure:**
- A rectangle to represent the main body/outline of the house.
2. **Garage Structure:**
- A rectangle to represent the garage door, and it's shifted to an appropriate position on the x-axis.
3. **Windows:**
- Multiple rectangles spaced evenly across the front face of the house for windows.
- Each window has additional lines to represent window panes/dividers.
4. **Shift Reference:**
- Both the garage and windows are shifted relative to the house’s main body to place them correctly.
This will generate a simple but clear 2D elevation of a house with a garage and evenly spaced windows. Adjust the dimensions and window placements to match specific requirements as needed.
|