 |
CLIP Score: 31.64
from AIDL import *
def chair(
seat_width: float = 16*inches,
seat_depth: float = 16*inches,
seat_height: float = 18*inches,
backrest_height: float = 12*inches,
leg_thickness: float = 2*inches
):
"""
Model a simple chair with four legs, a seat, and a backrest.
"""
chair = Solid()
# Define the four legs
legs = Solid()
chair.legs = legs
legs.left_front = Solid(shift=(-seat_width/2 + leg_thickness/2, seat_depth/2 - leg_thickness/2))
legs.right_front = Solid(shift=(seat_width/2 - leg_thickness/2, seat_depth/2 - leg_thickness/2))
legs.left_back = Solid(shift=(-seat_width/2 + leg_thickness/2, -seat_depth/2 + leg_thickness/2))
legs.right_back = Solid(shift=(seat_width/2 - leg_thickness/2, -seat_depth/2 + leg_thickness/2))
# Define the geometry for the legs
for leg in [legs.left_front, legs.right_front, legs.left_back, legs.right_back]:
leg.shape = Rectangle((0, -seat_height/2), leg_thickness, seat_height)
# Define the seat
seat = Solid(shift=(0, -seat_height/2))
chair.seat = seat
seat.shape = Rectangle((0, 0), seat_width, seat_depth)
# Define the backrest
backrest = Solid(shift=(0, -seat_height/2 - backrest_height/2, -seat_depth/2 + leg_thickness/2))
chair.backrest = backrest
backrest.shape = Rectangle((0, 0), seat_width, backrest_height)
return chair
with AIDL_2D:
model = chair()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a chair
Sure! Let's start by specifying the main features of the chair. Here is a simple chair design in mind:
1. **Legs**: Four legs, each represented as a rectangular profile.
2. **Seat**: A rectangular seat.
3. **Backrest**: A rectangular backrest.
Now I will write an AIDL program to generate this chair.
We'll start by defining the basic parameters for the chair (like seat dimensions, leg height, and backrest height).
```python
from AIDL import *
def chair(
seat_width: float = 16*inches,
seat_depth: float = 16*inches,
seat_height: float = 18*inches,
backrest_height: float = 12*inches,
leg_thickness: float = 2*inches
):
"""
Model a simple chair with four legs, a seat, and a backrest.
"""
chair = Solid()
# Define the four legs
legs = Solid()
chair.legs = legs
legs.left_front = Solid(shift=(-seat_width/2 + leg_thickness/2, seat_depth/2 - leg_thickness/2))
legs.right_front = Solid(shift=(seat_width/2 - leg_thickness/2, seat_depth/2 - leg_thickness/2))
legs.left_back = Solid(shift=(-seat_width/2 + leg_thickness/2, -seat_depth/2 + leg_thickness/2))
legs.right_back = Solid(shift=(seat_width/2 - leg_thickness/2, -seat_depth/2 + leg_thickness/2))
# Define the geometry for the legs
for leg in [legs.left_front, legs.right_front, legs.left_back, legs.right_back]:
leg.shape = Rectangle((0, -seat_height/2), leg_thickness, seat_height)
# Define the seat
seat = Solid(shift=(0, -seat_height/2))
chair.seat = seat
seat.shape = Rectangle((0, 0), seat_width, seat_depth)
# Define the backrest
backrest = Solid(shift=(0, -seat_height/2 - backrest_height/2, -seat_depth/2 + leg_thickness/2))
chair.backrest = backrest
backrest.shape = Rectangle((0, 0), seat_width, backrest_height)
return chair
with AIDL_2D:
model = chair()
print(model.Solve())
model.Render()
```
This AIDL program models a simple chair with four legs, a seat, and a backrest. If you would like to refine or add additional features to the chair, please let me know, and I'll be happy to make further modifications!
|