DIAM=22;
LEN=120;
THICK=1.35;

module base() {
    difference() {
        cylinder(h=LEN, d=DIAM, $fn=64);
        cylinder(h=LEN+1, d=DIAM-2*THICK, $fn=64);
    }
}

module cap() {    
    // front
    cylinder(h=3, d=DIAM, $fn=64);

    // hook
    difference() {
        union() {
            cylinder(h=20, d=DIAM-2*THICK-1, $fn=64);
            
            for ( y = [0:4] ) {
                translate([0,0, 5+y*3])
                hull() {
                    cylinder(h=0.1, d=DIAM-2*THICK-1, $fn=64);
                    translate([0,0,1])
                    cylinder(h=0.1, d=DIAM-2*THICK, $fn=64);
                }
            }
        }
        cylinder(h=25, d=DIAM-2*THICK-2*2, $fn=64);
    }
}

module handle_shape(l=0) {
   cylinder(h=l, d=DIAM+2*3, $fn=64);

   hull() {
    translate([0,0,LEN-50])
    cylinder(h=30, d=DIAM+2*3+5, $fn=64);
    
    translate([0,0, l])
    cylinder(h=LEN+3+8-l, d=DIAM+2*3, $fn=64);
            
    translate([30,10,LEN-40])
    cylinder(d=8, h=40, $fn=64);
   }
}

module handle() {
    difference() {
        handle_shape();

        translate([0,0,-1]) {
            for( z = [0:10] ) {
              translate([0,0,z*(LEN-5)/10]) {
                  hull() {
                      cylinder(h=0.1, d=DIAM+1, $fn=64);

                      translate([0,0,(LEN-5)/10])
                      cylinder(h=0.1, d=DIAM-1, $fn=64);
                  }
              }
            }
        }

        translate([0,0,LEN+3+5])
        difference() {
            cylinder(h=10, d=DIAM-3, $fn=64);
            
            translate([0,0,-8])
            cylinder(h=10, d=DIAM-8, $fn=64);
        }
    }
}

//color([1,0,0])
//cap();

module hexshape( h0=10 ) {
translate([0,0,0])
rotate([90,0,0])
for( x = [0:5] ) {
for( y = [0:10] ) {
    //translate([0, 0.8*(y*y) + 5 * y + 10,0])
    s0 = 0.6 + (y/24);
    s = (s0*s0);
    rotate([0, 80-(x*60) * s ,0])
    translate([0,(x%2)*7+y*13, DIAM/2+0.5])
    difference() {
    cylinder(h=h0, d=14*s, $fn=6);

    translate([0,0,-1])
    cylinder(h=h0+3, d=8*s, $fn=6);
    }
    }
}
}


color([0.8,0.8,0.8])
difference() {
    handle();
    
    intersection() {
    hexshape(100);
        translate([ 0,0, 5 ])
        cylinder(d=DIAM+100, h=LEN-2);
    }
}


/*
color([0.2,0.47,0.8])
{
    difference() {
        translate([0,0,LEN+5])
        cylinder(d=DIAM, h=5);
        handle();
    }
intersection() {
    hexshape(100);
    
    scale([0.95, 0.95, 1])
    handle_shape();
    
    translate([ 0,0, 5 ])
    cylinder(d=DIAM+1000, h=LEN-2);
}
}

*/