From 3e67da7f9c7fcb528337e9a801f4abf9e9d39a49 Mon Sep 17 00:00:00 2001 From: Jan Huwald Date: Mon, 26 Jan 2015 12:22:31 +0100 Subject: add screw diff --git a/gimbal.scad b/gimbal.scad index 192cc54..ff13158 100644 --- a/gimbal.scad +++ b/gimbal.scad @@ -4,8 +4,9 @@ cutoff = 3; c = 3; base = 10; -screw_len = 0.8 * (d - 2*cutoff); +screw_len = 15; screw_dia = 25.4/4; +screw_head_len = 5; mount_screw_dia = 4; mount_screw_head_dia = 10; @@ -16,10 +17,29 @@ retainer_dia = 1; e = 0.01; $fn = 500; +use ; + module screw() { - cylinder(r=screw_dia/2, h=screw_len); + translate([0, 0, 2*screw_head_len - screw_dia/2]) + thread_imperial(1/16, screw_dia/25.4, 12, screw_len*16/25.4); + + intersection() { + cylinder(r1=2*screw_head_len, r2=0, h=2*screw_head_len); + cube([2*screw_head_len, 2*screw_head_len, 10*screw_head_len], center=true); + } } +module two_half_screws() + for (i = [0,1]) + translate([i*2*screw_head_len, -i*(screw_len + screw_head_len), 0]) + intersection() { + rotate([90, i*180, i*180]) + screw(); + + translate([0, 0, 50]) + cube(100, center=true); + } + module grip() for (i = [0:19]) rotate(i*360/20) @@ -28,11 +48,23 @@ module grip() module ball() difference() { + // sphere with top and bottom cap removed sphere(d/2); - translate([0, 0, d/2 - cutoff - screw_len + e]) screw(); for (i = [-1,1]) translate([0, 0, i * (d - cutoff)]) cube(d, center=true); + // screw hole (thin ot the top, thickening in the center, big + // square at the bottom) + translate([0, 0, d/2 - cutoff - screw_len/2 + screw_head_len/2]) { + cylinder(r=screw_dia/2, h=d, center=true); + + mirror([0, 0, 1]) + intersection() { + cylinder(r1=0, r2=d, h=d); + cube([2*screw_head_len, 2*screw_head_len, 10*screw_head_len], center=true); + } + } + // horizontal grip grip(); // vertical grip at the upper half sphere (but not at the top) diff --git a/simplethreads.scad b/simplethreads.scad new file mode 100644 index 0000000..7ecd2b2 --- /dev/null +++ b/simplethreads.scad @@ -0,0 +1,149 @@ +// Metric Screw Thread Library +// by Maximilian Karl (2014) +// modified the api to create internal threads, smooth the start and +// stop threads, and use imperial units: +// +// +// +// use module thread_imperial(pitch, majorD, stepAngle, numRotations, tol, internal) +// or thread(pitch, majorD, stepAngle, numRotations, tol, internal) +// with the parameters: +// pitch - screw thread pitch +// majorD - screw thread major diameter +// step - step size in degrees (36 gives ten steps per rotation) +// numRotations - the number of full rotations of the thread +// tol - (optional parameter for internal threads) the amount to increase the +// thread size in mm.Default is 0 +// internal - (optional parameter for internal threads) - this can be set true or +// false. Default is true + +root3 = sqrt(3); +root3div3 = root3/3; + +//----------------------------------------------------------------------------------------------- +//EXAMPLES: +//example: this creates a 3/8-inch 16TPI bolt using metric units +thread(1.5875,9.5250,12,12); + +//the same thread using imperial units +//thread_imperial(1/16,3/8,12,12); + +//an internal thread that will accomodate the two examples above +translate([15,0,0]){ +difference(){ + cylinder(r=8,h=8); + translate([0,0,-1.5875/2]){thread(1.5875,9.5250,12,8, 0.2, true);} +}} +//------------------------------------------------------------------------------------------------ + +//Creates a thread cross section starting with an equilateral triangle +//and removing the point. Internal threads (for creating nuts) will +//have a non-zero tolerance value which enlarges the triangle to +//accomodate a bolt of the same size +module screwthread_triangle(P, tol) { + cylinderRadius=root3div3*(P+2*tol); + translate([2*tol,0,0]){ + difference() { + translate([-cylinderRadius+root3/2*(P)/8,0,0]) + rotate([90,0,0]) + cylinder(r=cylinderRadius,h=0.00001,$fn=3,center=true); + + translate([-tol,-P/2,-P/2]){ + cube([P,P,P]); + } + + translate([-P,-P/2,P/2]){ + cube([P,P,P]); + } + + translate([-P,-P/2,-3*P/2]){ + cube([P,P,P]); + } + } + } +} + +//Hulls two consecutive thread triangles to create a segment of the thread +module threadSegment(P,D_maj, step, tol){ + for(i=[0:step:360-step]){ + hull() + for(j = [0,step]) + rotate([0,0,(i+j)]) + translate([D_maj/2,0,(i+j)/360*P]) + screwthread_triangle(P, tol); + } +} + +//Places enough thread segments to create one full rotation. The first +//and last portion of external threads (for making bolts) are tapered +//at a 20 degree angle for an easier fit +module screwthread_onerotation(P,D_maj,step, tol=0, first=false, last=false, internal=false) { + H = root3/2*P; + D_min = D_maj - 5*root3/8*P; + + if(internal==false){ + difference(){ + threadSegment(P,D_maj, step, 0); + if(first==true){ + //echo("first thread"); + translate([D_maj/2-P/2,0,-P/2]){ + rotate(-20,[0,0,1]){translate([0,-P*5,0]){cube([P,P*10,P]); }}} + } + + if(last==true){ + //echo("last thread"); + translate([D_maj/2-P/2,0,-P/2+P]){ + rotate(20,[0,0,1]){translate([0,-P*5,0]){cube([P,P*10,P]); }}} + } + } + + }else{ + threadSegment(P,D_maj+tol, step, tol); + } + + + //make the cylinder a little larger if this is to be an internal thread + if(internal==false){ + translate([0,0,P/2]) + cylinder(r=D_min/2,h=2*P,$fn=360/step,center=true); + }else{ + translate([0,0,P/2]) + cylinder(r=D_min/2+tol,h=2*P,$fn=360/step,center=true); + } +} + +//creates a thread using inches as units (tol is still in mm) +module thread_imperial(pitch, majorD, stepAngle, numRotations, tol=0, internal = false){ + p=pitch*25.4; + d=majorD*25.4; + thread(p,d,stepAngle,numRotations, tol); +} + +//creates a thread using mm as units +module thread(P,D,step,rotations, tol=0, internal = false) { + // added parameter "rotations" + // as proposed by user bluecamel + for(i=[0:rotations-1]) + translate([0,0,i*P]){ + if(i==0&&rotations<=1){ + screwthread_onerotation( + P,D,step, tol, true, true, internal); //first if there is only one rotation + }else if(i==0){ + screwthread_onerotation( + P,D,step, tol, true, false, internal); //first if more than one rotation + }else if(i==rotations-1){ + screwthread_onerotation( + P,D,step, tol, false, true, internal); //last if more than one rotation + }else{ + screwthread_onerotation( + P,D,step, tol, false, false, internal); //middle threads + } + } +} + + + + + + + -- cgit v0.10.1