 |
CLIP Score: 24.17
from AIDL import *
def stained_glass_window(radius: float = 4*inch, pane_width: float = 2*inch, pane_height: float = 1*inch):
"""
Model a simple stained glass window, consisting of a circular central pane
surrounded by four rectangular panes and arcs connecting them.
"""
# Define the main Solid structure for the window
window = Solid()
# Add the central circular pane
window.central_pane = Circle((0, 0), radius)
# Add the rectangular panes around the central circle
pane_shift = radius + pane_height / 2
window.upper_pane = Rectangle((0, pane_shift), pane_width, pane_height)
window.lower_pane = Rectangle((0, -pane_shift), pane_width, pane_height)
window.left_pane = Rectangle((-pane_shift - pane_width / 2, 0), pane_height, pane_width)
window.right_pane = Rectangle((pane_shift + pane_width / 2, 0), pane_height, pane_width)
# Add decorative arcs
# Connect the upper left and upper right corners of the central pane
top_arc_center = (0, pane_shift)
window.top_arc_left = Arc(top_arc_center, window.central_pane.center, window.upper_pane.top_left)
window.top_arc_right = Arc(top_arc_center, window.upper_pane.top_right, window.central_pane.center)
# Connect the lower left and lower right corners of the central pane
bottom_arc_center = (0, -pane_shift)
window.bottom_arc_left = Arc(bottom_arc_center, window.lower_pane.bottom_left, window.central_pane.center)
window.bottom_arc_right = Arc(bottom_arc_center, window.central_pane.center, window.lower_pane.bottom_right)
return window
with AIDL_2D:
model = stained_glass_window()
print(model.Solve())
model.Render()
|
Please write an AIDL program to generate a stained glass window
Sure! Let's break this down step by step. We'll design a simple stained glass window featuring a circular central pane with a few decorative elements such as rectangles and arcs around it.
The window design will include:
1. A circular central piece.
2. Four rectangular panes surrounding the circle.
3. Decorative arcs connecting the corners.
Here's how we can start:
### Step 1: Define the main structure of the window
We'll start by creating the main Solid structure for the window. Since we don't need any subtractions or engraving for now, we'll stick to solid geometry.
```python
from AIDL import *
def stained_glass_window(radius: float = 4*inch):
"""
Model a simple stained glass window, consisting of a circular central pane
surrounded by four rectangular panes and arcs connecting them.
"""
# Define the main Solid structure for the window
window = Solid()
# Add the central circular pane
window.central_pane = Circle((0, 0), radius)
return window
with AIDL_2D:
model = stained_glass_window()
print(model.Solve())
model.Render()
```
### Step 2: Surround the circle with rectangular panes
Next, we will add rectangular panes around the central circle. We'll place one rectangular pane above, below, to the left, and to the right of the circle.
```python
from AIDL import *
def stained_glass_window(radius: float = 4*inch, pane_width: float = 2*inch, pane_height: float = 1*inch):
"""
Model a simple stained glass window, consisting of a circular central pane
surrounded by four rectangular panes and arcs connecting them.
"""
# Define the main Solid structure for the window
window = Solid()
# Add the central circular pane
window.central_pane = Circle((0, 0), radius)
# Add the rectangular panes around the central circle
pane_shift = radius + pane_height / 2
window.upper_pane = Rectangle((0, pane_shift), pane_width, pane_height)
window.lower_pane = Rectangle((0, -pane_shift), pane_width, pane_height)
window.left_pane = Rectangle((-pane_shift - pane_width / 2, 0), pane_height, pane_width)
window.right_pane = Rectangle((pane_shift + pane_width / 2, 0), pane_height, pane_width)
return window
with AIDL_2D:
model = stained_glass_window()
print(model.Solve())
model.Render()
```
### Step 3: Add decorative arcs
We'll add arcs that connect the corners of the rectangular panes. These will act as the decorative elements.
```python
from AIDL import *
def stained_glass_window(radius: float = 4*inch, pane_width: float = 2*inch, pane_height: float = 1*inch):
"""
Model a simple stained glass window, consisting of a circular central pane
surrounded by four rectangular panes and arcs connecting them.
"""
# Define the main Solid structure for the window
window = Solid()
# Add the central circular pane
window.central_pane = Circle((0, 0), radius)
# Add the rectangular panes around the central circle
pane_shift = radius + pane_height / 2
window.upper_pane = Rectangle((0, pane_shift), pane_width, pane_height)
window.lower_pane = Rectangle((0, -pane_shift), pane_width, pane_height)
window.left_pane = Rectangle((-pane_shift - pane_width / 2, 0), pane_height, pane_width)
window.right_pane = Rectangle((pane_shift + pane_width / 2, 0), pane_height, pane_width)
# Add decorative arcs
# Connect the upper left and upper right corners of the central pane
top_arc_center = (0, pane_shift)
window.top_arc_left = Arc(top_arc_center, window.central_pane.center, window.upper_pane.top_left)
window.top_arc_right = Arc(top_arc_center, window.upper_pane.top_right, window.central_pane.center)
# Connect the lower left and lower right corners of the central pane
bottom_arc_center = (0, -pane_shift)
window.bottom_arc_left = Arc(bottom_arc_center, window.lower_pane.bottom_left, window.central_pane.center)
window.bottom_arc_right = Arc(bottom_arc_center, window.central_pane.center, window.lower_pane.bottom_right)
return window
with AIDL_2D:
model = stained_glass_window()
print(model.Solve())
model.Render()
```
There you have it! This AIDL program generates a simple stained glass window with a central circular pane, surrounded by rectangular panes, and decorative arcs. Feel free to adjust parameters like radius, pane width, and height to fit your specific design requirements.
Is there anything specific you would like to change or add to this design?
|