Guest User

openscad coupler

a guest
Sep 17th, 2024
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. function in2mm(inch) = inch*25.4;
  2. post_center_dist = in2mm(2.3645);
  3. main_body_thickness = in2mm(.375);
  4. main_body_width = in2mm(2);
  5. shaft_fit_length = in2mm(1.5);
  6. shaft_diameter = in2mm(1.125);
  7. keyway = in2mm(.25);
  8. // 1/4-20 50% threads in steel is tap drill of 0.2188inches
  9. // 5/16-18 50% threads in steel is tap drill of 0.2770inches (and these set screws have a cup diameter of 0.17inches)
  10. // 3/8-24 50% threads in steel is tap drill of 0.3480inches (and these set screws have a cup diameter of 0.21inches)
  11. setscrew_pretap_drill_size = in2mm(.3480);
  12.  
  13. $fa = 1;
  14. $fs = 0.5;
  15.  
  16. module motor_coupler()
  17. {
  18. module main_posts() {
  19. for (x = [-post_center_dist/2, post_center_dist/2]) {
  20. translate([x, 0, -main_body_thickness])
  21. cylinder(r=in2mm(.696/2),h=in2mm(1.077)+main_body_thickness,center=false);
  22. }
  23. }
  24. module semi_circ_base() {
  25. module endcy(x) {
  26. translate([x,0,-main_body_thickness]) cylinder(r=main_body_width/2,h=main_body_thickness,center=false);
  27. }
  28. union() {
  29. translate([-post_center_dist/2,-main_body_width/2,-main_body_thickness]) cube(size=[post_center_dist,main_body_width,main_body_thickness],center=false);
  30. endcy(post_center_dist/2);
  31. endcy(-post_center_dist/2);
  32. }
  33. }
  34. /*module full_base() {
  35. translate([0,0,-main_body_thickness])
  36. cylinder(r=main_body_width,h=main_body_thickness,center=false);
  37. }*/
  38.  
  39. module shaft_holder() {
  40. translate([0,0,-main_body_thickness-shaft_fit_length]) difference() {
  41. cylinder(r=main_body_width/2,h=shaft_fit_length,center=false);
  42. cylinder(r=shaft_diameter/2,h=shaft_fit_length,center=false);
  43. //keyway:
  44. translate([-keyway/2+shaft_diameter/2,-keyway/2,0]) cube(size=[keyway,keyway,shaft_fit_length],center=false);
  45. //set screw:
  46. translate([0,0,shaft_fit_length/2]) rotate(90,[0,1,0]) cylinder( r=setscrew_pretap_drill_size/2, h=main_body_width/2, center=false );
  47. }
  48. }
  49. union() {
  50. semi_circ_base();
  51. shaft_holder();
  52. main_posts();
  53. cylinder(r=in2mm(.4425/2),h=in2mm(.64),center=false);
  54. }
  55. }
  56. module example001()
  57. {
  58. function r_from_dia(d) = d / 2;
  59.  
  60. module rotcy(rot, r, h) {
  61. rotate(90, rot)
  62. cylinder(r = r, h = h, center = true);
  63. }
  64.  
  65. difference() {
  66. sphere(r = r_from_dia(size));
  67. rotcy([0, 0, 0], cy_r, cy_h);
  68. rotcy([1, 0, 0], cy_r, cy_h);
  69. rotcy([0, 1, 0], cy_r, cy_h);
  70. }
  71.  
  72. size = 50;
  73. hole = 25;
  74.  
  75. cy_r = r_from_dia(hole);
  76. cy_h = r_from_dia(size * 2.5);
  77. }
  78.  
  79. //example001();
  80. motor_coupler();
  81.  
  82.  
Advertisement
Add Comment
Please, Sign In to add comment