 |
CLIP Score: 31.66
from AIDL import *
def residential_house(
house_width: float = 50*feet,
house_height: float = 20*feet,
garage_width: float = 15*feet,
garage_height: float = 10*feet,
window_width: float = 4*feet,
window_height: float = 6*feet,
num_windows: int = 4,
):
"""
Model an architect's elevation of a residential house with a garage and windows.
"""
# Create the main structure of the house
house = Solid()
# Main building body
house.body = Rectangle((0, 0), house_width, house_height)
# Garage
garage = Solid(shift=(house_width / 4, -garage_height / 2))
house.garage = garage
garage.body = Rectangle((0, 0), garage_width, garage_height)
garage.door = Rectangle((0, 0), garage_width * 0.8, garage_height * 0.8)
# Windows
window_spacing = house_width / (num_windows + 1)
house.windows = []
for i in range(num_windows):
window = Solid(shift=(window_spacing * (i + 1) - house_width / 2, 0))
window.frame = Rectangle((0, 0), window_width, window_height)
window.pane_vertical = Line((-window_width/4, window_height/2), (-window_width/4, -window_height/2))
window.pane_horizontal = Line((-window_width/2, 0), (window_width/2, 0))
house.windows.append(window)
return house
with AIDL_2D:
model = residential_house()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a architect's elevation of a residential house with garage and windows
Sure! Let's go through the step-by-step creation of an AIDL program for an architect's elevation of a residential house, including a garage and windows. We'll consider the essential elements such as the building's outline, garage, windows, and any extra details you may want.
Here's a possible plan for structuring our model:
1. Create the main structure of the house.
2. Add the garage as a substructure.
3. Add windows as substructures.
4. Add any additional details such as doors or rooflines.
We'll start with the main components (house body, garage, windows), define their geometry, and then piece everything together. Let's proceed with the first step.
### Step 1: Define the House Body
We'll start by defining the main structure of the house.
```python
from AIDL import *
def residential_house(
house_width: float = 50*feet,
house_height: float = 20*feet,
garage_width: float = 15*feet,
garage_height: float = 10*feet,
window_width: float = 4*feet,
window_height: float = 6*feet,
num_windows: int = 4,
):
"""
Model an architect's elevation of a residential house with a garage and windows.
"""
# Create the main structure of the house
house = Solid()
# Main building body
house.body = Rectangle((0, 0), house_width, house_height)
# Garage
garage = Solid(shift=(house_width / 4, -garage_height / 2))
house.garage = garage
garage.body = Rectangle((0, 0), garage_width, garage_height)
garage.door = Rectangle((0, 0), garage_width * 0.8, garage_height * 0.8)
# Windows
window_spacing = house_width / (num_windows + 1)
house.windows = []
for i in range(num_windows):
window = Solid(shift=(window_spacing * (i + 1) - house_width / 2, 0))
window.frame = Rectangle((0, 0), window_width, window_height)
window.pane_vertical = Line((-window_width/4, window_height/2), (-window_width/4, -window_height/2))
window.pane_horizontal = Line((-window_width/2, 0), (window_width/2, 0))
house.windows.append(window)
return house
with AIDL_2D:
model = residential_house()
print(model.Solve())
model.Render()
```
### Explanation
1. **House Body**:
- The house body is created as a `Rectangle` and assigned to the `house.body`.
2. **Garage**:
- The garage is defined as a substructure `garage`.
- The garage's body is another `Rectangle`.
- A `Rectangle` representing the garage door is added to the garage.
3. **Windows**:
- Windows are added as a list `house.windows`.
- Each window is defined as a `Solid` with a `shift` equal to its position along the width of the house.
- Each window has a `frame` (Rectangle) and `pane` (Lines for the window panes).
### Running the Program
When you run this script, it will follow the defined structure to generate the elevation view of the residential house with the garage and windows.
Feel free to adjust the dimensions and add more details to the house structure as required. If you have any other specific adjustments or features you'd like to add, please let me know!
|