 |
CLIP Score: 25.04
from AIDL import *
def fountain_pen(
cap_length: float = 2.5 * inches,
barrel_length: float = 4.8 * inches,
section_length: float = 1.0 * inches,
pen_diameter: float = 0.5 * inches,
nib_length: float = 0.6 * inches,
nib_width: float = 0.3 * inches
):
"""
Create a model of a fountain pen with a cap, barrel, section, and nib.
"""
# Define the overall fountain pen structure
fountain_pen = Solid()
# Define the cap structure
cap = Solid(shift=(0, cap_length / 2 + barrel_length / 2))
fountain_pen.cap = cap
cap.body = Rectangle((0, 0), pen_diameter, cap_length)
# Define the barrel structure
barrel = Solid(shift=(0, -section_length / 2))
fountain_pen.barrel = barrel
barrel.body = Rectangle((0, 0), pen_diameter, barrel_length)
# Define the section structure
section = Solid(shift=(0, -barrel_length / 2 - section_length / 2))
fountain_pen.section = section
section.body = Rectangle((0, 0), pen_diameter, section_length)
# Define the nib structure
nib = Solid(shift=(0, -barrel_length / 2 - section_length - nib_length / 2))
fountain_pen.nib = nib
nib.body = Triangle((0, 0), nib_length, nib_width)
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 a simple model of a fountain pen. A fountain pen generally consists of several components: the cap, the barrel, the section, the nib, and possibly an ink reservoir inside the barrel. For this model, we'll consider the main external components: the cap, barrel, section, and nib.
I'll add some reasonable default dimensions for each component. Here's the initial AIDL program:
```python
from AIDL import *
def fountain_pen(
cap_length: float = 2.5 * inches,
barrel_length: float = 4.8 * inches,
section_length: float = 1.0 * inches,
pen_diameter: float = 0.5 * inches,
nib_length: float = 0.6 * inches,
nib_width: float = 0.3 * inches
):
"""
Create a model of a fountain pen with a cap, barrel, section, and nib.
"""
# Define the overall fountain pen structure
fountain_pen = Solid()
# Define the cap structure
cap = Solid(shift=(0, cap_length / 2 + barrel_length / 2))
fountain_pen.cap = cap
cap.body = Rectangle((0, 0), pen_diameter, cap_length)
# Define the barrel structure
barrel = Solid(shift=(0, -section_length / 2))
fountain_pen.barrel = barrel
barrel.body = Rectangle((0, 0), pen_diameter, barrel_length)
# Define the section structure
section = Solid(shift=(0, -barrel_length / 2 - section_length / 2))
fountain_pen.section = section
section.body = Rectangle((0, 0), pen_diameter, section_length)
# Define the nib structure
nib = Solid(shift=(0, -barrel_length / 2 - section_length - nib_length / 2))
fountain_pen.nib = nib
nib.body = Triangle((0, 0), nib_length, nib_width)
return fountain_pen
with AIDL_2D:
model = fountain_pen()
print(model.Solve())
model.Render()
```
This script creates a basic model of a fountain pen with a cap, barrel, section, and nib. The components are aligned and positioned accordingly. The cap and barrel are simple rectangles, while the nib is a triangle.
Feel free to adjust the dimensions and add more details or components as needed. If there's anything specific you'd like to modify or enhance, let me know!
|