 |
CLIP Score: 26.38
from AIDL import *
def fancy_wine_glass(bowl_radius: float = 2 * inches, bowl_height: float = 4 * inches, stem_height: float = 3 * inches, base_radius: float = 2 * inches):
# Create the main structure of the wine glass
wine_glass = Solid()
# Define substructures for the bowl, stem, and base
bowl = Solid()
stem = Solid()
base = Solid()
wine_glass.bowl = bowl
wine_glass.stem = stem
wine_glass.base = base
# Add compositional constraints for positioning
wine_glass.AddConstraint(bowl.bb.bottom == stem.bb.top)
wine_glass.AddConstraint(stem.bb.bottom == base.bb.top)
# Ensure all parts are centered together
wine_glass.AddConstraint(bowl.bb.horizontal_center == stem.bb.horizontal_center)
wine_glass.AddConstraint(stem.bb.horizontal_center == base.bb.horizontal_center)
# Add geometry to the bowl
bowl.top = Circle((0, bowl_height), bowl_radius) # Top circle of the bowl
bowl.bottom_arc = Arc((0, 0), (bowl_radius, bowl_height), (-bowl_radius, bowl_height))
# Add geometry to the stem
stem.rectangle = Rectangle((0, stem_height / 2), bowl_radius / 4, stem_height) # Narrow stem
# Add geometry to the base
base.disk = Circle((0, 0), base_radius) # Circular base
# Constraints for the bowl geometry
bowl.AddConstraint(HorizontallySymmetric(bowl.bottom_arc.start, bowl.bottom_arc.end))
# Constraints for the stem geometry
stem.AddConstraint(stem.rectangle.center.u == 0)
# Constraints for the base geometry
base.AddConstraint(base.disk.center.u == 0)
base.AddConstraint(base.disk.center.v == 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
Let's design a model of a fancy wine glass. We'll start with the high-level structure, then add geometry and constraints, step-by-step. Here's a breakdown of the process:
1. **Define the high-level structure**: The wine glass will have three main parts: the bowl, the stem, and the base.
2. **Add geometry to the structures**: We'll define the shapes for each part.
3. **Add constraints between the geometries and structures**: We'll ensure the parts are connected correctly and proportionately.
Let's start by defining the high-level structure of the wine glass:
```python
from AIDL import *
def fancy_wine_glass(bowl_radius: float = 2 * inches, bowl_height: float = 4 * inches, stem_height: float = 3 * inches, base_radius: float = 2 * inches):
# Create the main structure of the wine glass
wine_glass = Solid()
# Define substructures for the bowl, stem, and base
bowl = Solid()
stem = Solid()
base = Solid()
wine_glass.bowl = bowl
wine_glass.stem = stem
wine_glass.base = base
# Add compositional constraints for positioning
wine_glass.AddConstraint(bowl.bb.bottom == stem.bb.top)
wine_glass.AddConstraint(stem.bb.bottom == base.bb.top)
# Ensure all parts are centered together
wine_glass.AddConstraint(bowl.bb.horizontal_center == stem.bb.horizontal_center)
wine_glass.AddConstraint(stem.bb.horizontal_center == base.bb.horizontal_center)
# Add geometry to the bowl
bowl.top = Circle((0, bowl_height), bowl_radius) # Top circle of the bowl
bowl.bottom_arc = Arc((0, 0), (bowl_radius, bowl_height), (-bowl_radius, bowl_height))
# Add geometry to the stem
stem.rectangle = Rectangle((0, stem_height / 2), bowl_radius / 4, stem_height) # Narrow stem
# Add geometry to the base
base.disk = Circle((0, 0), base_radius) # Circular base
# Constraints for the bowl geometry
bowl.AddConstraint(HorizontallySymmetric(bowl.bottom_arc.start, bowl.bottom_arc.end))
# Constraints for the stem geometry
stem.AddConstraint(stem.rectangle.center.u == 0)
# Constraints for the base geometry
base.AddConstraint(base.disk.center.u == 0)
base.AddConstraint(base.disk.center.v == 0)
return wine_glass
with AIDL_2D:
model = fancy_wine_glass()
print(model.Solve())
model.Render()
```
This is the initial setup, defining the main structures of the wine glass. Next, we will add more detailed geometry and constraints to refine the shape of each part.
Please run this code within the AIDL 2D environment to visualize the base structure of the wine glass. Let me know if you need any adjustments or additional features for the wine glass.
|