 |
CLIP Score: 27.08
from AIDL import *
def fancy_wine_glass(
base_diameter: float = 3*inches,
stem_height: float = 4*inches,
bowl_height: float = 5*inches,
bowl_top_diameter: float = 3*inches,
bowl_bottom_diameter: float = 1*inch,
):
"""
Creates a fancy wine glass with a circular base, slender stem, and rounded bowl.
"""
wine_glass = Solid()
# Create the base
base = Solid(shift=(0, 0))
wine_glass.base = base
base.circle = Circle((0, 0), base_diameter / 2)
# Create the stem
stem = Solid(shift=(0, stem_height/2))
wine_glass.stem = stem
stem.rectangle = Rectangle((0, 0), base_diameter/4, stem_height)
# Create the bowl
bowl = Solid(shift=(0, stem_height + bowl_height/2))
wine_glass.bowl = bowl
bowl_bottom_circle = Circle((0, -bowl_height/2), bowl_bottom_diameter / 2)
bowl_top_circle = Circle((0, bowl_height/2), bowl_top_diameter / 2)
bowl_left_arc = Arc((0, 0), bowl_bottom_circle.center, (-bowl_top_diameter/4, bowl_height/2))
bowl_right_arc = Arc((0, 0), (bowl_top_diameter/4, bowl_height/2), bowl_bottom_circle.center)
bowl.bottom_circle = bowl_bottom_circle
bowl.top_circle = bowl_top_circle
bowl.left_arc = bowl_left_arc
bowl.right_arc = bowl_right_arc
return wine_glass
with AIDL_2D:
model = fancy_wine_glass()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a fancy wine glass
Sure, I'd be happy to help you write an AIDL program for creating a fancy wine glass! Let's break down the elements of a typical wine glass:
1. **Base**: A circular base to provide stability.
2. **Stem**: A slender cylindrical stem connecting the base to the bowl.
3. **Bowl**: The main part of the glass that holds the wine. This could be a compound shape of circles and arcs.
We'll make assumptions about standard dimensions for a typical wine glass:
- Base diameter: 3 inches
- Stem height: 4 inches
- Bowl height: 5 inches
- Bowl top diameter: 3 inches
- Bowl bottom diameter (where it meets the stem): 1 inch
Here is a detailed AIDL script to create the wine glass:
```python
from AIDL import *
def fancy_wine_glass(
base_diameter: float = 3*inches,
stem_height: float = 4*inches,
bowl_height: float = 5*inches,
bowl_top_diameter: float = 3*inches,
bowl_bottom_diameter: float = 1*inch,
):
"""
Creates a fancy wine glass with a circular base, slender stem, and rounded bowl.
"""
wine_glass = Solid()
# Create the base
base = Solid(shift=(0, 0))
wine_glass.base = base
base.circle = Circle((0, 0), base_diameter / 2)
# Create the stem
stem = Solid(shift=(0, stem_height/2))
wine_glass.stem = stem
stem.rectangle = Rectangle((0, 0), base_diameter/4, stem_height)
# Create the bowl
bowl = Solid(shift=(0, stem_height + bowl_height/2))
wine_glass.bowl = bowl
bowl_bottom_circle = Circle((0, -bowl_height/2), bowl_bottom_diameter / 2)
bowl_top_circle = Circle((0, bowl_height/2), bowl_top_diameter / 2)
bowl_left_arc = Arc((0, 0), bowl_bottom_circle.center, (-bowl_top_diameter/4, bowl_height/2))
bowl_right_arc = Arc((0, 0), (bowl_top_diameter/4, bowl_height/2), bowl_bottom_circle.center)
bowl.bottom_circle = bowl_bottom_circle
bowl.top_circle = bowl_top_circle
bowl.left_arc = bowl_left_arc
bowl.right_arc = bowl_right_arc
return wine_glass
with AIDL_2D:
model = fancy_wine_glass()
print(model.Solve())
model.Render()
```
In this program:
- The base is a circle with a radius half of the `base_diameter`.
- The stem is represented as a rectangle in the center of the base and extending upwards.
- The bowl consists of a bottom circle, a top circle, and two arcs forming the sides, giving it a curved shape.
Feel free to adjust the dimensions and shapes as needed. If you have any specific design features or any feedback on the program, please let me know!
|