 |
CLIP Score: 28.55
from AIDL import *
def cabinet_with_drawers(
cabinet_width: float = 24 * inches,
cabinet_height: float = 36 * inches,
drawer_width: float = 20 * inches,
drawer_height: float = 10 * inches,
drawer_depth: float = 18 * inches,
drawer_gap: float = 2 * inches
):
"""
Generates a side view of a cabinet with two drawers extending in opposite directions.
"""
# Define the main cabinet body
cabinet = Solid()
# Define the drawers
drawer_left = Solid(shift=(-drawer_depth / 2, drawer_gap + drawer_height / 2))
drawer_right = Solid(shift=(drawer_depth / 2, -drawer_gap - drawer_height / 2))
# Add the drawers to the cabinet
cabinet.drawer_left = drawer_left
cabinet.drawer_right = drawer_right
# Define the cabinet body geometry
cabinet.body = Rectangle((0, 0), cabinet_width, cabinet_height)
# Define the geometry of the drawer cut-outs in the cabinet body
drawer_cutout_left = Hole()
drawer_cutout_right = Hole()
cabinet.drawer_cutout_left = drawer_cutout_left
cabinet.drawer_cutout_right = drawer_cutout_right
drawer_cutout_left.cutout = Rectangle((0, drawer_gap), drawer_width, drawer_height)
drawer_cutout_right.cutout = Rectangle((0, -drawer_gap), drawer_width, drawer_height)
# Define the drawer geometries
drawer_left.body = Rectangle((0, 0), drawer_depth, drawer_height)
drawer_right.body = Rectangle((0, 0), drawer_depth, drawer_height)
return cabinet
with AIDL_2D:
model = cabinet_with_drawers()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a side view of cabinet with drawers in opposite directions
Sure, let's write an AIDL program to generate a side view of a simple cabinet with drawers extending in opposite directions. The cabinet will have a rectangular body with two drawers: one drawer will extend out to the right and the other to the left.
Here’s the step-by-step approach:
1. Create the main cabinet body as a `Solid`.
2. Create cut-outs (holes) for the drawers in the cabinet body.
3. Create the drawers as separate `Solid` structures.
4. Position the drawers such that they extend in opposite directions.
Let's define the program:
```python
from AIDL import *
def cabinet_with_drawers(
cabinet_width: float = 24 * inches,
cabinet_height: float = 36 * inches,
drawer_width: float = 20 * inches,
drawer_height: float = 10 * inches,
drawer_depth: float = 18 * inches,
drawer_gap: float = 2 * inches
):
"""
Generates a side view of a cabinet with two drawers extending in opposite directions.
"""
# Define the main cabinet body
cabinet = Solid()
# Define the drawers
drawer_left = Solid(shift=(-drawer_depth / 2, drawer_gap + drawer_height / 2))
drawer_right = Solid(shift=(drawer_depth / 2, -drawer_gap - drawer_height / 2))
# Add the drawers to the cabinet
cabinet.drawer_left = drawer_left
cabinet.drawer_right = drawer_right
# Define the cabinet body geometry
cabinet.body = Rectangle((0, 0), cabinet_width, cabinet_height)
# Define the geometry of the drawer cut-outs in the cabinet body
drawer_cutout_left = Hole()
drawer_cutout_right = Hole()
cabinet.drawer_cutout_left = drawer_cutout_left
cabinet.drawer_cutout_right = drawer_cutout_right
drawer_cutout_left.cutout = Rectangle((0, drawer_gap), drawer_width, drawer_height)
drawer_cutout_right.cutout = Rectangle((0, -drawer_gap), drawer_width, drawer_height)
# Define the drawer geometries
drawer_left.body = Rectangle((0, 0), drawer_depth, drawer_height)
drawer_right.body = Rectangle((0, 0), drawer_depth, drawer_height)
return cabinet
with AIDL_2D:
model = cabinet_with_drawers()
print(model.Solve())
model.Render()
```
In this program:
- The main cabinet is created as a `Solid` structure.
- Two drawers (`drawer_left` and `drawer_right`) are defined as `Solid` structures and positioned accordingly.
- `Hole` structures are created for the drawer cut-outs to create space for the drawers in the cabinet.
- Rectangular geometries are used for both the cabinet body and the drawers.
- Proper shifts are applied to position the drawers extending in opposite directions.
If you have specific details or additional features you'd like to include, please let me know, and we can refine the program further.
|