 |
CLIP Score: 27.9
from AIDL import *
def cabinet_with_drawers(
cabinet_width: float = 24 * inches,
cabinet_height: float = 36 * inches,
drawer_width: float = 22 * inches,
drawer_height: float = 6 * inches,
drawer_depth: float = 20 * inches
):
"""
Model a side view of a cabinet with drawers opening in opposite directions.
"""
# Create the Cabinet Assembly node
cabinet = Assembly()
# Create the Cabinet Body Solid
cabinet.body = Solid()
cabinet.body.structure = Rectangle((0, 0), cabinet_width, cabinet_height)
# Create the top Drawer Solid (opens to the right)
top_drawer = Solid(shift=(cabinet_width / 2 - drawer_width / 2, cabinet_height / 2 - drawer_height * 1.5))
top_drawer.front_panel = Rectangle((0, 0), drawer_width, drawer_height)
# Create the bottom Drawer Solid (opens to the left)
bottom_drawer = Solid(shift=(-cabinet_width / 2 + drawer_width / 2, -cabinet_height / 2 + drawer_height * 1.5))
bottom_drawer.front_panel = Rectangle((0, 0), drawer_width, drawer_height)
# Add Drawers to Cabinet Body
cabinet.body.top_drawer = top_drawer
cabinet.body.bottom_drawer = bottom_drawer
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 break down the design of a cabinet with drawers in opposite directions. This will involve creating an assembly for the cabinet structure and individual solids for the drawers. Let's consider the following parameters:
1. **Overall cabinet dimensions:** width, height, and depth.
2. **Drawer dimensions:** width, height, and depth.
3. **Drawer positions:** specified by their horizontal and vertical shifts from the cabinet's origin.
Here is a step-by-step outline of how we will structure the AIDL program:
1. Define the cabinet’s assembly structure.
2. Define the cabinet’s main solid body and the holes for drawers.
3. Define the drawers as separate solids.
4. Position the drawers within the cabinet with opposite orientations.
5. Solve and render the model.
Let's proceed with writing the AIDL program:
```python
from AIDL import *
def cabinet_with_drawers(
cabinet_width: float = 24 * inches,
cabinet_height: float = 36 * inches,
drawer_width: float = 22 * inches,
drawer_height: float = 6 * inches,
drawer_depth: float = 20 * inches
):
"""
Model a side view of a cabinet with drawers opening in opposite directions.
"""
# Create the Cabinet Assembly node
cabinet = Assembly()
# Create the Cabinet Body Solid
cabinet.body = Solid()
cabinet.body.structure = Rectangle((0, 0), cabinet_width, cabinet_height)
# Create the top Drawer Solid (opens to the right)
top_drawer = Solid(shift=(cabinet_width / 2 - drawer_width / 2, cabinet_height / 2 - drawer_height * 1.5))
top_drawer.front_panel = Rectangle((0, 0), drawer_width, drawer_height)
# Create the bottom Drawer Solid (opens to the left)
bottom_drawer = Solid(shift=(-cabinet_width / 2 + drawer_width / 2, -cabinet_height / 2 + drawer_height * 1.5))
bottom_drawer.front_panel = Rectangle((0, 0), drawer_width, drawer_height)
# Add Drawers to Cabinet Body
cabinet.body.top_drawer = top_drawer
cabinet.body.bottom_drawer = bottom_drawer
return cabinet
with AIDL_2D:
model = cabinet_with_drawers()
print(model.Solve())
model.Render()
```
Here’s a breakdown of the code:
1. We define the cabinet dimensions and drawer dimensions as parameters.
2. We create an Assembly `cabinet` to represent the overall cabinet.
3. Within the `cabinet`, we create a `Solid` node `body` to represent the cabinet structure and define its geometry using a Rectangle.
4. We create two `Solid` nodes for the drawers, `top_drawer` and `bottom_drawer`, each having a Rectangle geometry.
5. The `top_drawer` is positioned to open to the right, and the `bottom_drawer` is positioned to open to the left by defining their shifts relative to the cabinet’s origin.
6. We add the drawers to the cabinet body at the specified positions.
7. Finally, we solve and render the model.
This program generates a side view of a cabinet with drawers opening in opposite directions.
|