 |
CLIP Score: 28.49
from AIDL import *
def old_school_telephone(
base_length: float = 6 * inches,
base_width: float = 10 * inches,
base_height: float = 3 * inches,
handset_length: float = 8 * inches,
handset_width: float = 2 * inches,
dial_radius: float = 1.5 * inches,
dial_holes: int = 10
):
"""
Creates an old-school telephone
"""
telephone = Assembly()
# Base structure
base = Solid(shift=(0, 0))
telephone.base = base
base.outline = RoundedRectangle((0, 0), base_length, base_width, corner_radius=base_length / 8)
# Handset structure
handset = Solid(shift=(0, base_width / 2 + 1 * inch))
telephone.handset = handset
handset.body = RoundedRectangle((0, 0), handset_length, handset_width, corner_radius=handset_width / 2)
# Rotary dial structure
rotary_dial = Solid(shift=(0, 0))
base.rotary_dial = rotary_dial
rotary_dial.disk = Circle((0, 0), dial_radius)
rotary_dial.holes = [Hole() for _ in range(dial_holes)]
for i in range(dial_holes):
angle = i * (360 / dial_holes)
hole_x = dial_radius * 0.6 * cos(radians(angle))
hole_y = dial_radius * 0.6 * sin(radians(angle))
rotary_dial.holes[i].hole = Circle((hole_x, hole_y), dial_radius / 6)
return telephone
with AIDL_2D:
model = old_school_telephone()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a old-school telephone
To create an old-school telephone, we can break it down into several parts: the handset, the base, the rotary dial, and the cord. We'll start by outlining each component in the AIDL language and then piece them together into a coherent model.
### Step 1: Define the Handset
The handset will have a basic cylindrical shape with rounded ends and a little thicker in the middle.
### Step 2: Define the Base
The base will be a rectangular shape with slightly rounded corners.
### Step 3: Define the Rotary Dial
The rotary dial will be a circle with holes arranged in an arc for the numbers.
### Step 4: Define the Cord
The cord might be complex to model for laser cutting, so we'll simplify it as a series of arcs and lines.
Let's start by defining the different pieces and then assemble them together.
```python
from AIDL import *
def old_school_telephone(
base_length: float = 6 * inches,
base_width: float = 10 * inches,
base_height: float = 3 * inches,
handset_length: float = 8 * inches,
handset_width: float = 2 * inches,
dial_radius: float = 1.5 * inches,
dial_holes: int = 10
):
"""
Creates an old-school telephone
"""
telephone = Assembly()
# Base structure
base = Solid(shift=(0, 0))
telephone.base = base
base.outline = RoundedRectangle((0, 0), base_length, base_width, corner_radius=base_length / 8)
# Handset structure
handset = Solid(shift=(0, base_width / 2 + 1 * inch))
telephone.handset = handset
handset.body = RoundedRectangle((0, 0), handset_length, handset_width, corner_radius=handset_width / 2)
# Rotary dial structure
rotary_dial = Solid(shift=(0, 0))
base.rotary_dial = rotary_dial
rotary_dial.disk = Circle((0, 0), dial_radius)
rotary_dial.holes = [Hole() for _ in range(dial_holes)]
for i in range(dial_holes):
angle = i * (360 / dial_holes)
hole_x = dial_radius * 0.6 * cos(radians(angle))
hole_y = dial_radius * 0.6 * sin(radians(angle))
rotary_dial.holes[i].hole = Circle((hole_x, hole_y), dial_radius / 6)
return telephone
with AIDL_2D:
model = old_school_telephone()
print(model.Solve())
model.Render()
```
This model includes:
1. A base structure that is a rounded rectangle.
2. A handset at the top center of the base shifted upward.
3. A rotary dial at the center of the base with equidistant holes around the dial.
Feel free to provide feedback, and we can iterate to improve or add more details to the model.
|