 |
CLIP Score: 27.99
from AIDL import *
def fancy_teapot(
body_width: float = 6*inches,
body_height: float = 4*inches,
lid_radius: float = 2.5*inches,
handle_radius: float = 3*inches,
spout_length: float = 2*inches,
decoration_radius: float = 1*inch
):
"""
Creates a fancy teapot with a body, lid, handle, spout, and decorative engravings.
"""
teapot = Solid()
# Body
body = Solid()
teapot.body = body
body.shape = RoundedRectangle((0,0), body_width, body_height, body_width / 10)
# Lid
lid = Solid(shift=(0, body_height/2))
body.lid = lid
lid.shape = Circle((0,0), lid_radius)
# Handle
handle = Solid(shift=(-body_width/2 - handle_radius/2, 0))
body.handle = handle
handle.shape = Arc((0, 0), 0, 180, handle_radius)
# Spout
spout = Solid(shift=(body_width/2 + 0.5*inch, 0))
body.spout = spout
spout.outline = Arc((0, 0), (-spout_length, 0.5*inch), (-spout_length, -0.5*inch))
# Decorative Elements
decoration = Drawing()
body.decoration = decoration
decoration.patterns = [
Circle((0, 0), decoration_radius)
]
return teapot
with AIDL_2D:
model = fancy_teapot()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a fancy teapot
Sure, let's get started on creating a fancy teapot in AIDL. Here’s how we can break down the design:
1. **Body**: The main container of the teapot.
2. **Lid**: The lid of the teapot.
3. **Spout**: The spout from which the tea is poured.
4. **Handle**: The handle for holding the teapot.
5. **Decoration Elements**: Some engraved details to make it fancy.
### Step-by-Step Breakdown:
1. **Body**: We can model the body as a simple rounded rectangle.
2. **Lid**: The lid can be a smaller circle with a decorated knob on top.
3. **Spout**: A combination of arcs to create a spout shape.
4. **Handle**: A simple arc to form a handle.
5. **Decorations**: Some patterned lines or shapes on the body.
Let’s go step by step.
**Step 1: The Body**
```python
from AIDL import *
def fancy_teapot(
body_width: float = 6*inches,
body_height: float = 4*inches,
lid_radius: float = 2.5*inches,
handle_radius: float = 3*inches,
spout_length: float = 2*inches,
decoration_radius: float = 1*inch
):
"""
Creates a fancy teapot with a body, lid, handle, spout, and decorative engravings.
"""
teapot = Solid()
# Body
body = Solid()
teapot.body = body
body.shape = RoundedRectangle((0,0), body_width, body_height, body_width / 10)
return teapot
with AIDL_2D:
model = fancy_teapot()
print(model.Solve())
model.Render()
```
**Step 2: Adding a Lid**
```python
from AIDL import *
def fancy_teapot(
body_width: float = 6*inches,
body_height: float = 4*inches,
lid_radius: float = 2.5*inches,
handle_radius: float = 3*inches,
spout_length: float = 2*inches,
decoration_radius: float = 1*inch
):
"""
Creates a fancy teapot with a body, lid, handle, spout, and decorative engravings.
"""
teapot = Solid()
# Body
body = Solid()
teapot.body = body
body.shape = RoundedRectangle((0,0), body_width, body_height, body_width / 10)
# Lid
lid = Solid(shift=(0, body_height/2))
body.lid = lid
lid.shape = Circle((0,0), lid_radius)
return teapot
with AIDL_2D:
model = fancy_teapot()
print(model.Solve())
model.Render()
```
**Step 3: Adding a Handle**
```python
from AIDL import *
def fancy_teapot(
body_width: float = 6*inches,
body_height: float = 4*inches,
lid_radius: float = 2.5*inches,
handle_radius: float = 3*inches,
spout_length: float = 2*inches,
decoration_radius: float = 1*inch
):
"""
Creates a fancy teapot with a body, lid, handle, spout, and decorative engravings.
"""
teapot = Solid()
# Body
body = Solid()
teapot.body = body
body.shape = RoundedRectangle((0,0), body_width, body_height, body_width / 10)
# Lid
lid = Solid(shift=(0, body_height/2))
body.lid = lid
lid.shape = Circle((0,0), lid_radius)
# Handle
handle = Solid(shift=(-body_width/2 - handle_radius/2, 0))
body.handle = handle
handle.shape = Arc((0, 0), 0, 180, handle_radius)
return teapot
with AIDL_2D:
model = fancy_teapot()
print(model.Solve())
model.Render()
```
**Step 4: Adding a Spout**
```python
from AIDL import *
def fancy_teapot(
body_width: float = 6*inches,
body_height: float = 4*inches,
lid_radius: float = 2.5*inches,
handle_radius: float = 3*inches,
spout_length: float = 2*inches,
decoration_radius: float = 1*inch
):
"""
Creates a fancy teapot with a body, lid, handle, spout, and decorative engravings.
"""
teapot = Solid()
# Body
body = Solid()
teapot.body = body
body.shape = RoundedRectangle((0,0), body_width, body_height, body_width / 10)
# Lid
lid = Solid(shift=(0, body_height/2))
body.lid = lid
lid.shape = Circle((0,0), lid_radius)
# Handle
handle = Solid(shift=(-body_width/2 - handle_radius/2, 0))
body.handle = handle
handle.shape = Arc((0, 0), 0, 180, handle_radius)
# Spout
spout = Solid(shift=(body_width/2 + 0.5*inch, 0))
body.spout = spout
spout.outline = Arc((0, 0), (-spout_length, 0.5*inch), (-spout_length, -0.5*inch))
return teapot
with AIDL_2D:
model = fancy_teapot()
print(model.Solve())
model.Render()
```
**Step 5: Adding Decorative Elements**
```python
from AIDL import *
def fancy_teapot(
body_width: float = 6*inches,
body_height: float = 4*inches,
lid_radius: float = 2.5*inches,
handle_radius: float = 3*inches,
spout_length: float = 2*inches,
decoration_radius: float = 1*inch
):
"""
Creates a fancy teapot with a body, lid, handle, spout, and decorative engravings.
"""
teapot = Solid()
# Body
body = Solid()
teapot.body = body
body.shape = RoundedRectangle((0,0), body_width, body_height, body_width / 10)
# Lid
lid = Solid(shift=(0, body_height/2))
body.lid = lid
lid.shape = Circle((0,0), lid_radius)
# Handle
handle = Solid(shift=(-body_width/2 - handle_radius/2, 0))
body.handle = handle
handle.shape = Arc((0, 0), 0, 180, handle_radius)
# Spout
spout = Solid(shift=(body_width/2 + 0.5*inch, 0))
body.spout = spout
spout.outline = Arc((0, 0), (-spout_length, 0.5*inch), (-spout_length, -0.5*inch))
# Decorative Elements
decoration = Drawing()
body.decoration = decoration
decoration.patterns = [
Circle((0, 0), decoration_radius)
]
return teapot
with AIDL_2D:
model = fancy_teapot()
print(model.Solve())
model.Render()
```
This should give you a fancy teapot with a body, lid, handle, spout, and some decorative engravings. Feel free to further customize or add more details as needed!
Would you like to make any adjustments or add more features?
|