 |
CLIP Score: 32.9
from AIDL import *
def residential_house_with_garage(
house_width: float = 20 * feet,
house_height: float = 16 * feet,
roof_height: float = 6 * feet,
garage_width: float = 10 * feet,
garage_height: float = 12 * feet,
window_width: float = 3 * feet,
window_height: float = 4 * feet,
num_windows: int = 4 # Number of windows on the house
):
"""
Model an architect's elevation of a residential house with a garage and windows.
"""
# Define the main structure: house with garage
house = Solid()
garage = Solid(shift=(house_width / 2 + garage_width / 2, -(house_height / 2 - garage_height / 2)))
house.garage = garage
# Define the house body geometry
house_body = Rectangle((0, 0), house_width, house_height)
house.body = house_body
# Define the roof geometry
roof = Triangle((0, house_height / 2 + roof_height / 2), house_width, roof_height)
house.roof = roof
# Define the garage body geometry
garage_body = Rectangle((0, 0), garage_width, garage_height)
garage.body = garage_body
# Define windows on the house body
house_windows = []
window_spacing = house_width / (num_windows + 1)
for i in range(num_windows):
window_x = -house_width / 2 + (i + 1) * window_spacing
window = Rectangle((window_x, 0), window_width, window_height)
house_windows.append(window)
house.windows = house_windows
# Optionally, define a window on the garage body (commented out for simplicity)
# garage_window = Rectangle((0, 0), window_width, window_height)
# garage.window = garage_window
return house
with AIDL_2D:
model = residential_house_with_garage()
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 create an AIDL program to generate an architect's elevation of a residential house with a garage and windows. For simplicity, we'll assume a basic rectangular house with a pitched roof, a garage attached on one side, and a few windows distributed along the house.
Here's a step-by-step breakdown of what we need to do:
1. **Define the dimensions and general layout:**
- House dimensions (height, width)
- Roof dimensions (height)
- Garage dimensions (height, width)
- Window dimensions (height, width)
- Number and placement of windows
2. **Create the main house structure:**
- Body of the house
- Roof of the house
3. **Add the garage:**
- Body of the garage
4. **Add windows to the house and garage:**
- Multiple windows on the house body
- Optionally, windows on the garage body
Let's proceed with the AIDL program:
```python
from AIDL import *
def residential_house_with_garage(
house_width: float = 20 * feet,
house_height: float = 16 * feet,
roof_height: float = 6 * feet,
garage_width: float = 10 * feet,
garage_height: float = 12 * feet,
window_width: float = 3 * feet,
window_height: float = 4 * feet,
num_windows: int = 4 # Number of windows on the house
):
"""
Model an architect's elevation of a residential house with a garage and windows.
"""
# Define the main structure: house with garage
house = Solid()
garage = Solid(shift=(house_width / 2 + garage_width / 2, -(house_height / 2 - garage_height / 2)))
house.garage = garage
# Define the house body geometry
house_body = Rectangle((0, 0), house_width, house_height)
house.body = house_body
# Define the roof geometry
roof = Triangle((0, house_height / 2 + roof_height / 2), house_width, roof_height)
house.roof = roof
# Define the garage body geometry
garage_body = Rectangle((0, 0), garage_width, garage_height)
garage.body = garage_body
# Define windows on the house body
house_windows = []
window_spacing = house_width / (num_windows + 1)
for i in range(num_windows):
window_x = -house_width / 2 + (i + 1) * window_spacing
window = Rectangle((window_x, 0), window_width, window_height)
house_windows.append(window)
house.windows = house_windows
# Optionally, define a window on the garage body (commented out for simplicity)
# garage_window = Rectangle((0, 0), window_width, window_height)
# garage.window = garage_window
return house
with AIDL_2D:
model = residential_house_with_garage()
print(model.Solve())
model.Render()
```
### Explanation:
1. **House and Garage Structures**:
- The `house` and `garage` are defined as `Solid` structures. The `garage` is shifted to the right of the `house`.
2. **Body Geometry**:
- `Rectangle` is used to define the main body of the house and the garage.
3. **Roof Geometry**:
- A `Triangle` is used to define the pitched roof of the house.
4. **Windows**:
- Windows are represented by `Rectangle` geometries and distributed along the width of the house. They are added to the `house` as a list of windows.
Using this code, you can adjust the parameters to customize the dimensions and layout of the residential house and garage. If you need further modifications or additions, feel free to describe them, and we can update the program accordingly.
|