// -*- C -*- holedia = 25.4; sidewidth = 5; tapewidth = 7; tapethick = 1; innerz = 10; basex = holedia + sidewidth*2; basey = holedia + tapewidth*2; bevelz = 3; bevelslope = 0.75; bevely = bevelz * bevelslope; sideslop = 0.5; basebaset = 2; sidewallt = 3; lidt = 2; endwallt = 2; zslop = 0.75; endslop = 0.75; module sheared_cube(sz, xperz, yperz) { multmatrix([[1,0,xperz,0], [0,1,yperz,0], [0,0,1, 0], [0,0,0, 1]]) cube(sz); } module Base(){ difference(){ union(){ for (mir=[0,1]) mirror([0,mir,0]) { translate([0, basey/2 - sidewallt, 0]) sheared_cube([basex, sidewallt, bevelz], 0, bevelslope); cube([basex, basey/2, basebaset]); rotate([90, 0, 90]) linear_extrude(height=endwallt) polygon([[-0.1, 0], [basey/2, 0], [basey/2 + bevely, bevelz], [basey/2 + bevely, innerz], [-0.1, innerz]]); } } translate([basex/2, 0, -1]) cylinder(r=holedia/2, h=bevelz+2); } } module Lid(){ lidx = basex + endslop + endwallt; for (mir=[0,1]) mirror([0,mir,0]) { translate([0, basey/2 + sideslop, 0]) sheared_cube([lidx, sidewallt, bevelz], 0, bevelslope); translate([0, basey/2 + sideslop + bevely, -tapethick]) cube([lidx, sidewallt, innerz + tapethick + lidt + zslop]); translate([0, -1, innerz + zslop]) cube([lidx, 1 + basey/2 + sideslop + bevely + sidewallt, lidt]); translate([basex + endslop, -1, -tapethick]) cube([endwallt, 1 + basey/2 + sideslop + bevely + sidewallt, tapethick + innerz + zslop + 0.1]); } } Base(); %Lid();