## aidl/side view of cabinet with drawers in opposite directions/side view of cabinet with drawers in opposite directions1

### Image | ### Program | ### Conversation

###
CLIP Score: 31.4

    from AIDL import *

    def cabinet_with_opposite_drawers(
            cabinet_width: float = 48 * inches,
            cabinet_height: float = 24 * inches,
            drawer_width: float = 18 * inches,
            drawer_height: float = 8 * inches,
    ):
        # Define the main structure of the cabinet
        cabinet = Solid()
        body = Solid()
        drawer_left = Solid()
        drawer_right = Solid()

        cabinet.body = body
        cabinet.drawer_left = drawer_left
        cabinet.drawer_right = drawer_right

        # Define the geometry for the cabinet body (simple rectangle)
        body.structure = Rectangle((0,0), cabinet_width, cabinet_height)

        # Define the geometry for the drawers
        drawer_left.structure = Rectangle((0,0), drawer_width, drawer_height)
        drawer_right.structure = Rectangle((0,0), drawer_width, drawer_height)

        # Adding constraints
        cabinet.AddConstraint(drawer_left.bb.left == body.bb.left)  # Align left drawer to the left edge
        cabinet.AddConstraint(drawer_left.bb.vertical_center == body.bb.vertical_center)  # Vertically center left drawer
        cabinet.AddConstraint(drawer_right.bb.right == body.bb.right)  # Align right drawer to the right edge
        cabinet.AddConstraint(drawer_right.bb.vertical_center == body.bb.vertical_center)  # Vertically center right drawer

        return cabinet

    with AIDL_2D:
        model = cabinet_with_opposite_drawers()
    print(model.Solve())
    model.Render()
                    Please write an AIDL program to generate a side view of cabinet with drawers in opposite directions

    Sure! We'll follow a structured approach to develop the AIDL program for generating a side view of a cabinet with drawers in opposite directions. Let's break it down step by step:

    1. **Defining the Structure of the Cabinet:**
        - The cabinet will have a body with two drawers.
        - The drawers will be positioned in opposite directions horizontally.

    2. **Adding Constraints:**
        - Ensure drawers are placed correctly within the cabinet.
        - Align the drawers' edges with the cabinet body edges as necessary.

    3. **Defining the Geometry:**
        - Use simple geometric objects to define the shapes (rectangles for the cabinet body and drawers).

    Let's start with the function definition:

    ### Cabinet with Opposite Drawers:

    ```python
    from AIDL import *

    def cabinet_with_opposite_drawers(
            cabinet_width: float = 48 * inches,
            cabinet_height: float = 24 * inches,
            drawer_width: float = 18 * inches,
            drawer_height: float = 8 * inches,
    ):
        # Define the main structure of the cabinet
        cabinet = Solid()
        body = Solid()
        drawer_left = Solid()
        drawer_right = Solid()

        cabinet.body = body
        cabinet.drawer_left = drawer_left
        cabinet.drawer_right = drawer_right

        # Define the geometry for the cabinet body (simple rectangle)
        body.structure = Rectangle((0,0), cabinet_width, cabinet_height)

        # Define the geometry for the drawers
        drawer_left.structure = Rectangle((0,0), drawer_width, drawer_height)
        drawer_right.structure = Rectangle((0,0), drawer_width, drawer_height)

        # Adding constraints
        cabinet.AddConstraint(drawer_left.bb.left == body.bb.left)  # Align left drawer to the left edge
        cabinet.AddConstraint(drawer_left.bb.vertical_center == body.bb.vertical_center)  # Vertically center left drawer
        cabinet.AddConstraint(drawer_right.bb.right == body.bb.right)  # Align right drawer to the right edge
        cabinet.AddConstraint(drawer_right.bb.vertical_center == body.bb.vertical_center)  # Vertically center right drawer

        return cabinet

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

    ### Explanation

    - **Structure Definition:** We define the main parts of the cabinet: the body, left drawer, and right drawer.
    - **Geometry Definition:** We use rectangles to represent the cabinet body and drawers.
    - **Constraints:** We position the drawers within the cabinet body by aligning the left drawer to the left and the right drawer to the right. Both drawers are vertically centered.

    Please review this initial implementation and let me know if we need any modifications or if there are additional constraints or features you would like to add!