 |
CLIP Score: 32.27
from AIDL import *
def fountain_pen(
cap_length: float = 3 * inches,
body_length: float = 5 * inches,
pen_diameter: float = 0.5 * inches,
nib_length: float = 1 * inch):
"""
Model a simple fountain pen consisting of a body, a cap, and a nib, with decorative details.
"""
fountain_pen = Assembly()
cap = Solid(shift=(0, body_length + cap_length / 2))
body = Solid()
nib = Solid(shift=(0, -body_length / 2 - nib_length / 2))
body.nib = nib
fountain_pen.cap = cap
fountain_pen.body = body
# Define the geometry of the cap. It's a simple cylinder with the given length and diameter.
cap.shape = Rectangle((0, 0), pen_diameter, cap_length)
# Adding clip details to the cap
cap.clip = Solid(shift=(0, cap_length / 4))
cap.clip.shape = Rectangle((0, 0), 1 * inch, 0.1 * inch)
# Adding decorative lines
cap.decorations = Drawing()
cap.decorations.line1 = Line((-pen_diameter / 2, cap_length / 3), (pen_diameter / 2, cap_length / 3))
cap.decorations.line2 = Line((-pen_diameter / 2, cap_length / 1.5), (pen_diameter / 2, cap_length / 1.5))
# Define the body geometry. It's also a simple cylinder.
body.shape = Rectangle((0, 0), pen_diameter, body_length)
# Adding grip details to the body
body.grip = Solid(shift=(0, -body_length / 6))
body.grip.shape = Rectangle((0, 0), pen_diameter, body_length / 3)
# Adding decorative lines
body.decorations = Drawing()
body.decorations.line1 = Line((-pen_diameter / 2, body_length / 3), (pen_diameter / 2, body_length / 3))
body.decorations.line2 = Line((-pen_diameter / 2, 2 * body_length / 3), (pen_diameter / 2, 2 * body_length / 3))
# Define the nib geometry. It tapers to a point.
nib.base = Rectangle((0,0), pen_diameter / 2, nib_length)
nib.taper_left = Line((-pen_diameter / 4, 0), (0, -nib_length))
nib.taper_right = Line((pen_diameter / 4, 0), (0, -nib_length))
return fountain_pen
with AIDL_2D:
model = fountain_pen()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a fountain pen
Sure, let's create an AIDL program to generate a fountain pen. We'll break it down step-by-step, starting from the basic outline and gradually adding details.
**Step 1: Define the Fountain Pen's Overall Structure**
We'll start by defining the main components of a fountain pen: the cap, the body, and the nib. We'll make the cap and body as Solid structures since they need to be cut out, and we'll add holes and drawings for detailing later.
```python
from AIDL import *
def fountain_pen(
cap_length: float = 3 * inches,
body_length: float = 5 * inches,
pen_diameter: float = 0.5 * inches):
"""
Model a simple fountain pen consisting of a body, a cap, and a nib.
"""
fountain_pen = Assembly()
cap = Solid(shift=(0, body_length + cap_length / 2))
body = Solid()
nib = Solid(shift=(0, -body_length / 2))
body.nib = nib
fountain_pen.cap = cap
fountain_pen.body = body
# Define the geometry of the cap. It's a simple cylinder with the given length and diameter.
cap.shape = Rectangle((0, 0), pen_diameter, cap_length)
# Define the body geometry. It's also a simple cylinder.
body.shape = Rectangle((0, 0), pen_diameter, body_length)
return fountain_pen
with AIDL_2D:
model = fountain_pen()
print(model.Solve())
model.Render()
```
In this initial step, we create a basic outline for the fountain pen with a cap and a body. The cap is positioned above the body. Now, let's move forward to add more details and make it look like a fountain pen.
**Step 2: Adding Details to the Cap**
We'll add a clip to the cap and some decorative lines.
```python
from AIDL import *
def fountain_pen(
cap_length: float = 3 * inches,
body_length: float = 5 * inches,
pen_diameter: float = 0.5 * inches):
"""
Model a simple fountain pen consisting of a body, a cap, and a nib, with decorative details.
"""
fountain_pen = Assembly()
cap = Solid(shift=(0, body_length + cap_length / 2))
body = Solid()
nib = Solid(shift=(0, -body_length / 2))
body.nib = nib
fountain_pen.cap = cap
fountain_pen.body = body
# Define the geometry of the cap. It's a simple cylinder with the given length and diameter.
cap.shape = Rectangle((0, 0), pen_diameter, cap_length)
# Adding clip details to the cap
cap.clip = Solid(shift=(0, cap_length / 4))
cap.clip.shape = Rectangle((0, 0), 1 * inch, 0.1 * inch)
# Adding decorative lines
cap.decorations = Drawing()
cap.decorations.line1 = Line((-pen_diameter / 2, cap_length / 3), (pen_diameter / 2, cap_length / 3))
cap.decorations.line2 = Line((-pen_diameter / 2, cap_length / 1.5), (pen_diameter / 2, cap_length / 1.5))
# Define the body geometry. It's also a simple cylinder.
body.shape = Rectangle((0, 0), pen_diameter, body_length)
return fountain_pen
with AIDL_2D:
model = fountain_pen()
print(model.Solve())
model.Render()
```
**Step 3: Adding Details to the Body**
We’ll add a grip section and some decorative details to the body.
```python
from AIDL import *
def fountain_pen(
cap_length: float = 3 * inches,
body_length: float = 5 * inches,
pen_diameter: float = 0.5 * inches):
"""
Model a simple fountain pen consisting of a body, a cap, and a nib, with decorative details.
"""
fountain_pen = Assembly()
cap = Solid(shift=(0, body_length + cap_length / 2))
body = Solid()
nib = Solid(shift=(0, -body_length / 2))
body.nib = nib
fountain_pen.cap = cap
fountain_pen.body = body
# Define the geometry of the cap. It's a simple cylinder with the given length and diameter.
cap.shape = Rectangle((0, 0), pen_diameter, cap_length)
# Adding clip details to the cap
cap.clip = Solid(shift=(0, cap_length / 4))
cap.clip.shape = Rectangle((0, 0), 1 * inch, 0.1 * inch)
# Adding decorative lines
cap.decorations = Drawing()
cap.decorations.line1 = Line((-pen_diameter / 2, cap_length / 3), (pen_diameter / 2, cap_length / 3))
cap.decorations.line2 = Line((-pen_diameter / 2, cap_length / 1.5), (pen_diameter / 2, cap_length / 1.5))
# Define the body geometry. It's also a simple cylinder.
body.shape = Rectangle((0, 0), pen_diameter, body_length)
# Adding grip details to the body
body.grip = Solid(shift=(0, -body_length / 6))
body.grip.shape = Rectangle((0, 0), pen_diameter, body_length / 3)
# Adding decorative lines
body.decorations = Drawing()
body.decorations.line1 = Line((-pen_diameter / 2, body_length / 3), (pen_diameter / 2, body_length / 3))
body.decorations.line2 = Line((-pen_diameter / 2, 2 * body_length / 3), (pen_diameter / 2, 2 * body_length / 3))
return fountain_pen
with AIDL_2D:
model = fountain_pen()
print(model.Solve())
model.Render()
```
**Step 4: Adding Nib Details**
Finally, let’s add details to the nib.
```python
from AIDL import *
def fountain_pen(
cap_length: float = 3 * inches,
body_length: float = 5 * inches,
pen_diameter: float = 0.5 * inches,
nib_length: float = 1 * inch):
"""
Model a simple fountain pen consisting of a body, a cap, and a nib, with decorative details.
"""
fountain_pen = Assembly()
cap = Solid(shift=(0, body_length + cap_length / 2))
body = Solid()
nib = Solid(shift=(0, -body_length / 2 - nib_length / 2))
body.nib = nib
fountain_pen.cap = cap
fountain_pen.body = body
# Define the geometry of the cap. It's a simple cylinder with the given length and diameter.
cap.shape = Rectangle((0, 0), pen_diameter, cap_length)
# Adding clip details to the cap
cap.clip = Solid(shift=(0, cap_length / 4))
cap.clip.shape = Rectangle((0, 0), 1 * inch, 0.1 * inch)
# Adding decorative lines
cap.decorations = Drawing()
cap.decorations.line1 = Line((-pen_diameter / 2, cap_length / 3), (pen_diameter / 2, cap_length / 3))
cap.decorations.line2 = Line((-pen_diameter / 2, cap_length / 1.5), (pen_diameter / 2, cap_length / 1.5))
# Define the body geometry. It's also a simple cylinder.
body.shape = Rectangle((0, 0), pen_diameter, body_length)
# Adding grip details to the body
body.grip = Solid(shift=(0, -body_length / 6))
body.grip.shape = Rectangle((0, 0), pen_diameter, body_length / 3)
# Adding decorative lines
body.decorations = Drawing()
body.decorations.line1 = Line((-pen_diameter / 2, body_length / 3), (pen_diameter / 2, body_length / 3))
body.decorations.line2 = Line((-pen_diameter / 2, 2 * body_length / 3), (pen_diameter / 2, 2 * body_length / 3))
# Define the nib geometry. It tapers to a point.
nib.base = Rectangle((0,0), pen_diameter / 2, nib_length)
nib.taper_left = Line((-pen_diameter / 4, 0), (0, -nib_length))
nib.taper_right = Line((pen_diameter / 4, 0), (0, -nib_length))
return fountain_pen
with AIDL_2D:
model = fountain_pen()
print(model.Solve())
model.Render()
```
These steps create a basic model of a fountain pen with a cap, clip, body, grip, and nib. The details add decorative lines and functional parts to make it look like a realistic fountain pen. Feel free to modify dimensions and add more details as needed.
|