// humper: a ring cam, // a pulley (flange) drives this cam // which drives a 'piston' with a cross pin up&down // the cross pin rides on this cam surface // // the cam is generated from many tall pie slices // the height of the slice follows a cosine path // //05apr revisited // the cam is correct now but stairstepped // if i smooth it by decreasing the pie slice angle // it appears smoother till zoomed // is there a better way to generate this cam surface? // i know i can tilt the surface of each slice // andlgling from half prev delta to half next delta // but thats another kind of step, not really smooth // //03apr revisited- // TODO make the ramp smooth // there maybe some hints in the 'screw thread ' discussions and libraries of openSCAD // green=[0,1,0]; blue=[0,0,1]; bg=[0,.8,.8]; //-------- cam data camOR=12.4; camIR=8.1; camAngle=40; // each pie slice poly is between 2 chords // the chord at inner dia // and the chord at the outer dia // each pie slice poly has 2 sides // which lie on radii // *************** funcs to find chords *********** // the important angle is not the sliceAngle/2 nor the rt angle // in the half triangle from center to half chord... // the important angle is the angle // between radius and chord // i call theta //-------- pulley pulleyThx=11; pulleyRad=21; //beltClearance = 4; //humperFlangeThx=8.7; humperFlangeThx=pulleyThx; //-------- cam drives saw holder up/down //function pi()=3.14159265358979323846; //Deg2Rad = pi() / 180; // vvv the birdseye pie slice angle ( tall pie slice) s=10;// slice angle AND loop step size, every N deg // the cam is generated above and below a central vetrical position // this centreallized approach is useful in othe code // vvv these funcs calc the sides of the keystone shape of the pie slice ( birdseye view) // func theta() rtns the 'other angle' // ( the angle between radius and halfchord ) function theta(sliceAngle) = (90 - sliceAngle/2); function halfChord(dia,theta) = (dia/2)*cos(theta); function ctr2halfChord(dia,theta) = (dia/2) * sin(theta); function chord2circumference(dia,ctr2chord) = (dia/2) - ctr2chord; t=theta(s); halfChordID=2*(halfChord(camIR,t)); halfChordOD=2*(halfChord(camOR,t)); c2chordID=ctr2halfChord(camIR*2,t); c2chordOD=ctr2halfChord(camOR*2,t); chord2circumferenceID=chord2circumference(camIR*2,c2chordID); chord2circumferenceOD=chord2circumference(camOR*2,c2chordOD); // the polygon ( a keystone shape) wedgePts = [ [ -halfChordOD,-c2chordOD ], [ -halfChordID,-c2chordID ], [ +halfChordID,-c2chordID ], [ +halfChordOD,-c2chordOD ] ]; wedgePaths=[[0,1,2,3]]; // the code above solves the base polygon ( a keystone shape) // for later extrusion // the code below makes a cyl-like // form with an approx. cam top // I'd like a smooth surface // but this technique gets smooth // with infinite pie-slices // the cam drives a horz dowel pin and thus a central shaft // the dowel pin si constrained in a vertical pill shape slot in a relatively stationary sleeve ( between cam and shaft) // //-------- keySlot limits vert motion // vvv 0.57735026919 *(12.4+12.4) = 14.3182866759 keyTravel=(tan(camAngle)*(camOR+camOR)); // keyHalfTravel is 7.159143338 keyHalfTravel=(tan(camAngle)*camOR); xtra=0.1; // avoid tissue skins after subtracts module humper(keyHalfTravel,wedgePts, wedgePaths,s){ // 1st 180 deg of cam rises from minH for( i = [0: s: 180-s]){ rotate([0,0,i]){ dH=cos(i)*keyHalfTravel; thisH = keyHalfTravel + dH; linear_extrude(height = thisH, center = false){ polygon(wedgePts,wedgePaths,2); } } } // 2nd 180 deg loop drops down to minH for( i = [180+s: s : 360-s ]){ rotate([0,0,i]){ dH=cos(i)*keyHalfTravel; thisH = keyHalfTravel + dH; linear_extrude(height = thisH, center = false){ polygon(wedgePts,wedgePaths,2); } } } } // the cam sits on top of of a GT2 pulley // possible the cam is the hub but that seems like anig horz setscrew would tilt the cam, or excentric it color(bg) union(){ humper(keyHalfTravel,wedgePts,wedgePaths,s); translate([0,0,-(humperFlangeThx/2)]){ difference(){ cylinder(humperFlangeThx,pulleyRad,pulleyRad,center=true); cylinder(humperFlangeThx+xtra,camIR,camIR,center=true); } } }