sidePoints = [[0,-10], [0,133], [-60.7,260], [-10,280], [130,260], [80,10]];

module frame(points, depth=7, width=15) {
    difference() {
        linear_extrude(depth) polygon(points);
        translate([0,0,-1]) linear_extrude(depth+2) offset(r=-width) polygon(points);
    }
}


include <voronoi.scad>;

module sideFrame() {
    minkowski() {
        $fn = 8;
        frame(sidePoints);
        sphere(3);
    }
    translate([0,0,5.77]) intersection(){
        linear_extrude(4) polygon(sidePoints);
        translate([50,172,-1]) rotate([0,0,90]) scale(2) voronoi(5);
    }
}


include <eurorack.scad>;

module railSetNutInsets() {
    translate(supportOffset) {
        nutInset();
        translate([0,122.5]) {
            nutInset();
        }
    }
}
module nutInset() {
    translate([0,0,5]) cylinder(r=4.25, h=5, $fn=6);
}

difference() {
    sideFrame();
    translate([2,-2,0]) {
        translate([0,0,6]) railRectSet(100, 1.04);
        translate([0,0,-10]) railSupportSet(100);
    }
    translate([-1,140,0]) rotate([0,0,25.5]) {
        translate([0,0,6]) railRectSet(100, 1.04);
        translate([0,0,-10]) railSupportSet(100);
    }
    translate([-10,272]) { rodHole(); nutInset(); }
    translate([121,253]) { rodHole(); nutInset(); }
    translate([74,17]) { rodHole(); nutInset(); }
}

