diff --git a/screw.scad b/screw.scad index 917350c..c60ef1b 100644 --- a/screw.scad +++ b/screw.scad @@ -1,3 +1,5 @@ +include + /* common screw parameter length pitch = length/rotations: the distance between the turns of the thread @@ -5,30 +7,48 @@ outside_diameter inner_diameter: thickness of the shaft */ -module helix(pitch, length){ +module helix(pitch, length, slices=500){ + rotations = length/pitch; + linear_extrude(height=length, center=false, convexity=10, twist=360*rotations, slices=slices, $fn=100) + child(0); } module auger(pitch, length, outside_diameter, inner_diameter) { - rotations = length/pitch; - union() { - linear_extrude(height=length, center=false, convexity=10, twist=360*rotations, slices=100, $fn=1000) - polygon(points=[[10,10],[100,1],[100,-1],[10,-10]], paths=[[0,1,2,3]]); - cylinder(h=length, r=20); - } + union(){ + helix(pitch, length) + polygon(points=[[10,10],[100,1],[100,-1],[10,-10]], paths=[[0,1,2,3]]); + cylinder(h=length, r=20); + } } translate([300, 0, 0]) auger(100, 300); -module ball_groove(pitch, rotations, diameter, bearing_radius=10) { - rotations = length/pitch; - linear_extrude(height = 10, center = false, convexity = 10, twist = 360, $fn = 1000) +module ball_groove(pitch, length, diameter, ball_radius=10) { + helix(pitch, length, slices=100) translate([diameter, 0, 0]) - circle(r = bearing_radius); + circle(r = ball_radius); } -ball_groove(100, 300, 10); +translate([0, 300, 0]) ball_groove(100, 300, 10); + + +module ball_groove2(pitch, length, diameter, ball_radius, slices=200){ + rotations = length/pitch; + radius=diameter/2; + offset = length/slices; + union(){ + for (i = [0:slices]) { + assign (z = i*offset){ + translate(helix_curve(pitch, radius, z)) sphere(ball_radius, $fa=5, $fs=1); + } + } + } +} + +translate([0, 0, 0]) ball_groove2(100, 300, 100, 10); + module ball_screw(pitch, length, bearing_radius=2) {