 |
CLIP Score: 31.12
from AIDL import *
def house_elevation(
house_width: float = 30 * feet,
house_height: float = 20 * feet,
garage_width: float = 12 * feet,
garage_height: float = 10 * feet,
window_width: float = 3 * feet,
window_height: float = 4 * feet,
num_windows: int = 4
):
house = Solid()
# Define the garage as a sub-structure
garage = Solid(shift=(-house_width/4, 0))
house.garage = garage
# Define window array as a sub-structure
windows = [Solid() for _ in range(num_windows)]
house.windows = windows
# Add Constraints between structures
house.AddConstraint(garage.bb.bottom == house.bb.bottom)
house.AddConstraint(garage.bb.height == garage_height)
house.AddConstraint(garage.bb.width == garage_width)
# Position windows equidistant on the house facade
for i, window in enumerate(windows):
window_shift = (-house_width/2 + window_width/2 + (house_width / num_windows) * i, house_height / 3)
window.shift = window_shift
house.AddConstraint(window.bb.width == window_width)
house.AddConstraint(window.bb.height == window_height)
house.AddConstraint(window.bb.vertical_center == house.bb.vertical_center)
# Geometry definitions
house.wall = Rectangle((0,0), house_width, house_height)
garage.door = Rectangle((0,0), garage_width, garage_height)
for i, window in enumerate(windows):
window.geometry = Rectangle((0,0), window_width, window_height)
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
Alright, let's break down the task step-by-step to create the architect's elevation of a residential house with a garage and windows. We'll start by defining the main structural components and then add the necessary constraints and geometry.
### Step 1: Define the Structure Hierarchy
We'll create a `Solid` structure for the house, and within it, create sub-structures for the garage and windows.
```python
from AIDL import *
def house_elevation(
house_width: float = 30 * feet,
house_height: float = 20 * feet,
garage_width: float = 12 * feet,
garage_height: float = 10 * feet,
window_width: float = 3 * feet,
window_height: float = 4 * feet,
num_windows: int = 4
):
house = Solid()
# Define the garage as a sub-structure
garage = Solid(shift=(-house_width/4, 0))
house.garage = garage
# Define window array as a sub-structure
windows = [Solid() for _ in range(num_windows)]
house.windows = windows
return house
with AIDL_2D:
model = house_elevation()
print(model.Solve())
model.Render()
```
### Step 2: Add Constraints Between Structures
Now, we will position and size the garage and windows relative to the house.
```python
from AIDL import *
def house_elevation(
house_width: float = 30 * feet,
house_height: float = 20 * feet,
garage_width: float = 12 * feet,
garage_height: float = 10 * feet,
window_width: float = 3 * feet,
window_height: float = 4 * feet,
num_windows: int = 4
):
house = Solid()
# Define the garage as a sub-structure
garage = Solid(shift=(-house_width/4, 0))
house.garage = garage
# Define window array as a sub-structure
windows = [Solid() for _ in range(num_windows)]
house.windows = windows
# Add Constraints between structures
house.AddConstraint(garage.bb.bottom == house.bb.bottom)
house.AddConstraint(garage.bb.height == garage_height)
house.AddConstraint(garage.bb.width == garage_width)
# Position windows equidistant on the house facade
for i, window in enumerate(windows):
window_shift = (-house_width/2 + window_width/2 + (house_width / num_windows) * i, house_height / 3)
window.shift = window_shift
house.AddConstraint(window.bb.width == window_width)
house.AddConstraint(window.bb.height == window_height)
house.AddConstraint(window.bb.vertical_center == house.bb.vertical_center)
return house
with AIDL_2D:
model = house_elevation()
print(model.Solve())
model.Render()
```
### Step 3: Define Geometry for Each Structure
We'll add rectangles for the house wall, garage, and windows.
```python
from AIDL import *
def house_elevation(
house_width: float = 30 * feet,
house_height: float = 20 * feet,
garage_width: float = 12 * feet,
garage_height: float = 10 * feet,
window_width: float = 3 * feet,
window_height: float = 4 * feet,
num_windows: int = 4
):
house = Solid()
# Define the garage as a sub-structure
garage = Solid(shift=(-house_width/4, 0))
house.garage = garage
# Define window array as a sub-structure
windows = [Solid() for _ in range(num_windows)]
house.windows = windows
# Add Constraints between structures
house.AddConstraint(garage.bb.bottom == house.bb.bottom)
house.AddConstraint(garage.bb.height == garage_height)
house.AddConstraint(garage.bb.width == garage_width)
# Position windows equidistant on the house facade
for i, window in enumerate(windows):
window_shift = (-house_width/2 + window_width/2 + (house_width / num_windows) * i, house_height / 3)
window.shift = window_shift
house.AddConstraint(window.bb.width == window_width)
house.AddConstraint(window.bb.height == window_height)
house.AddConstraint(window.bb.vertical_center == house.bb.vertical_center)
# Geometry definitions
house.wall = Rectangle((0,0), house_width, house_height)
garage.door = Rectangle((0,0), garage_width, garage_height)
for i, window in enumerate(windows):
window.geometry = Rectangle((0,0), window_width, window_height)
return house
with AIDL_2D:
model = house_elevation()
print(model.Solve())
model.Render()
```
### Step 4: Add Additional Details (Optional)
You can add more detailed geometry like doors, roof, etc., using similar steps outlined above, also ensuring that constraints are carefully applied to maintain proper proportions and positions.
This completes a basic elevation of a residential house with a garage and windows using AIDL. If you need to include more specific details or features, please let me know and I can help you further.
|