Source

uniqxstuff / openscad / faucet.scad

Full commit
/////////////////////////////////////////////////////////////////////////
//                                                                     //
//          DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE                //
//                  Version 2, December 2004                           //
//                                                                     //
// Copyright (C) 2011 Clifford, uniqx                                  //
//  Metalab, 1010 Vienna, Austria                                      //
// Everyone is permitted to copy and distribute verbatim or modified   //
// copies of this license document, and changing it is allowed as long //
// as the name is changed.                                             //
//                                                                     //
//            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE              //
//   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION   //
//                                                                     //
//  0. You just DO WHAT THE FUCK YOU WANT TO.                          //
//                                                                     //
/////////////////////////////////////////////////////////////////////////

sides = 8;

radius_front = 25;
radius_rear = 20;
recess_radius = 13;
cog_socket_radius = 8/2;

roundings = 5;

cog_count = 20;
cog_height = 2/4; 
cog_width = 1/4;

height = 50;
recess_height = 18;
cog_socket_height = 40;

union(){

  
  for(i = [1:cog_count] ){

    translate([0,0,height-cog_socket_height])
    rotate([0,0,i*360/cog_count])
    //cube([cog_socket_height-recess_height,cog_height,cog_width]);
    translate([0,cog_socket_radius-cog_height])
    linear_extrude(height=cog_socket_height-recess_height)
    polygon(points=[[-cog_width/2,cog_height],[cog_width/2,cog_height],[0,0]], paths=[[0,1,2]]);

  }

  difference() {

    translate([0,0,roundings]){
      minkowski(){

        cylinder(
          r1 = radius_front - roundings,
          r2 = radius_rear - roundings,
          h = height - (2*roundings),
          $fn = sides
        );

        sphere(r=roundings);

      }
    }

    translate([0, 0, height - cog_socket_height])
      cylinder(r = cog_socket_radius, h = height, $fn=50);
    translate([0, 0, height - recess_height])
      cylinder(r = recess_radius, h = height);
  }
}