bender-metric.scad 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. // Generate a resistor/diode lead bending tool
  2. // Dan Newman, dan dot newman @ mtbaldy dot us
  3. // 30 June 2012
  4. // Slicing layer height
  5. layer_height = 0.3;
  6. // spacing between each position
  7. spacing = 6.0;
  8. // Diameter of resistor leads
  9. wire_d = 1.50;
  10. // ---------------------
  11. // Short/small resistors
  12. // First bending width
  13. start_w = 10;
  14. // Final bending width
  15. end_w = 30;
  16. //end_w = 40; // Nice long bender, but too long for a 10 x 10 cm build area
  17. // Steps between each bending width
  18. step_w = 2;
  19. // Width and depth of the trough/ditch to place the resistors in
  20. trough_w = 6.75;
  21. trough_d = 2.10;
  22. // -----------------------
  23. // Medium sized resistors
  24. // First bending width
  25. //start_w = 16;
  26. // Final bending width
  27. //end_w = 30;
  28. //end_w = 40; // Nice long bender, but too long for a 10 x 10 cm build area
  29. // Steps between each bending width
  30. //step_w = 2;
  31. // Width and depth of the trough/ditch to place the resistors in
  32. //trough_w = 10.5;
  33. //trough_d = 3.00;
  34. // -------------
  35. // Miscellaneous
  36. // Corner radius for corners of the plate
  37. corner_r = 2.0;
  38. // -----------------------
  39. // Derived values follow
  40. // Thickness of the tool
  41. thickness = 2 * trough_d;
  42. // Round up to the nearest multiple of a layer height
  43. H = thickness + layer_height*(1.0+floor(thickness/layer_height)-(thickness/layer_height));
  44. // Number of positions
  45. N = ceil( 1 + ( end_w - start_w ) / step_w );
  46. // Starting and ending slot widths with allowances for the wire diameters
  47. W_1 = start_w - wire_d;
  48. W_N = end_w - wire_d;
  49. // To determine the actual starting and ending widths, consider the
  50. // line segment drawn between the first slot of width W_1 and the final
  51. // slot of width W_N and spaced (N-1)*spacing away.
  52. P1 = [W_1 / 2, (N - 1)*spacing];
  53. P2 = [W_N / 2, 0];
  54. // We wish to find the X coordinates X0 and X3 of the points
  55. //
  56. // P0 = [X0, N * spacing]
  57. // P3 = [X3, -spacing]
  58. //
  59. // on the line through P1 & P2. The equation of the line as a function of y is
  60. //
  61. // L(y) = P2[0] + y * ( P1[0] - P2[0] ) / ( P1[1] - P2[1] )
  62. P0 = [P2[0] + N * spacing * ( P1[0] - P2[0] ) / ( P1[1] - P2[1] ), N * spacing];
  63. P3 = [P2[0] - spacing * ( P1[0] - P2[0] ) / ( P1[1] - P2[1] ), -spacing];
  64. // Overall length (we use for centering the piece)
  65. L = P0[1] - P3[1] + P0[0] * 1.25;
  66. module plate()
  67. {
  68. difference()
  69. {
  70. union()
  71. {
  72. hull()
  73. {
  74. translate([P0[0] - corner_r, P0[1] - corner_r, 0])
  75. cylinder(h=H, r=corner_r, center=false, $fn=50);
  76. translate([-P0[0] + corner_r, P0[1] - corner_r, 0])
  77. cylinder(h=H, r=corner_r, center=false, $fn=50);
  78. translate([P3[0] - corner_r, P3[1] + corner_r, 0])
  79. cylinder(h=H, r=corner_r, center=false, $fn=50);
  80. translate([-P3[0] + corner_r, P3[1] + corner_r, 0])
  81. cylinder(h=H, r=corner_r, center=false, $fn=50);
  82. }
  83. translate([0, P0[1], 0])
  84. cylinder(h=H, r=P0[0]*1.3, center=false, $fn=100);
  85. }
  86. translate([-trough_w/2, -2*spacing, H - trough_d])
  87. cube([trough_w, (N + 4) * spacing, H]);
  88. translate([0, P0[1], -(H+1)/2])
  89. cylinder(h=H+1, r=P0[0]*1.3/2, center=false, $fn=100);
  90. }
  91. }
  92. module slot(n)
  93. {
  94. translate([-P3[0], P1[1] - n*spacing, H - trough_d/2])
  95. cube([P3[0]*2, wire_d, H]);
  96. }
  97. translate([0, -(L/2 + P3[1]), 0]) difference()
  98. {
  99. plate();
  100. for (n = [0 : N-1])
  101. {
  102. slot(n);
  103. }
  104. }