x_size = 20;           // horizontal outer size of the aquarium pedestal. 
y_size = 20;           // 
thickness = 10;         // thickness of the pad bellow aquarium. hairs lenght is 12mm. 
rim_height = 7;        // height of upper rim for fixing the aquarium in position.

mount_hole = 3.5;
clear = 0.175;


// aquarium pad

difference () {
    intersection() {
        union(){    // bottom part with rim/fixing pin
                rotate([0,0,45])
                    cube([x_size, y_size ,thickness], center = true);
                translate ([sqrt(pow(x_size,2) + pow(x_size,2))/4, sqrt(pow(x_size,2) + pow(x_size,2))/4, thickness/2 + rim_height/2])
                    cube([sqrt(pow(x_size,2) + pow(x_size,2))/2, sqrt(pow(x_size,2) + pow(x_size,2))/2, rim_height], center = true);

            };

        rotate([0,0,45])
                cube([x_size, y_size ,4*thickness], center = true);
    }
    cylinder (h = thickness + rim_height, r= mount_hole, $fn=20);   // hole for screw head
    
    translate ([0, 0, -thickness])      // hole for the screw 
        cylinder (h = thickness + rim_height, r= mount_hole/2, $fn=10);
    
    rotate([0,0,-45])       // hole for top part mounting nut
        translate ([ 0, -x_size/3, thickness/3])    
            cube([5.5, 2.5, thickness], center = true);

    rotate([90,0,-45])      // hole for top part mounting screw.
        translate ([ 0, thickness/4, 0])    
            cylinder (h = thickness + rim_height, r= mount_hole/2, $fn=10);

}


translate ([0, 0, 3*thickness])    // separate two parts


//Top part

difference () {

    rotate([0,0,-45])
        translate ([0, -3, rim_height/3])    
                cube([x_size, y_size ,thickness + rim_height/4 ], center = true);

    rotate([90,0,-45])
        translate ([0, 0, rim_height/3])    
            minkowski() {
                cube([0.5,3,10]);
                cylinder(r=1.5,h=1,$fn=50);
            }

wall_thickness = 2;
    
        union(){    // copy of bottom part
                rotate([0,0,45])
                    cube([x_size, y_size ,thickness], center = true);
                translate ([sqrt(pow(x_size,2) + pow(x_size,2))/4 -wall_thickness, sqrt(pow(x_size,2) + pow(x_size,2))/4 -wall_thickness, thickness/2 + rim_height/2])
                    cube([sqrt(pow(x_size,2) + pow(x_size,2))/2, sqrt(pow(x_size,2) + pow(x_size,2))/2, rim_height], center = true);

            };    
}