 |
CLIP Score: 25.8
from AIDL import *
def airplane(fuselage_length: float = 12*inches, fuselage_height: float = 2*inches,
wing_span: float = 14*inches, tail_span: float = 3*inches, tail_height: float = 1.5*inches,
wing_position: float = 4*inches, tail_position: float = 10*inches):
"""
Create a model of a simple airplane with a fuselage, wings, and tail.
"""
# Create the main airplane structure
airplane = Assembly()
# Create the fuselage
fuselage = Solid()
airplane.fuselage = fuselage
fuselage.body = RoundedRectangle((0,0), fuselage_length, fuselage_height, fuselage_height/2)
# Create wings
wing = Solid(shift=(wing_position, 0))
airplane.wing_left = wing
wing.left_wing = Rectangle((-wing_span/2, 0), wing_span/2, fuselage_height * 1.5)
airplane.wing_right = Solid(shift=(-wing_position, 0))
airplane.wing_right.right_wing = Rectangle((wing_span/2, 0), wing_span/2, fuselage_height * 1.5)
# Create tail
tail = Solid(shift=(tail_position, 0))
airplane.tail = tail
tail.horizontal_stabilizer = Rectangle((0, 0), tail_span, tail_height)
tail.vertical_stabilizer = RoundedRectangle((0, tail_height/2), tail_height/2, tail_height, tail_height/4)
# Optional details (engraved windows)
details = Drawing()
airplane.details = details
number_of_windows = 6
window_spacing = fuselage_length / (number_of_windows + 1)
window_radius = fuselage_height / 8
details.windows = [Circle((i * window_spacing - (fuselage_length / 2 - window_spacing), 0), window_radius) for i in range(1, number_of_windows + 1)]
return airplane
with AIDL_2D:
model = airplane()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a airplane
Sure! Let's create a simple representation of an airplane. We'll break it down into parts:
1. **Fuselage**: The main body of the airplane.
2. **Wing**: The main wings on either side.
3. **Tail**: The tail section which usually includes vertical and horizontal stabilizers.
4. **Engraving Details**: Optional details like windows or doors that will be engraved onto the fuselage.
Let's start step-by-step with the implementation:
### Step 1: Create the Fuselage
The fuselage will be a simple elongated rectangle or rounded rectangle.
```python
from AIDL import *
def airplane(fuselage_length: float = 12*inches, fuselage_height: float = 2*inches,
wing_span: float = 14*inches, tail_span: float = 3*inches, tail_height: float = 1.5*inches,
wing_position: float = 4*inches, tail_position: float = 10*inches):
"""
Create a model of a simple airplane with a fuselage, wings, and tail.
"""
# Create the main airplane structure
airplane = Assembly()
# Create the fuselage
fuselage = Solid()
airplane.fuselage = fuselage
fuselage.body = RoundedRectangle((0,0), fuselage_length, fuselage_height, fuselage_height/2)
# Create wings
wing = Solid(shift=(wing_position, 0))
airplane.wing_left = wing
wing.left_wing = Rectangle((-wing_span/2, 0), wing_span/2, fuselage_height * 1.5)
airplane.wing_right = Solid(shift=(-wing_position, 0))
airplane.wing_right.right_wing = Rectangle((wing_span/2, 0), wing_span/2, fuselage_height * 1.5)
# Create tail
tail = Solid(shift=(tail_position, 0))
airplane.tail = tail
tail.horizontal_stabilizer = Rectangle((0, 0), tail_span, tail_height)
tail.vertical_stabilizer = RoundedRectangle((0, tail_height/2), tail_height/2, tail_height, tail_height/4)
# Optional details (engraved windows)
details = Drawing()
airplane.details = details
number_of_windows = 6
window_spacing = fuselage_length / (number_of_windows + 1)
window_radius = fuselage_height / 8
details.windows = [Circle((i * window_spacing - (fuselage_length / 2 - window_spacing), 0), window_radius) for i in range(1, number_of_windows + 1)]
return airplane
with AIDL_2D:
model = airplane()
print(model.Solve())
model.Render()
```
### Explanation
- **Fuselage**: A rounded rectangle centered at the origin.
- **Wings**: Two rectangles shifted to the right and left for the right and left wings, respectively.
- **Tail**: One rectangle for the horizontal stabilizer and one rounded rectangle for the vertical stabilizer.
- **Details**: Several circles distributed along the fuselage to represent windows (engraved).
Feel free to run this AIDL script and adjust the parameters to better match your design.
|