 |
CLIP Score: 25.75
from AIDL import *
def fancy_wine_glass(base_radius: float = 2.5*inches,
stem_height: float = 4*inches,
bowl_radius: float = 2.5*inches,
bowl_height: float = 5*inches):
# Define the main structure of the wine glass
wine_glass = Assembly()
# Base - Circular and flat
base = Solid(shift=(0, 0))
base.geometry = Circle((0, 0), base_radius)
wine_glass.base = base
# Stem - Thin and long, connecting base to bowl
stem = Solid(shift=(0, stem_height))
stem.geometry = Rectangle((0, 0), width=base_radius / 3, height=stem_height, axis_aligned=True)
wine_glass.stem = stem
# Bowl - Elliptical shape
bowl = Solid(shift=(0, stem_height + bowl_height / 2))
bowl_body_top = Arc((0, 0), start_angle=-90, end_angle=90, radius=bowl_radius)
bowl_body_bottom = Line((bowl_radius, 0), (-bowl_radius, 0))
# Add bowl geometry to wine_glass
wine_glass.bowl_top = Solid()
wine_glass.bowl_bottom = Solid()
wine_glass.bowl_top.arc = bowl_body_top
wine_glass.bowl_bottom.line = bowl_body_bottom
# Decorative Patterns
decoration = Drawing(shift=(0, stem_height + bowl_height / 2))
decoration.lines = [Line((0, i * bowl_height / 5), (bowl_radius, -i * bowl_height / 5)) for i in range(1, 4)]
wine_glass.decoration = decoration
# Combine the components
wine_glass.bowl = bowl
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, let's do it step-by-step. Wine glasses typically consist of these main parts:
1. **Base**: The bottom part where the glass rests.
2. **Stem**: The thin part that connects the base to the bowl.
3. **Bowl**: The main body of the glass where the wine is contained.
4. **Rim**: The top edge of the bowl.
We'll start by defining the dimensions and structure of each part. After that, we'll work on combining these parts into a single model.
Let's start by defining the overall function and breaking it down into the different components:
```python
from AIDL import *
def fancy_wine_glass(base_radius: float = 2.5*inches,
stem_height: float = 4*inches,
bowl_radius: float = 2.5*inches,
bowl_height: float = 5*inches):
# Define the main structure of the wine glass
wine_glass = Assembly()
# Base - Circular and flat
base = Solid(shift=(0, 0))
base.geometry = Circle((0, 0), base_radius)
wine_glass.base = base
# Stem - Thin and long, connecting base to bowl
stem = Solid(shift=(0, stem_height))
stem.geometry = Rectangle((0, 0), width=base_radius / 3, height=stem_height, axis_aligned=True)
wine_glass.stem = stem
# Bowl - Elliptical shape
bowl = Solid(shift=(0, stem_height + bowl_height / 2))
bowl_body_top = Arc((0, 0), start_angle=-90, end_angle=90, radius=bowl_radius)
bowl_body_bottom = Line((bowl_radius, 0), (-bowl_radius, 0))
wine_glass.bowl_top = Solid()
wine_glass.bowl_bottom = Solid()
wine_glass.bowl_top.arc = bowl_body_top
wine_glass.bowl_bottom.line = bowl_body_bottom
# Combine the components
wine_glass.bowl = bowl
return wine_glass
with AIDL_2D:
model = fancy_wine_glass()
print(model.Solve())
model.Render()
```
This initial code sets up a wine glass with:
1. **Base**: A solid circular base.
2. **Stem**: A solid rectangular stem.
3. **Bowl**: Currently defined as an arc and line combination.
Now let's refine the bowl into a more fancy shape and engrave some decorative patterns on it. To engrave patterns, we will use the `Drawing` structure.
I'll add some decorative lines to make the wine glass fancy:
```python
from AIDL import *
def fancy_wine_glass(base_radius: float = 2.5*inches,
stem_height: float = 4*inches,
bowl_radius: float = 2.5*inches,
bowl_height: float = 5*inches):
# Define the main structure of the wine glass
wine_glass = Assembly()
# Base - Circular and flat
base = Solid(shift=(0, 0))
base.geometry = Circle((0, 0), base_radius)
wine_glass.base = base
# Stem - Thin and long, connecting base to bowl
stem = Solid(shift=(0, stem_height))
stem.geometry = Rectangle((0, 0), width=base_radius / 3, height=stem_height, axis_aligned=True)
wine_glass.stem = stem
# Bowl - Elliptical shape
bowl = Solid(shift=(0, stem_height + bowl_height / 2))
bowl_body_top = Arc((0, 0), start_angle=-90, end_angle=90, radius=bowl_radius)
bowl_body_bottom = Line((bowl_radius, 0), (-bowl_radius, 0))
# Add bowl geometry to wine_glass
wine_glass.bowl_top = Solid()
wine_glass.bowl_bottom = Solid()
wine_glass.bowl_top.arc = bowl_body_top
wine_glass.bowl_bottom.line = bowl_body_bottom
# Decorative Patterns
decoration = Drawing(shift=(0, stem_height + bowl_height / 2))
decoration.lines = [Line((0, i * bowl_height / 5), (bowl_radius, -i * bowl_height / 5)) for i in range(1, 4)]
wine_glass.decoration = decoration
# Combine the components
wine_glass.bowl = bowl
return wine_glass
with AIDL_2D:
model = fancy_wine_glass()
print(model.Solve())
model.Render()
```
This code does the following:
1. **Base**: Defines a circular base.
2. **Stem**: Adds a thin rectangle stem.
3. **Bowl**: Shapes the bowl using an arc and a line.
4. **Decoration**: Engraves some lines on the bowl to make it fancy.
Feel free to guide me if you have any specific refinements or additional details you want to include!
|