Tag: 2d

  • OpenSCAD might not’ve been the best choice here

    OpenSCAD might not’ve been the best choice here

    OpenSCAD might not’ve been the best choice here

    Yup, lots of circles, intersections, differences and offsets went into this attempt at the logo of my favourite museum.

    For the determined/demented, here’s the source. It’s probably not that useful for learning OpenSCAD, as it’s written in my typical “carve away all the bits that don’t look like an elephant” style:

    // akm logo - why yes this *is* a good tool to use ...
    
    // constants for octagon maths
    r1 = 1 - sqrt(2) / 2;           // ~0.292893
    r2 = sqrt(r1);                  // ~0.541196
    x1 = (sqrt(2) - 1) / 2;         // ~0.207107
    
    sc = 100;                       // size factor
    t = 4;                          // line thickness
    bigt = 7;                       // strapwork gap thickness
    $fn = 256;                      // OpenSCAD circle smoothness
    
    module petal() {
        intersection() {
            translate([ sc * x1, sc * x1])circle(r = sc * r2);
            translate([-sc * x1, sc * x1])circle(r = sc * r2);
        }
    }
    
    module hollow_petal() {
        difference() {
            offset(r =  t / 2)petal();
            offset(r = -t / 2)petal();
        }
    }
    
    module inner_lobe() {
        difference() {
            for (i = [0:3]) {
                rotate(i * 90 + 45)offset(r = t / 2)petal();
            }
            for (i = [0:3]) {
                rotate(i * 90 + 45)offset(r = -t / 2)petal();
            }
        }
    }
    
    module ring() {
        for (i = [0:3]) {
            rotate(i * 90)difference() {
                intersection() {
                    inner_lobe();
                    union() {
                        offset(r = -bigt / 2)petal();
                        rotate(45)offset(r = t / 2)petal();
                    }
                }
                rotate(90)offset(r = bigt / 2)petal();
            }
        }
    }
    
    module logo() {
        union() {
            ring();
            for (i = [0:3]) {
                rotate(90 * i)union() {
                    intersection() {
                        hollow_petal();
                        rotate(-90)offset(r = -bigt / 2)petal();
                    }
                    difference() {
                        intersection() {
                            hollow_petal();
                            rotate(45)offset(r = -bigt / 2)petal();
                        }
                        rotate(-90)offset(r = bigt / 2)petal();
                    }
                    
                    difference() {
                        hollow_petal();
                        offset(r = bigt / 2)union() {
                            rotate(-90)petal();
                            rotate(45)petal();
                        }
                    }       
                }
            }
        }
    }
    
    logo();