 |
CLIP Score: 24.33
from AIDL import *
def fancy_wine_glass(
base_radius: float = 2 * inches,
stem_height: float = 6 * inches,
bowl_radius: float = 3 * inches,
bowl_height: float = 5 * inches,
detail_gap: float = 0.5 * inches,
detail_height: float = 1 * inches,
detail_frequency: int = 10
):
"""
Creates a model of a fancy wine glass with a circular base, a cylindrical stem, and a bowl.
Adds engraving details to the bowl for a fancy look.
"""
# Create the main structure for the wine glass
wine_glass = Solid()
# Base of the wine glass
base = Solid()
wine_glass.base = base
base.disk = Circle((0, 0), base_radius)
# Stem of the wine glass
stem = Solid(shift=(0, base_radius)) # Place the stem on top of the base
wine_glass.stem = stem
stem.pillar = RoundedRectangle((0, stem_height / 2), base_radius / 3, stem_height, base_radius / 6)
# Bowl of the wine glass
bowl = Solid(shift=(0, stem_height + base_radius)) # Place the bowl on top of the stem
wine_glass.bowl = bowl
bowl_body = Solid() # This will hold the bowl body
bowl.body = bowl_body
# Create the bowl shape with a rounded top edge
bowl_body.outer = Circle((0, bowl_height / 2), bowl_radius)
bowl_body.inner_cutout = Hole()
bowl_body.inner_cutout.inner = Circle((0, bowl_height / 2 - detail_gap), bowl_radius - (base_radius / 3))
# Adding engraving details to the bowl
details = Drawing(shift=(0, stem_height + base_radius + bowl_height / 2 - detail_gap))
bowl.details = details
for i in range(detail_frequency):
angle = i * (360 / detail_frequency)
details.lines = Line(
(detail_gap * cos(radians(angle)), detail_gap/2 * sin(radians(angle))),
(bowl_radius * cos(radians(angle)), bowl_radius * sin(radians(angle)))
)
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 break down the creation of a fancy wine glass into steps. A typical wine glass has a base, a stem, and a bowl. We can also add some engraving details to make it "fancy."
Let's define our fancy wine glass in AIDL. Here's how we can approach it:
1. **Base**: Circular base with a certain radius.
2. **Stem**: A narrow cylinder connecting the base to the bowl.
3. **Bowl**: A wider cup-like structure at the top.
4. **Details**: Engraving around the bowl to add a fancy touch.
Let's start with the basic structure and build from there.
```python
from AIDL import *
def fancy_wine_glass(
base_radius: float = 2 * inches,
stem_height: float = 6 * inches,
bowl_radius: float = 3 * inches,
bowl_height: float = 5 * inches,
detail_gap: float = 0.5 * inches,
detail_height: float = 1 * inches,
detail_frequency: int = 10
):
"""
Creates a model of a fancy wine glass with a circular base, a cylindrical stem, and a bowl.
Adds engraving details to the bowl for a fancy look.
"""
# Create the main structure for the wine glass
wine_glass = Solid()
# Base of the wine glass
base = Solid()
wine_glass.base = base
base.disk = Circle((0, 0), base_radius)
# Stem of the wine glass
stem = Solid(shift=(0, base_radius)) # Place the stem on top of the base
wine_glass.stem = stem
stem.pillar = RoundedRectangle((0, stem_height / 2), base_radius / 3, stem_height, base_radius / 6)
# Bowl of the wine glass
bowl = Solid(shift=(0, stem_height + base_radius)) # Place the bowl on top of the stem
wine_glass.bowl = bowl
bowl_body = Solid() # This will hold the bowl body
bowl.body = bowl_body
# Create the bowl shape with a rounded top edge
bowl_body.outer = Circle((0, bowl_height / 2), bowl_radius)
bowl_body.inner_cutout = Hole()
bowl_body.inner_cutout.inner = Circle((0, bowl_height / 2 - detail_gap), bowl_radius - (base_radius / 3))
# Adding engraving details to the bowl
details = Drawing(shift=(0, stem_height + base_radius + bowl_height / 2 - detail_gap))
bowl.details = details
for i in range(detail_frequency):
angle = i * (360 / detail_frequency)
details.lines = Line(
(detail_gap * cos(radians(angle)), detail_gap/2 * sin(radians(angle))),
(bowl_radius * cos(radians(angle)), bowl_radius * sin(radians(angle)))
)
return wine_glass
with AIDL_2D:
model = fancy_wine_glass()
print(model.Solve())
model.Render()
```
### Explanation:
1. **Base**: A simple circle representing the base disk.
2. **Stem**: A rounded rectangle is used to represent the cylindrical stem.
3. **Bowl**: Constructed from two concentric circles representing the outer and inner parts of the bowl, with space for the details.
4. **Details**: Engraving lines are added in a radial pattern around the bowl to create a fancy look.
Feel free to modify any parameters or add extra details as required. If you have specific changes or additional elements you want to include, please let me know!
|