MCAD-Library/screw.scad

65 lines
1.6 KiB
OpenSCAD
Raw Normal View History

2010-07-25 10:27:33 -05:00
// Parametric screw-like things (ball screws, augers)
2010-07-25 11:59:17 -05:00
// License: GNU GPL 2.0 or later.
2010-07-25 10:27:33 -05:00
// © 2010 by Elmo Mäntynen
2010-07-25 10:14:45 -05:00
include <curves.scad>
2010-07-24 08:13:39 -05:00
/* common screw parameter
length
pitch = length/rotations: the distance between the turns of the thread
outside_diameter
inner_diameter: thickness of the shaft
*/
//Uncomment to see examples
//test_auger();
//test_ball_groove();
//test_ball_groove2();
//test_ball_screw();
2010-07-24 08:13:39 -05:00
2010-07-25 10:14:45 -05:00
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);
2010-07-24 08:13:39 -05:00
}
module auger(pitch, length, outside_diameter, inner_diameter) {
2010-07-25 10:14:45 -05:00
union(){
helix(pitch, length)
polygon(points=[[10,10],[100,1],[100,-1],[10,-10]], paths=[[0,1,2,3]]);
cylinder(h=length, r=20);
}
2010-07-24 08:13:39 -05:00
}
module test_auger(){translate([300, 0, 0]) auger(100, 300);}
2010-07-24 08:13:39 -05:00
2010-07-25 10:14:45 -05:00
module ball_groove(pitch, length, diameter, ball_radius=10) {
helix(pitch, length, slices=100)
2010-07-24 08:13:39 -05:00
translate([diameter, 0, 0])
2010-07-25 10:14:45 -05:00
circle(r = ball_radius);
}
module test_ball_groove(){ translate([0, 300, 0]) ball_groove(100, 300, 10);}
2010-07-25 10:14:45 -05:00
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);
}
}
}
2010-07-24 08:13:39 -05:00
}
module test_ball_groove2(){translate([0, 0, 0]) ball_groove2(100, 300, 100, 10);}
2010-07-24 08:13:39 -05:00
module ball_screw(pitch, length, bearing_radius=2) {
}
module test_ball_screw(){}