287 lines
9.5 KiB
OpenSCAD
287 lines
9.5 KiB
OpenSCAD
/* Thanks to Dan Kirshner for the threads module:
|
|
* https://www.dkprojects.net/openscad-threads/
|
|
*
|
|
* The design consists of 4 different parts when using bearings.
|
|
* When not using bearings, the only useful part is the main axle.
|
|
* The standard settings fit 608 ball bearings.
|
|
*/
|
|
|
|
// Choose between using bearings or just the axle
|
|
use_bearings = true;
|
|
|
|
// Choose the part(s) to generate:
|
|
part_type = 6; // Main axle = 1, Bearing support rod = 2, clip = 3,
|
|
// washer = 4, all (for printing) = 5, assembly = 6
|
|
|
|
// Main axle sizes
|
|
main_cyl_diam = 32; // Diameter of middle part of the axle
|
|
thread_length = 10; // Thread length on each side of the axle
|
|
axle_main_part_length = 112; // Length of the middle part.
|
|
// (where the spool is resting)
|
|
main_axle_chamfer = 0.75; // How much chamfer to add to the main axle
|
|
|
|
// Bearing sizes
|
|
bearing_outside_diam = 22;
|
|
bearing_inside_diam = 8;
|
|
bearing_width = 7;
|
|
bearing_dist = 70; // Distance between the centers of the two bearings
|
|
space = 2; // Extra space for the bearing holes
|
|
// Needs to be at least 2*washer_thickness for the washers to fit
|
|
// However, mounting without washers is also possible.
|
|
stick_out_dist = 1; // distance by which the bearing has to
|
|
// stick out of the axle
|
|
// (so that the filament spool touches the bearing,
|
|
// and not the axle)
|
|
|
|
// Bearing support rod parameters
|
|
groove_width = 2;
|
|
groove_depth = 1;
|
|
end_stop_thickness = 2;
|
|
chamfer = 1;
|
|
cut_off_factor = 1/6; // How much to cut off from the rod
|
|
// (in order to print easily)
|
|
total_length = axle_main_part_length+2*thread_length
|
|
+end_stop_thickness
|
|
+2*groove_width
|
|
+chamfer;
|
|
groove_height = total_length-2*groove_width-chamfer;
|
|
|
|
// Clip params
|
|
clip_inside_radius = bearing_inside_diam/2 - groove_depth;
|
|
clip_wall_width = 3;
|
|
clip_outside_radius = clip_inside_radius+clip_wall_width;
|
|
clip_thickness = groove_width-0.5;
|
|
clip_opening_width = clip_inside_radius*2 - 1.5;
|
|
|
|
// Washer params
|
|
washer_thickness = 0.5;
|
|
washer_wall_width = 2;
|
|
washer_inside_space = 0.5;
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// ----------------------------------------------------------------------------
|
|
|
|
include <threads.scad>
|
|
// metric_thread (diameter, pitch, length) washer_thickness = 0.5;
|
|
|
|
$fn = 100;
|
|
small_dist = 0.01;
|
|
|
|
// Calculate offset so that bearing stick out the desired distance
|
|
hole_center_dist = main_cyl_diam/2 - bearing_outside_diam/2 + stick_out_dist;
|
|
|
|
module chamfered_threaded_part( length,
|
|
chamfer=1,
|
|
bottom_chamfer=false,
|
|
top_chamfer=false)
|
|
{
|
|
diameter = 30;
|
|
difference(){
|
|
metric_thread (diameter, 1.5, length);
|
|
if(bottom_chamfer){
|
|
rotate_extrude()
|
|
translate([diameter/2,0,0])
|
|
rotate([0,0,45])
|
|
square(chamfer*2, center=true);
|
|
}
|
|
if(top_chamfer){
|
|
rotate_extrude()
|
|
translate([diameter/2,length,0])
|
|
rotate([0,0,45])
|
|
square(chamfer*2, center=true);
|
|
}
|
|
}
|
|
}
|
|
|
|
module chamfered_cylinder(length, radius, chamfer){
|
|
difference(){
|
|
cylinder(h=length,r=radius);
|
|
|
|
rotate_extrude()
|
|
translate([radius,0,0])
|
|
rotate([0,0,45])
|
|
square(chamfer*2, center=true);
|
|
|
|
rotate_extrude()
|
|
translate([radius,length,0])
|
|
rotate([0,0,45])
|
|
square(chamfer*2, center=true);
|
|
}
|
|
}
|
|
|
|
module bearing_hole(bearing_diam, bearing_width, axle_diam, space){
|
|
union(){
|
|
cylinder(r=bearing_diam/2+space/2, h=bearing_width+space);
|
|
linear_extrude(height=bearing_width+space)
|
|
translate([-bearing_diam/2-space/2,0,0])
|
|
square([bearing_diam+space, axle_diam]);
|
|
}
|
|
}
|
|
|
|
module cylinder_part(length, diam, chamfer){
|
|
// Chamfer edges
|
|
radius = diam/2;
|
|
chamfered_cylinder(length, radius, chamfer);
|
|
}
|
|
|
|
module main_axle_part(){
|
|
difference(){
|
|
union(){
|
|
translate([0,0,thread_length]){
|
|
difference(){
|
|
cylinder_part( axle_main_part_length,
|
|
main_cyl_diam,
|
|
main_axle_chamfer);
|
|
if(use_bearings){
|
|
translate([0,0,axle_main_part_length/2+bearing_dist/2-(bearing_width+space)/2])
|
|
bearing_hole( bearing_outside_diam,
|
|
bearing_width,
|
|
main_cyl_diam,
|
|
space);
|
|
translate(
|
|
[0,0,axle_main_part_length/2-bearing_dist/2-(bearing_width+space)/2]
|
|
)
|
|
bearing_hole( bearing_outside_diam,
|
|
bearing_width,
|
|
main_cyl_diam,
|
|
space);
|
|
}
|
|
}
|
|
}
|
|
|
|
chamfered_threaded_part(thread_length, bottom_chamfer=true);
|
|
translate([0,0,axle_main_part_length+thread_length]){
|
|
chamfered_threaded_part(thread_length, top_chamfer=true);
|
|
}
|
|
}
|
|
|
|
if(use_bearings){
|
|
// Calculate offset so that bearing stick out the desired distance
|
|
hole_center_dist = main_cyl_diam/2 - bearing_outside_diam/2 + stick_out_dist;
|
|
translate([0,hole_center_dist,-small_dist])
|
|
cylinder(r = bearing_inside_diam/2,
|
|
h=2*thread_length+axle_main_part_length+2*small_dist);
|
|
}
|
|
}
|
|
}
|
|
|
|
module bearing_support_rod(){
|
|
difference(){
|
|
union(){
|
|
linear_extrude(2)
|
|
circle(r=bearing_inside_diam);
|
|
difference(){
|
|
chamfered_cylinder( total_length,
|
|
bearing_inside_diam/2,
|
|
chamfer);
|
|
translate([0,0,groove_height])
|
|
linear_extrude(groove_width)
|
|
difference(){
|
|
circle(r=bearing_inside_diam/2+small_dist);
|
|
circle(r=bearing_inside_diam/2-groove_depth);
|
|
}
|
|
}
|
|
}
|
|
|
|
translate([ 0,
|
|
-(1.5*bearing_inside_diam+small_dist)
|
|
+cut_off_factor*bearing_inside_diam,
|
|
total_length/2])
|
|
cube([ 2*(bearing_inside_diam+small_dist),
|
|
2*(bearing_inside_diam+small_dist),
|
|
total_length+2*small_dist],
|
|
center=true);
|
|
}
|
|
}
|
|
|
|
module clip(){
|
|
linear_extrude(clip_thickness)
|
|
difference(){
|
|
circle(r=clip_outside_radius);
|
|
circle(r=clip_inside_radius);
|
|
translate([0,clip_outside_radius/2+small_dist,0])
|
|
square([clip_opening_width, clip_outside_radius],center=true);
|
|
}
|
|
}
|
|
|
|
module washer(){
|
|
linear_extrude(washer_thickness)
|
|
difference(){
|
|
circle(r=bearing_inside_diam/2+washer_wall_width+washer_inside_space);
|
|
circle(r=bearing_inside_diam/2+washer_inside_space);
|
|
}
|
|
}
|
|
|
|
if(part_type==1){
|
|
main_axle_part();
|
|
}
|
|
if(part_type==2){
|
|
bearing_support_rod();
|
|
}
|
|
if(part_type==3){
|
|
clip();
|
|
}
|
|
if(part_type==4){
|
|
washer();
|
|
}
|
|
|
|
if(part_type==5){
|
|
part_space = 5;
|
|
|
|
main_axle_part();
|
|
if(use_bearings){
|
|
translate([-(main_cyl_diam/2+bearing_inside_diam+part_space),
|
|
total_length/2,
|
|
bearing_inside_diam/2-cut_off_factor*bearing_inside_diam])
|
|
rotate(90,[1,0,0])
|
|
bearing_support_rod();
|
|
translate([0,-(main_cyl_diam/2+part_space+clip_outside_radius),0])
|
|
clip();
|
|
|
|
y_dist = main_cyl_diam/2+part_space+2*washer_wall_width+bearing_inside_diam;
|
|
x_dist = 2*washer_wall_width+bearing_inside_diam + part_space;
|
|
translate([0,y_dist,0])
|
|
washer();
|
|
translate([x_dist,y_dist,0])
|
|
washer();
|
|
translate([0,y_dist+x_dist,0])
|
|
washer();
|
|
translate([x_dist,y_dist+x_dist,0])
|
|
washer();
|
|
}
|
|
}
|
|
|
|
if(part_type==6){
|
|
color("gray")
|
|
translate([0,0,end_stop_thickness])
|
|
main_axle_part();
|
|
if(use_bearings){
|
|
translate([0,hole_center_dist,0])
|
|
color("Blue")
|
|
bearing_support_rod();
|
|
translate([0,hole_center_dist,groove_height])
|
|
clip();
|
|
|
|
// Calculate washer positions from bottom to top
|
|
washer1 = end_stop_thickness+thread_length
|
|
+axle_main_part_length/2-bearing_dist/2-bearing_width/2
|
|
-space/2;
|
|
washer2 = end_stop_thickness+thread_length
|
|
+axle_main_part_length/2-bearing_dist/2+bearing_width/2
|
|
+space/2-washer_thickness;
|
|
washer3 = end_stop_thickness+thread_length
|
|
+axle_main_part_length/2+bearing_dist/2-bearing_width/2
|
|
-space/2;
|
|
washer4 = end_stop_thickness+thread_length
|
|
+axle_main_part_length/2+bearing_dist/2+bearing_width/2
|
|
+space/2-washer_thickness;
|
|
translate([0,hole_center_dist,washer1])
|
|
washer();
|
|
translate([0,hole_center_dist,washer2])
|
|
washer();
|
|
translate([0,hole_center_dist,washer3])
|
|
washer();
|
|
translate([0,hole_center_dist,washer4])
|
|
washer();
|
|
}
|
|
} |