noconstraints/cabinet/cabinet9


CLIP Score: 29.43

Image

Program

Conversation

cabinet9 image
                
from AIDL import *

def cabinet(
        width: float = 24 * inches,
        depth: float = 18 * inches,
        height: float = 36 * inches,
        shelf_thickness: float = 0.5 * inches,
        back_panel_thickness: float = 0.25 * inches,
        door_thickness: float = 0.75 * inches,
        shelf_count: int = 3
):
    """
    Creates a simple cabinet model with specified dimensions and shelf count.
    """
    # Create the main cabinet structure `cabinet`
    cabinet = Solid()

    # The base
    base = Solid()
    base.base_plate = Rectangle((0, 0), width, depth)
    cabinet.base = base

    # The sides
    side_left = Solid(shift=(-width / 2, height / 2))
    side_right = Solid(shift=(width / 2, height / 2))
    side_left.panel = Rectangle((0, 0), depth, height)
    side_right.panel = Rectangle((0, 0), depth, height)
    cabinet.side_left = side_left
    cabinet.side_right = side_right

    # The back panel
    back_panel = Solid(shift=(0, height / 2))
    back_panel.panel = Rectangle((0, 0), width, height)
    cabinet.back_panel = back_panel

    # The top panel
    top_panel = Solid(shift=(0, height))
    top_panel.panel = Rectangle((0, 0), width, depth)
    cabinet.top_panel = top_panel

    # The shelves
    shelf_height_interval = height / (shelf_count + 1)
    shelves = []
    for i in range(1, shelf_count + 1):
        shelf = Solid(shift=(0, i * shelf_height_interval))
        shelf.panel = Rectangle((0, 0), width, depth)
        shelves.append(shelf)

    cabinet.shelves = shelves

    # The doors
    door_left = Solid(shift=(-width / 4, height / 2, door_thickness))
    door_right = Solid(shift=(width / 4, height / 2, door_thickness))
    door_left.panel = Rectangle((0, 0), width / 2, height)
    door_right.panel = Rectangle((0, 0), width / 2, height)
    cabinet.door_left = door_left
    cabinet.door_right = door_right

    return cabinet


with AIDL_2D:
    model = cabinet()
print(model.Solve())
model.Render()

                
                Please write an AIDL program to generate a cabinet

Sure! Let's break down how we can model a simple cabinet using the AIDL language. A basic cabinet will typically have a few key components:

1. **Base**: The bottom part upon which the cabinet stands.
2. **Sides**: The left and right panels.
3. **Back Panel**: The rear panel.
4. **Top Panel**: The lid or top cover.
5. **Shelves**: The horizontal dividers inside the cabinet.
6. **Doors**: The front panels that open and close.

We'll start with these components, and add holes for shelves and doors.

Here is the AIDL program for generating a simple cabinet:

```python
from AIDL import *

def cabinet(
        width: float = 24 * inches,
        depth: float = 18 * inches,
        height: float = 36 * inches,
        shelf_thickness: float = 0.5 * inches,
        back_panel_thickness: float = 0.25 * inches,
        door_thickness: float = 0.75 * inches,
        shelf_count: int = 3
):
    """
    Creates a simple cabinet model with specified dimensions and shelf count.
    """
    # Create the main cabinet structure `cabinet`
    cabinet = Solid()

    # The base
    base = Solid()
    base.base_plate = Rectangle((0, 0), width, depth)
    cabinet.base = base

    # The sides
    side_left = Solid(shift=(-width / 2, height / 2))
    side_right = Solid(shift=(width / 2, height / 2))
    side_left.panel = Rectangle((0, 0), depth, height)
    side_right.panel = Rectangle((0, 0), depth, height)
    cabinet.side_left = side_left
    cabinet.side_right = side_right

    # The back panel
    back_panel = Solid(shift=(0, height / 2))
    back_panel.panel = Rectangle((0, 0), width, height)
    cabinet.back_panel = back_panel

    # The top panel
    top_panel = Solid(shift=(0, height))
    top_panel.panel = Rectangle((0, 0), width, depth)
    cabinet.top_panel = top_panel

    # The shelves
    shelf_height_interval = height / (shelf_count + 1)
    shelves = []
    for i in range(1, shelf_count + 1):
        shelf = Solid(shift=(0, i * shelf_height_interval))
        shelf.panel = Rectangle((0, 0), width, depth)
        shelves.append(shelf)

    cabinet.shelves = shelves

    # The doors
    door_left = Solid(shift=(-width / 4, height / 2, door_thickness))
    door_right = Solid(shift=(width / 4, height / 2, door_thickness))
    door_left.panel = Rectangle((0, 0), width / 2, height)
    door_right.panel = Rectangle((0, 0), width / 2, height)
    cabinet.door_left = door_left
    cabinet.door_right = door_right

    return cabinet


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

This AIDL program defines a cabinet with parameterized dimensions. You can customize the `width`, `depth`, `height`, `shelf_thickness`, `back_panel_thickness`, `door_thickness`, and the number of `shelf_count`. The model includes base, side panels, back panel, top panel, shelves, and doors.
  
Please let me know if there are any specific features or additional components you would like to add to this cabinet model!