Uit Hack42
Ga naar: navigatie, zoeken
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

ratchet.scad

An example of ratchet(10,6,3,5,7,1)
module tooth(base, height, tipl, tiph, width) {
	difference() {
		intersection() {
			translate([-(base+tipl)/2,0,0]) cube([base+tipl,height,width], center = false);
			scale(v=[1,(height/(base+tipl))*2,0]) cylinder(r=(base+tipl)/2,h=width, $fs=0.01);
		}
		translate([-(base/2+tipl/2),0,0])
		  polyhedron(	points = [ [0,0,0],[0,0,width],[0,tiph,0],[0,tiph,width],[tipl,0,0],[tipl,0,width] ],
					triangles = [ [1,3,5],[0,4,2],[0,2,1],[2,3,1],[0,1,4],[4,1,5],[2,4,5],[2,5,3] ]);
	}
}

//tooth2(7,7,5,5,1);

module ratchet(diam, nrteeth, height, tipl, tiph, width) {
	//moves teeth down by this distance
	down = 0.01 + (diam - diam * cos(180/nrteeth));
	//make sure tooth's height is not lower than down movement
	if (height <= down) {
		ratchet2(diam, nrteeth, down, tipl, tiph, width, down);
	} else {
		ratchet2(diam, nrteeth, height, tipl, tiph, width, down);
	}
}

module ratchet2(diam, nrteeth, height, tipl, tiph, width, down) {
	// calculate tooth's base
	base = 2 * sin(180/nrteeth) * diam;
	union() {
		cylinder(h=width,r=diam);
		//teeth
		for ( i = [0 : (nrteeth-1)] ) {
			rotate( i * 360 / nrteeth, [0, 0, 1])
			translate([-(0.25*base), (diam-2*down), 0]) // check the .25
			tooth(base, height, tipl, tiph, width);
		}
	}
}

ratchet(10,6,3,5,7,1);

adjWheel.scad

An example of adjWheel(7,3)
module adjWheel(radius, width) {
	circ = 2*radius*3.14159;
	notch = (circ/40)*0.95;
	edge = (circ-(notch*20))/400;
	union() {
		difference() {
			cylinder(h=width,r=radius,$fs=0.01);
			//notches
			for ( i = [0:19] ) {
				rotate( i * 360 / 20, [0,0,1])
				translate([radius,0,0])
				cylinder(h=width+0.01,r=notch,$fs=0.01);
			}
		}
		//rounded edges
		for ( i = [0:19] ) {
			rotate( i * 360 / 20, [0,0,1])
			translate([radius-2*edge,notch+edge,0])
			cylinder(h=width,r=edge,$fs=0.01);
		}
	}
}

adjWheel(7,3);

notchRing.scad