noconstraints/side view of cabinet with drawers in opposite directions/side view of cabinet with drawers in opposite directions6


CLIP Score: 31.61

Image

Program

Conversation

side view of cabinet with drawers in opposite directions6 image
                
from AIDL import *

def cabinet_with_drawers(
    cabinet_width: float = 24 * inches, 
    cabinet_height: float = 36 * inches, 
    cabinet_depth: float = 18 * inches,
    drawer_height: float = 10 * inches,
    drawer_depth: float = 17 * inches
):
    """
    Create a side view model of a cabinet with drawers opening in opposite directions.
    """

    cabinet = Solid()
    left_drawer_hole = Hole(shift=(-cabinet_depth/2 + drawer_depth/2, drawer_height))
    right_drawer_hole = Hole(shift=(cabinet_depth/2 - drawer_depth/2, -drawer_height))

    left_drawer = Solid(shift=(-cabinet_depth/2 + drawer_depth/2, drawer_height))
    right_drawer = Solid(shift=(cabinet_depth/2 - drawer_depth/2, -drawer_height))

    cabinet.left_drawer_hole = left_drawer_hole
    cabinet.right_drawer_hole = right_drawer_hole

    cabinet.left_drawer = left_drawer
    cabinet.right_drawer = right_drawer

    # Define the main cabinet body geometry
    cabinet.body = Rectangle((0, 0), cabinet_width, cabinet_height)

    # Define the drawer holes, they are determined to be inside the cabinet body
    left_drawer_hole.cutout = Rectangle((0, 0), drawer_depth, drawer_height)
    right_drawer_hole.cutout = Rectangle((0, 0), drawer_depth, drawer_height)

    # Define the drawers as rectangles
    left_drawer.body = Rectangle((0, 0), drawer_depth, drawer_height)
    right_drawer.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 walk through the steps needed to create a model of a cabinet with drawers that open in opposite directions. We'll assume some basic design parameters for simplicity and go from there.

Here's an overview of the steps:

1. Define the main cabinet structure as a Solid.
2. Add drawer holes (negative space) to simulate the drawer storage.
3. Add individual drawers as Solid nodes that are positioned to fit into the drawer holes.

Let’s start with the code:

```python
from AIDL import *

def cabinet_with_drawers(
    cabinet_width: float = 24 * inches, 
    cabinet_height: float = 36 * inches, 
    cabinet_depth: float = 18 * inches,
    drawer_height: float = 10 * inches,
    drawer_depth: float = 17 * inches
):
    """
    Create a side view model of a cabinet with drawers opening in opposite directions.
    """

    cabinet = Solid()
    left_drawer_hole = Hole(shift=(-cabinet_depth/2 + drawer_depth/2, drawer_height))
    right_drawer_hole = Hole(shift=(cabinet_depth/2 - drawer_depth/2, -drawer_height))

    left_drawer = Solid(shift=(-cabinet_depth/2 + drawer_depth/2, drawer_height))
    right_drawer = Solid(shift=(cabinet_depth/2 - drawer_depth/2, -drawer_height))

    cabinet.left_drawer_hole = left_drawer_hole
    cabinet.right_drawer_hole = right_drawer_hole

    cabinet.left_drawer = left_drawer
    cabinet.right_drawer = right_drawer

    # Define the main cabinet body geometry
    cabinet.body = Rectangle((0, 0), cabinet_width, cabinet_height)

    # Define the drawer holes, they are determined to be inside the cabinet body
    left_drawer_hole.cutout = Rectangle((0, 0), drawer_depth, drawer_height)
    right_drawer_hole.cutout = Rectangle((0, 0), drawer_depth, drawer_height)

    # Define the drawers as rectangles
    left_drawer.body = Rectangle((0, 0), drawer_depth, drawer_height)
    right_drawer.body = Rectangle((0, 0), drawer_depth, drawer_height)

    return cabinet

with AIDL_2D:
    model = cabinet_with_drawers()
print(model.Solve())
model.Render()
```

### Explanation:

- The function `cabinet_with_drawers` defines the model. It takes several parameters: the overall dimensions of the cabinet and drawers.
- The `cabinet` is a `Solid` node that holds the entire structure.
- We define `left_drawer_hole` and `right_drawer_hole` as `Hole` nodes, each shifted appropriately to their positions.
- We also define `left_drawer` and `right_drawer` as `Solid` nodes, each shifted to their positions.
- The main cabinet body is defined as a rectangle.
- The drawer holes are defined as rectangles inside the cabinet body.
- The drawers themselves are also defined as rectangles.

Feel free to adjust the dimensions and additional design features as needed. Let me know if you have any further requirements or adjustments!