cable_holder.scad 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. include <../config/cable_holder.scad>
  2. include <../config/thread.scad>
  3. include <../config/wall.scad>
  4. include <thread.scad>
  5. module cable_holder_shape() {
  6. module base_shape() {
  7. rounding = cable_holder_height / 2;
  8. move_x = cable_holder_width / 2 - rounding;
  9. hull() {
  10. translate([-move_x, 0]) {
  11. circle(r = rounding);
  12. }
  13. translate([move_x, 0]) {
  14. circle(r = rounding);
  15. }
  16. }
  17. translate([0, rounding / 2]) {
  18. square([cable_holder_width, rounding], center = true);
  19. }
  20. }
  21. module cable_holes() {
  22. space = (cable_holder_height - cable_holder_holes_diameter) / 2;
  23. spacing = cable_holder_holes_diameter + space;
  24. base_width = cable_holder_width - space;
  25. width = base_width - base_width % spacing;
  26. count_of = round(width / spacing);
  27. for (count = [0 : 1 : count_of - 1]) {
  28. move_x = count * spacing - width / 2 + spacing / 2;
  29. translate([move_x, 0]) {
  30. circle(r = cable_holder_holes_diameter / 2);
  31. }
  32. }
  33. }
  34. difference() {
  35. base_shape();
  36. cable_holes();
  37. }
  38. }
  39. module cable_holder_object() {
  40. module base_object() {
  41. render() {
  42. linear_extrude(height = cable_holder_thickness, center = true) {
  43. cable_holder_shape();
  44. }
  45. }
  46. }
  47. module thread(move_x) {
  48. move_y = cable_holder_height / 2 - thread_height / 2;
  49. translate([move_x, move_y, 0]) {
  50. rotate([90, 0, 0]) {
  51. thread_object();
  52. }
  53. }
  54. }
  55. module threads() {
  56. base_width = cable_holder_width
  57. - cable_holder_width
  58. % wall_holes_space;
  59. move_x = base_width / 2;
  60. for (count = [-move_x : wall_holes_space : move_x]) {
  61. thread(count);
  62. }
  63. }
  64. color("#F56E36") {
  65. render() {
  66. difference() {
  67. base_object();
  68. threads();
  69. }
  70. }
  71. }
  72. }