modules.scad 3.04 KB
include<vars.scad>

module materialDot(radius, height, roundness) {
  roundness = roundness >= height/2 ? height/2-0.000001 : roundness;
  translate([0,0, roundness]) minkowski() {
    linear_extrude( height = height-roundness*2
                    , convexity = 100
                    , twist = 0 )
      circle( r=radius-roundness);
    sphere(r=roundness);
  }
}

module shapeZ(x,y,z) {
  translate([-3,-3,-250]) minkowski() {
  cube([
        x-(offset-3)*2,
        y-(offset-3)*2,
        1
        ]);
  cylinder(
           r=offset-3,
           h=500,
           $fn=50
           );
}
/* translate([0,0,-250]) minkowski() { */
/* cube([ */
/*       x-(offset)*2, */
/*       y-(offset)*2, */
/*       1 */
/*       ]); */
/* cylinder( */
/*          r=offset, */
/*          h=500, */
/*          $fn=50 */
/*          ); */
/* } */
}

module volume(x,y,z,extra) {
  hull() {minkowski() {
      translate([strength*1.5,strength*1.5,0]) cube([
                                                     x-(offset)*2-strength*3,
                                                     y-(offset)*2-strength*3,
                                                     1
                                                     ]);
      sphere(r=roundborderInner+extra);
    }
    minkowski() {
      translate([0,0,z]) cube([
                               x-(offset)*2,
                               y-(offset)*2,
                               1
                               ]);
      sphere(r=roundborderInner+extra);
    }
  }

}

module handleShape(x,y,z,extra,bool,borders){
  union() {
      if(bool==true) volume(x,y,z,0);
      translate([
                 x/2 - handleWidth/2 - offset,
                 -( offset+10 ),
                 z-(20.6+roundborderInner+strength*3)
                 ]) {
        if(bool==true && borders!=false){
          translate([-strength*2,0,0]) rotate([90,0,90])  linear_extrude(height = 140, center = false, convexity = 10)
            polygon(points=[[-10,-50]
                            ,[25.7-2,-50]
                            ,[25.4-2,-33.3]
                            ,[18.5,-33.3]
                            ,[18.5,-30]
                            ,[10,-5]
                            ,[10,strength]
                            ,[20,strength]
                            ,[20,10]
                            ,[-10,10]
                            ]);
        }
        hull(){
          /* #translate([-extra,0,-10])cube([handleWidth+extra*2,50,10]); */
          rotate([-90,0,0]) union() {
            translate([2.5,2.5,0]) cylinder(r=2.5+extra,h=50);
            translate([handleWidth-2.5,2.5,0]) cylinder(r=2.5+extra,h=50);
          }
          translate([handleCorner,0,handleCorner-handleHeight]) rotate([-90,0,0]) union() {
            cylinder(r=handleCorner+extra,h=50);
            translate([handleWidth-handleCorner*2,0,0]) cylinder(r=handleCorner+extra,h=50);
          }
        }
      }
      /* shapeZ(x,y,z); */
      /* translate([-strength*2,0+gratesize+10,-45]) */
      /*                   cube([handleWidth+strength*4,60,60]); */

    }
}