lid.scad 1.97 KB
include<vars.scad>
include<modules.scad>

module lidbordertop(x,y,offset) {
  translate([ roundborderInner+strength*2 + offset
              , roundborderInner+strength*2 + offset
              , 0.1
              ]) difference() {
    minkowski() {
      cube([ x-(roundborderInner+strength*2)*2 - offset*2
           , y-(roundborderInner+strength*2)*2 - offset*2
           , 0.1
           ]);
      cylinder( r=roundborderInner+strength
              , h=0.95 - 0.2
              );
    }
    minkowski() {
      translate([strength,strength,-0.5])
        cube([ x-(roundborderInner+strength*3)*2 - offset*2
             , y-(roundborderInner+strength*3)*2 - offset*2
             , 0.1
             ]);
      cylinder( r=roundborderInner
              , h=2
              );
    }
  }
}

module tubpositive(x,y,offset) {
   difference(){
    minkowski() {
      translate([ offset
                  , offset
                  , roundborderInner-lidrecess
                  ]) cube([ x-offset*2
                            , y-offset*2
                            , 1
                            ]);
      sphere(r=roundborderInner);
    }
    translate([0,0,0.1]) cube([ x
                              , y
                              , 2
                              ]);
  }
}

module tubnegative(x,y,offset) {
  minkowski() {
    translate([ offset+strength
                , offset+strength
                , -lidrecess+strength+roundborderInner/2
                ]) cube([ x-offset*2-strength*2
                          , y-offset*2-strength*2
                          ,  1
                          ]);

    sphere(r=roundborderInner/2);
  }
}


module euroboxlid(x,y) {
  translate([0,0,lidrecess]){
    difference() {
      union() {
        lidbordertop(x,y,1.4);
        tubpositive(x,y,2.8);
        intersection() {
          cube([x,y,strength]);
          translate([offset, offset, roundborderInner+strength])
            shapeZ(x,y);
        }
      }
      tubnegative(x,y,2.8);
    }
  }
}