## noconstraints/sunglasses/sunglasses9

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

###
CLIP Score: 27.34

    from AIDL import *

    def sunglasses(
            lens_radius: float = 1.5 * inches,
            bridge_width: float = 0.5 * inch,
            temple_length: float = 5 * inches,
            temple_width: float = 0.2 * inch,
            frame_thickness: float = 0.1 * inch
    ):
        """
        Creates a simple model of round sunglasses.
        """

        # Define the structure nodes
        sunglasses = Assembly()
        frame = Solid()
        lenses = Assembly()
        left_temple = Solid()
        right_temple = Solid()

        # Attach the structures to the sunglasses assembly
        sunglasses.frame = frame
        sunglasses.lenses = lenses
        sunglasses.left_temple = left_temple
        sunglasses.right_temple = right_temple

        # Create the left rim of the frame
        left_rim = Solid()
        frame.left_rim = left_rim

        left_rim.outer_circle = Circle((0, 0), lens_radius + frame_thickness)
        left_rim.inner_circle = Hole()
        left_rim.inner_circle.disk = Circle((0, 0), lens_radius)

        # Create the right rim of the frame
        right_rim = Solid(shift=(2 * lens_radius + bridge_width, 0))
        frame.right_rim = right_rim

        right_rim.outer_circle = Circle((0, 0), lens_radius + frame_thickness)
        right_rim.inner_circle = Hole()
        right_rim.inner_circle.disk = Circle((0, 0), lens_radius)

        # Create the bridge connecting the rims
        bridge = Solid()
        frame.bridge = bridge

        bridge.left_curve = Arc((-bridge_width / 2, 0), (-(lens_radius + frame_thickness), 0), (-(lens_radius + frame_thickness), -bridge_width / 2))
        bridge.right_curve = Arc((bridge_width / 2, 0), (lens_radius + frame_thickness, 0), (lens_radius + frame_thickness, -bridge_width / 2))
        bridge.bottom_line = Line(bridge.left_curve.end, bridge.right_curve.end)

        # Create the lenses
        left_lens = Solid()
        lenses.left_lens = left_lens
        left_lens.disk = Circle((0, 0), lens_radius)

        right_lens = Solid(shift=(2 * lens_radius + bridge_width, 0))
        lenses.right_lens = right_lens
        right_lens.disk = Circle((0, 0), lens_radius)

        # Create the left temple
        left_temple.shift = (-lens_radius - frame_thickness, -lens_radius)
        left_temple.shape = Rectangle((0, 0), temple_width, temple_length)

        # Create the right temple
        right_temple.shift = (2 * lens_radius + bridge_width + lens_radius + frame_thickness, -lens_radius)
        right_temple.shape = Rectangle((0, 0), temple_width, temple_length)

        return sunglasses

    with AIDL_2D:
        model = sunglasses()
    print(model.Solve())
    model.Render()
                    Please write an AIDL program to generate a sunglasses

    Let's start by outlining the design of the sunglasses. Sunglasses typically consist of the following main parts:

    1. **Frame**: This includes two rims holding the lenses and a bridge connecting them.
    2. **Lenses**: The parts of the sunglasses that cover and protect the eyes.
    3. **Temples**: The arms of the sunglasses that extend to the ears.

    To simplify, we'll design basic round sunglasses with a frame, lenses, and temples. We will treat the sunglasses as a main assembly node and build smaller substructures for each component.

    Here is the AIDL program to generate a pair of sunglasses:

    ```python
    from AIDL import *

    def sunglasses(
            lens_radius: float = 1.5 * inches,
            bridge_width: float = 0.5 * inch,
            temple_length: float = 5 * inches,
            temple_width: float = 0.2 * inch,
            frame_thickness: float = 0.1 * inch
    ):
        """
        Creates a simple model of round sunglasses.
        """

        # Define the structure nodes
        sunglasses = Assembly()
        frame = Solid()
        lenses = Assembly()
        left_temple = Solid()
        right_temple = Solid()

        # Attach the structures to the sunglasses assembly
        sunglasses.frame = frame
        sunglasses.lenses = lenses
        sunglasses.left_temple = left_temple
        sunglasses.right_temple = right_temple

        # Create the left rim of the frame
        left_rim = Solid()
        frame.left_rim = left_rim

        left_rim.outer_circle = Circle((0, 0), lens_radius + frame_thickness)
        left_rim.inner_circle = Hole()
        left_rim.inner_circle.disk = Circle((0, 0), lens_radius)

        # Create the right rim of the frame
        right_rim = Solid(shift=(2 * lens_radius + bridge_width, 0))
        frame.right_rim = right_rim

        right_rim.outer_circle = Circle((0, 0), lens_radius + frame_thickness)
        right_rim.inner_circle = Hole()
        right_rim.inner_circle.disk = Circle((0, 0), lens_radius)

        # Create the bridge connecting the rims
        bridge = Solid()
        frame.bridge = bridge

        bridge.left_curve = Arc((-bridge_width / 2, 0), (-(lens_radius + frame_thickness), 0), (-(lens_radius + frame_thickness), -bridge_width / 2))
        bridge.right_curve = Arc((bridge_width / 2, 0), (lens_radius + frame_thickness, 0), (lens_radius + frame_thickness, -bridge_width / 2))
        bridge.bottom_line = Line(bridge.left_curve.end, bridge.right_curve.end)

        # Create the lenses
        left_lens = Solid()
        lenses.left_lens = left_lens
        left_lens.disk = Circle((0, 0), lens_radius)

        right_lens = Solid(shift=(2 * lens_radius + bridge_width, 0))
        lenses.right_lens = right_lens
        right_lens.disk = Circle((0, 0), lens_radius)

        # Create the left temple
        left_temple.shift = (-lens_radius - frame_thickness, -lens_radius)
        left_temple.shape = Rectangle((0, 0), temple_width, temple_length)

        # Create the right temple
        right_temple.shift = (2 * lens_radius + bridge_width + lens_radius + frame_thickness, -lens_radius)
        right_temple.shape = Rectangle((0, 0), temple_width, temple_length)

        return sunglasses

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

    This program defines a basic model of sunglasses. Here's a brief breakdown of the key parts:

    - **Frame**: Created from two Solid nodes (one for each rim) and an additional Solid node for the bridge connecting the rims.
    - **Lenses**: Two Solid nodes representing the left and right lenses.
    - **Temples**: Two Rectangle geometries representing the left and right temples.

    Adjusting the parameters (such as `lens_radius`, `bridge_width`, `temple_length`, etc.) can help customize the design of the sunglasses to meet different specifications.