cable_hanger.scad 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. include <../config/cable_hanger.scad>
  2. include <../config/thread.scad>
  3. include <../config/wall.scad>
  4. include <thread.scad>
  5. module cable_hanger_object() {
  6. module base_shape() {
  7. depth = thread_height
  8. + cable_hanger_base_thickness
  9. + cable_hanger_depth;
  10. rounding = cable_hanger_rounding;
  11. move_y = depth / 2 - rounding;
  12. move_x = cable_hanger_width / 2 - rounding;
  13. hull() {
  14. translate([move_x, move_y]) {
  15. circle(r = rounding);
  16. }
  17. translate([-move_x, move_y]) {
  18. circle(r = rounding);
  19. }
  20. translate([move_x, -move_y]) {
  21. square(rounding * 2, center = true);
  22. }
  23. translate([-move_x, -move_y]) {
  24. square(rounding * 2, center = true);
  25. }
  26. }
  27. }
  28. module cable_hanger_shape() {
  29. inside = cable_hanger_inside_hole;
  30. outside = cable_hanger_outside_hole;
  31. depth = cable_hanger_depth;
  32. move_top = depth / 2;
  33. move_bottom = inside / 2 - depth / 2;
  34. render() {
  35. difference() {
  36. hull() {
  37. translate([0, move_top]) {
  38. circle(r = outside / 2);
  39. }
  40. translate([0, move_bottom]) {
  41. circle(r = inside / 2);
  42. }
  43. }
  44. translate([0, move_top + outside / 2]) {
  45. square(outside, center = true);
  46. }
  47. }
  48. }
  49. }
  50. module final_shape() {
  51. module single_cable_shape(move_x) {
  52. depth = cable_hanger_depth;
  53. size = depth + cable_hanger_base_thickness + thread_height;
  54. move_y = size / 2 - depth / 2;
  55. translate([move_x, move_y]) {
  56. cable_hanger_shape();
  57. }
  58. }
  59. module all_cables_shape() {
  60. base_width = cable_hanger_width
  61. - cable_hanger_outside_hole
  62. - cable_hanger_rounding * 2;
  63. space = cable_hanger_space
  64. + cable_hanger_outside_hole;
  65. width = base_width
  66. - base_width % space;
  67. move = width / 2;
  68. for (count = [-move : space : move]) {
  69. single_cable_shape(count);
  70. }
  71. }
  72. render() {
  73. difference() {
  74. base_shape();
  75. all_cables_shape();
  76. }
  77. }
  78. }
  79. module base_object() {
  80. thickness = thread_top_diameter
  81. + cable_hanger_base_thickness * 2;
  82. linear_extrude(height = thickness, center = true) {
  83. final_shape();
  84. }
  85. }
  86. module final_object() {
  87. module thread(move_x) {
  88. move_y = thread_height / 2
  89. - cable_hanger_depth / 2
  90. - cable_hanger_base_thickness / 2
  91. - thread_height / 2;
  92. translate([move_x, move_y, 0]) {
  93. rotate([270, 0, 0]) {
  94. thread_object();
  95. }
  96. }
  97. }
  98. module threads() {
  99. base_width = cable_hanger_width
  100. - thread_top_diameter
  101. - cable_hanger_base_thickness;
  102. width = base_width
  103. - base_width % wall_holes_space;
  104. move = width / 2;
  105. for (count = [-move : wall_holes_space : move]) {
  106. thread(count);
  107. }
  108. }
  109. color("#3dea15") {
  110. render() {
  111. difference() {
  112. base_object();
  113. threads();
  114. }
  115. }
  116. }
  117. }
  118. final_object();
  119. }