 |
CLIP Score: 33.39
from AIDL import *
def cabinet_with_drawers(
cabinet_width: float = 24 * inch,
cabinet_height: float = 36 * inch,
cabinet_depth: float = 18 * inch,
num_drawers: int = 3,
drawer_width: float = 22 * inch,
drawer_height: float = 10 * inch,
drawer_depth: float = 16 * inch
):
"""
Create a side view of a cabinet with drawers that open in opposite directions.
"""
# Define the model structure. The cabinet has multiple drawer substructures.
cabinet = Solid()
drawers = [Solid() for _ in range(num_drawers)]
cabinet.drawers = drawers
# Define the body of the cabinet as a rectangle.
cabinet.body = Rectangle((0, cabinet_height / 2), cabinet_depth, cabinet_height)
# Define each drawer's position and geometry.
# Drawers open in opposite directions.
for i, drawer in enumerate(drawers):
shift_y = cabinet_height / 2 - (i * drawer_height + drawer_height / 2)
if i % 2 == 0: # Left-open drawer
shift_x = (-cabinet_depth / 2) - (drawer_depth / 2)
drawer.shift = (shift_x, shift_y)
drawer.front = Rectangle((0, 0), drawer_depth, drawer_height)
else: # Right-open drawer
shift_x = (cabinet_depth / 2) + (drawer_depth / 2)
drawer.shift = (shift_x, shift_y)
drawer.front = 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
Absolutely, let's get started on writing an AIDL program to generate the side view of a cabinet with drawers that open in opposite directions.
Here's the plan:
1. Define the overall structure of the cabinet using Solid nodes.
2. Add drawers as separate Solid nodes, positioned appropriately relative to the cabinet.
3. Each drawer will have its front face displayed, with one side aligned for left-open and other for right-open.
I'll assume the cabinet dimensions and drawer dimensions to be as follows:
- Cabinet Width: 24 inches
- Cabinet Height: 36 inches
- Cabinet Depth: 18 inches
- Number of Drawers: 3
- Drawer Width: 22 inches
- Drawer Height: 10 inches
- Drawer Depth: 16 inches
Let's define these dimensions using defaults and then construct the cabinet model.
Here's the complete AIDL program:
```python
from AIDL import *
def cabinet_with_drawers(
cabinet_width: float = 24 * inch,
cabinet_height: float = 36 * inch,
cabinet_depth: float = 18 * inch,
num_drawers: int = 3,
drawer_width: float = 22 * inch,
drawer_height: float = 10 * inch,
drawer_depth: float = 16 * inch
):
"""
Create a side view of a cabinet with drawers that open in opposite directions.
"""
# Define the model structure. The cabinet has multiple drawer substructures.
cabinet = Solid()
drawers = [Solid() for _ in range(num_drawers)]
cabinet.drawers = drawers
# Define the body of the cabinet as a rectangle.
cabinet.body = Rectangle((0, cabinet_height / 2), cabinet_depth, cabinet_height)
# Define each drawer's position and geometry.
# Drawers open in opposite directions.
for i, drawer in enumerate(drawers):
shift_y = cabinet_height / 2 - (i * drawer_height + drawer_height / 2)
if i % 2 == 0: # Left-open drawer
shift_x = (-cabinet_depth / 2) - (drawer_depth / 2)
drawer.shift = (shift_x, shift_y)
drawer.front = Rectangle((0, 0), drawer_depth, drawer_height)
else: # Right-open drawer
shift_x = (cabinet_depth / 2) + (drawer_depth / 2)
drawer.shift = (shift_x, shift_y)
drawer.front = Rectangle((0, 0), drawer_depth, drawer_height)
return cabinet
with AIDL_2D:
model = cabinet_with_drawers()
print(model.Solve())
model.Render()
```
In this program:
1. `cabinet_with_drawers` is a function that sets up the cabinet and drawer design.
2. The cabinet's body is a simple rectangle.
3. We create multiple Solid nodes for drawers. These nodes are then set with appropriate shifts for alternating left and right drawers.
4. In the end, each drawer's front face is represented by a rectangle.
Let me know if you need any modifications or additional features for the cabinet!
|