 |
CLIP Score: 30.56
from AIDL import *
def t_shirt_pattern(
chest_width: float = 20 * inches,
shirt_length: float = 25 * inches,
sleeve_length: float = 10 * inches,
neck_hole_diameter: float = 8 * inches
):
"""
Design a basic t-shirt pattern with the given dimensions.
"""
# Define the model structure
pattern = Solid() # Root of the model
front_piece = Solid()
back_piece = Solid()
left_sleeve = Solid()
right_sleeve = Solid()
pattern.front_piece = front_piece
pattern.back_piece = back_piece
pattern.left_sleeve = left_sleeve
pattern.right_sleeve = right_sleeve
# --- Front Piece ---
front_piece.main_body = Rectangle((0, 0), chest_width, shirt_length)
front_piece.neck_hole = Hole()
front_piece.neck_hole.circle = Circle((0, shirt_length - 2*inches), neck_hole_diameter / 2)
front_piece.left_shoulder_slope = Line((-(neck_hole_diameter / 2), shirt_length - 2*inches), (-(chest_width / 2), shirt_length - 3*inches))
front_piece.right_shoulder_slope = Line((neck_hole_diameter / 2, shirt_length - 2*inches), (chest_width / 2, shirt_length - 3*inches))
# --- Back Piece ---
back_piece.main_body = Rectangle((0, 0), chest_width, shirt_length)
back_piece.neck_hole = Hole()
back_piece.neck_hole.circle = Circle((0, shirt_length - 1.5*inches), neck_hole_diameter / 2)
back_piece.left_shoulder_slope = Line((-(neck_hole_diameter / 2), shirt_length - 1.5*inches), (-(chest_width / 2), shirt_length - 2.5*inches))
back_piece.right_shoulder_slope = Line((neck_hole_diameter / 2, shirt_length - 1.5*inches), (chest_width / 2, shirt_length - 2.5*inches))
# --- Sleeves ---
left_sleeve.main_body = Rectangle((0, 0), chest_width / 2, sleeve_length)
right_sleeve.main_body = Rectangle((0, 0), chest_width / 2, sleeve_length)
pattern.right_sleeve.shift = (chest_width, 0) # Shift the right sleeve for better visualization
# Add constraints for symmetrical positioning and alignment if any
return pattern
with AIDL_2D:
model = t_shirt_pattern()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a garment patterns for clothing manufacturing
Certainly! Let's start by specifying the details of the garment pattern you'd like to create. For simplicity, let's design a basic t-shirt pattern. Here are some initial parameters we might consider:
1. **Chest Width**
2. **Shirt Length**
3. **Sleeve Length**
4. **Neck Hole Diameter**
These are basic parameters that we can adjust, and they'll allow us to create a simple t-shirt pattern.
Our t-shirt pattern will consist of:
- A front piece with a neckline and shoulder slopes.
- A back piece with a neckline and shoulder slopes.
- Two sleeves.
Here is the AIDL program to generate such a t-shirt pattern:
```python
from AIDL import *
def t_shirt_pattern(
chest_width: float = 20 * inches,
shirt_length: float = 25 * inches,
sleeve_length: float = 10 * inches,
neck_hole_diameter: float = 8 * inches
):
"""
Design a basic t-shirt pattern with the given dimensions.
"""
# Define the model structure
pattern = Solid() # Root of the model
front_piece = Solid()
back_piece = Solid()
left_sleeve = Solid()
right_sleeve = Solid()
pattern.front_piece = front_piece
pattern.back_piece = back_piece
pattern.left_sleeve = left_sleeve
pattern.right_sleeve = right_sleeve
# --- Front Piece ---
front_piece.main_body = Rectangle((0, 0), chest_width, shirt_length)
front_piece.neck_hole = Hole()
front_piece.neck_hole.circle = Circle((0, shirt_length - 2*inches), neck_hole_diameter / 2)
front_piece.left_shoulder_slope = Line((-(neck_hole_diameter / 2), shirt_length - 2*inches), (-(chest_width / 2), shirt_length - 3*inches))
front_piece.right_shoulder_slope = Line((neck_hole_diameter / 2, shirt_length - 2*inches), (chest_width / 2, shirt_length - 3*inches))
# --- Back Piece ---
back_piece.main_body = Rectangle((0, 0), chest_width, shirt_length)
back_piece.neck_hole = Hole()
back_piece.neck_hole.circle = Circle((0, shirt_length - 1.5*inches), neck_hole_diameter / 2)
back_piece.left_shoulder_slope = Line((-(neck_hole_diameter / 2), shirt_length - 1.5*inches), (-(chest_width / 2), shirt_length - 2.5*inches))
back_piece.right_shoulder_slope = Line((neck_hole_diameter / 2, shirt_length - 1.5*inches), (chest_width / 2, shirt_length - 2.5*inches))
# --- Sleeves ---
left_sleeve.main_body = Rectangle((0, 0), chest_width / 2, sleeve_length)
right_sleeve.main_body = Rectangle((0, 0), chest_width / 2, sleeve_length)
pattern.right_sleeve.shift = (chest_width, 0) # Shift the right sleeve for better visualization
# Add constraints for symmetrical positioning and alignment if any
return pattern
with AIDL_2D:
model = t_shirt_pattern()
print(model.Solve())
model.Render()
```
In this program:
- We create the main structure `pattern` containing the `front_piece`, `back_piece`, `left_sleeve`, and `right_sleeve`.
- For each piece, we define its main body using rectangles and include neck holes as circles (holes).
- Shoulder slopes are defined using lines.
- The right sleeve is shifted horizontally for visualization purposes.
Please let me know if you would like to make adjustments or add more details to the pattern.
|