 |
CLIP Score: 25.72
from AIDL import *
def fancy_wine_glass(base_radius=2*inches,
stem_height=6*inches,
bowl_diameter=4*inches,
bowl_height=5*inches):
"""
Create a model of a fancy wine glass with an engraved bowl.
"""
# Create the root structure of the wine glass
wine_glass = Solid()
# Define the base structure
base = Solid(shift=(0, 0))
# Define the stem structure
stem = Solid(shift=(0, base_radius))
# Define the bowl structure
bowl = Solid(shift=(0, base_radius + stem_height))
# Define the details (engravings) structure
details = Drawing(shift=(0, base_radius + stem_height))
# Attach substructures to the root
wine_glass.base = base
wine_glass.stem = stem
wine_glass.bowl = bowl
bowl.details = details
# Base geometry: a simple circle
base.disk = Circle((0, 0), base_radius)
# Stem geometry: a rectangle for simplicity, we can make it a more complex shape later
stem.shaft = Rectangle((0, 0), bowl_diameter / 4, stem_height)
# Bowl geometry: an approximation of a hemispherical bowl using a set of arcs and lines
bowl.lower_curve = Arc((0, 0), radius=bowl_diameter / 2, start_angle=90, end_angle=270)
bowl.upper_curve = Arc((0, bowl_height), radius=bowl_diameter / 2, start_angle=270, end_angle=90)
bowl.connect_left = Line(bowl.lower_curve.start, bowl.upper_curve.end)
bowl.connect_right = Line(bowl.lower_curve.end, bowl.upper_curve.start)
# Example details: simple vertical lines for now
num_lines = 6
details.lines = [Line((0, -(bowl_height/2)), (0, bowl_height/2)) for i in range(num_lines)]
for i, line in enumerate(details.lines):
line.shift = (bowl_diameter / num_lines * i - bowl_diameter/2, 0)
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 this down step by step. We'll design a fancy wine glass that can be split into multiple subparts: the base, stem, bowl, and some engraved details.
### Step 1: Define the Structure of the Wine Glass
The wine glass will have a series of structures representing different parts of the glass. Here's an outline:
- **Base**: Circular base to support the glass.
- **Stem**: Cylindrical stem.
- **Bowl**: Main part that holds the wine.
- **Details**: Engraved patterns on the glass.
### Step 2: Parameters for the Wine Glass
We can parameterize the height of the stem, the diameter of the base, the diameter of the bowl, and any details.
Let's start by defining the overall structure and create placeholder geometry for the different parts. We will refine these in subsequent steps.
### Preliminary Model Layout
```python
from AIDL import *
def fancy_wine_glass(base_radius=2*inches,
stem_height=6*inches,
bowl_diameter=4*inches,
bowl_height=5*inches):
"""
Create a model of a fancy wine glass with an engraved bowl.
"""
# Create the root structure of the wine glass
wine_glass = Solid()
# Define the base structure
base = Solid(shift=(0, 0))
# Define the stem structure
stem = Solid(shift=(0, base_radius))
# Define the bowl structure
bowl = Solid(shift=(0, base_radius + stem_height))
# Define the details (engravings) structure
details = Drawing(shift=(0, base_radius + stem_height))
# Attach substructures to the root
wine_glass.base = base
wine_glass.stem = stem
wine_glass.bowl = bowl
bowl.details = details
# Base geometry: a simple circle
base.disk = Circle((0, 0), base_radius)
# Stem geometry: a rectangle for simplicity, we can make it a more complex shape later
stem.shaft = Rectangle((0, 0), bowl_diameter / 4, stem_height)
# Bowl geometry: an approximation of a hemispherical bowl using a set of arcs and lines
bowl.lower_curve = Arc((0, 0), radius=bowl_diameter / 2, start_angle=90, end_angle=270)
bowl.upper_curve = Arc((0, bowl_height), radius=bowl_diameter / 2, start_angle=270, end_angle=90)
bowl.connect_left = Line(bowl.lower_curve.start, bowl.upper_curve.end)
bowl.connect_right = Line(bowl.lower_curve.end, bowl.upper_curve.start)
# Example details: simple vertical lines for now
num_lines = 6
details.lines = [Line((0, -(bowl_height/2)), (0, bowl_height/2)) for i in range(num_lines)]
for i, line in enumerate(details.lines):
line.shift = (bowl_diameter / num_lines * i - bowl_diameter/2, 0)
return wine_glass
with AIDL_2D:
model = fancy_wine_glass()
print(model.Solve())
model.Render()
```
### Refining the Model
We can further refine the following aspects:
1. **Stem**: Create a more realistic cylindrical or tapered stem.
2. **Details**: Add more intricate patterns to the details.
3. **Bowl**: Make the bowl a smoother and more symmetrical shape.
Let's proceed with these refinements. If you have additional customization or specific details in mind, please let me know!
|