 |
CLIP Score: 30.7
from AIDL import *
def fancy_teapot(
body_width: float = 6 * inches,
body_height: float = 4 * inches,
handle_width: float = 1.5 * inches,
handle_height: float = 3 * inches,
spout_length: float = 2.5 * inches,
spout_width: float = 0.75 * inches,
lid_radius: float = 1.5 * inches,
lid_height: float = 0.5 * inches,
knob_radius: float = 0.3 * inches
):
"""
Create a fancy teapot with a rounded rectangular body, spout, handle, and decorated lid.
"""
# Main teapot structure
teapot = Solid()
# Body of the teapot
teapot.body = RoundedRectangle((0, 0), body_width, body_height, body_width / 8)
# Spout of the teapot
spout_shift = (body_width / 2 + spout_width / 2, 0)
teapot.spout = Solid(shift=spout_shift)
teapot.spout.spout_body = RoundedRectangle((0, 0), spout_length, spout_width, spout_width / 4)
# Handle of the teapot
handle_shift = (-body_width / 2 - handle_width / 2, 0)
teapot.handle = Solid(shift=handle_shift)
teapot.handle.handle_body = RoundedRectangle((0, 0), handle_width, handle_height, handle_width / 3)
# Lid of the teapot
lid_shift = (0, body_height / 2 + lid_height / 2)
teapot.lid = Solid(shift=lid_shift)
teapot.lid.lid_body = Circle((0, 0), lid_radius)
teapot.lid.knob = Solid(shift=(0, lid_radius + knob_radius))
teapot.lid.knob.knob_body = Circle((0, 0), knob_radius)
# Decorative details (e.g., engraving patterns)
teapot.details = Drawing()
teapot.details.pattern = Circle((0, 0), body_width / 4)
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 design a fancy teapot using the AIDL language. Here’s a step-by-step outline:
1. **Define the Main Structure**: We'll create a main `Solid` structure to represent the teapot.
2. **Body of Teapot**: The core of the teapot will be a rounded rectangle to represent its body.
3. **Spout**: We'll add a solid structure for the spout.
4. **Handle**: We'll create a handle for the teapot and position it to the side.
5. **Lid**: We'll add a lid with a small knob on top.
6. **Details**: Add some decorative engravings on the body for a fancy look.
Let's start with the basic body of the teapot and then we will proceed to add other parts step-by-step.
Here’s the initial part of the AIDL program for the teapot:
```python
from AIDL import *
def fancy_teapot(
body_width: float = 6 * inches,
body_height: float = 4 * inches,
handle_width: float = 1.5 * inches,
handle_height: float = 3 * inches,
spout_length: float = 2.5 * inches,
spout_width: float = 0.75 * inches,
lid_radius: float = 1.5 * inches,
lid_height: float = 0.5 * inches,
knob_radius: float = 0.3 * inches
):
"""
Create a fancy teapot with a rounded rectangular body, spout, handle, and decorated lid.
"""
# Main teapot structure
teapot = Solid()
# Body of the teapot
teapot.body = RoundedRectangle((0, 0), body_width, body_height, body_width / 8)
# Spout of the teapot
spout_shift = (body_width / 2 + spout_width / 2, 0)
teapot.spout = Solid(shift=spout_shift)
teapot.spout.spout_body = RoundedRectangle((0, 0), spout_length, spout_width, spout_width / 4)
# Handle of the teapot
handle_shift = (-body_width / 2 - handle_width / 2, 0)
teapot.handle = Solid(shift=handle_shift)
teapot.handle.handle_body = RoundedRectangle((0, 0), handle_width, handle_height, handle_width / 3)
# Lid of the teapot
lid_shift = (0, body_height / 2 + lid_height / 2)
teapot.lid = Solid(shift=lid_shift)
teapot.lid.lid_body = Circle((0, 0), lid_radius)
teapot.lid.knob = Solid(shift=(0, lid_radius + knob_radius))
teapot.lid.knob.knob_body = Circle((0, 0), knob_radius)
# Decorative details (e.g., engraving patterns)
teapot.details = Drawing()
teapot.details.pattern = Circle((0, 0), body_width / 4)
return teapot
with AIDL_2D:
model = fancy_teapot()
print(model.Solve())
model.Render()
```
This code sets up the main body, spout, handle, and lid of the teapot. The body is modelled as a rounded rectangle, and the spout and handle are added as shifted solid structures. The lid is placed on top of the teapot body with a knob.
Feel free to modify the parameters or the design elements to match your specific requirements or add more decorative details for a fancier look. Let me know if you want to make any adjustments or add more features to the teapot, and I'm here to help!
|