openscad/stained glass window/stained glass window4


CLIP Score: 32.93

Image

Program

Conversation

stained glass window4 image
                scad
// Stained Glass Window Design

// Window Frame
module window_frame() {
    color("black") {
        difference() {
            square([150, 150], center=true); // Outer frame
            square([140, 140], center=true); // Inner cut-out
        }
    }
}

// Horizontal and Vertical Dividers
module dividers() {
    color("black") {
        // Horizontal dividers
        translate([-75, 37.5]) square([150, 5]);
        translate([-75, -37.5]) square([150, 5]);

        // Vertical dividers
        translate([-37.5, -75]) square([5, 150]);
        translate([37.5, -75]) square([5, 150]);
    }
}

// Pattern: Circle in the center
module center_circle() {
    color("yellow") {
        circle(30);
    }
}

// Pattern: Diamonds in each quadrant
module diamond() {
    color("red") {
        polygon(points=[[0,10],[10,0],[0,-10],[-10,0]]);
    }
}

module diamonds_in_quadrants() {
    translate([-52.5, 52.5]) rotate(45) diamond();
    translate([52.5, 52.5]) rotate(45) diamond();
    translate([-52.5, -52.5]) rotate(45) diamond();
    translate([52.5, -52.5]) rotate(45) diamond();
}

// Assemble the window
module stained_glass_window() {
    window_frame();
    dividers();
    translate([0, 0]) center_circle();
    diamonds_in_quadrants();
}

// Render the window
stained_glass_window();

                
                Please generate a 2D CAD file in OpenSCAD for stained glass window

Sure! Below is an example of an OpenSCAD script for a simple stained glass window design. This script will create a 2D CAD design of a rectangular window with a few geometric patterns inside it.

```scad
// Stained Glass Window Design

// Window Frame
module window_frame() {
    color("black") {
        difference() {
            square([150, 150], center=true); // Outer frame
            square([140, 140], center=true); // Inner cut-out
        }
    }
}

// Horizontal and Vertical Dividers
module dividers() {
    color("black") {
        // Horizontal dividers
        translate([-75, 37.5]) square([150, 5]);
        translate([-75, -37.5]) square([150, 5]);

        // Vertical dividers
        translate([-37.5, -75]) square([5, 150]);
        translate([37.5, -75]) square([5, 150]);
    }
}

// Pattern: Circle in the center
module center_circle() {
    color("yellow") {
        circle(30);
    }
}

// Pattern: Diamonds in each quadrant
module diamond() {
    color("red") {
        polygon(points=[[0,10],[10,0],[0,-10],[-10,0]]);
    }
}

module diamonds_in_quadrants() {
    translate([-52.5, 52.5]) rotate(45) diamond();
    translate([52.5, 52.5]) rotate(45) diamond();
    translate([-52.5, -52.5]) rotate(45) diamond();
    translate([52.5, -52.5]) rotate(45) diamond();
}

// Assemble the window
module stained_glass_window() {
    window_frame();
    dividers();
    translate([0, 0]) center_circle();
    diamonds_in_quadrants();
}

// Render the window
stained_glass_window();
```

### Explanation:
1. **Window Frame:** Using `difference` to create an outer frame by subtracting a slightly smaller square from a larger square.
2. **Dividers:** Adding horizontal and vertical dividers to segment the window into four quadrants.
3. **Center Circle:** Placing a circle at the center for added decorative effect.
4. **Diamonds:** Adding diamond shapes in each of the four quadrants.
5. **stained_glass_window:** Combining all these modules to assemble the stained glass window.

Copy this code into OpenSCAD and hit F5 to preview the window, then F6 to render it fully. You can adjust dimensions and colors as needed for your design.