wall.scad 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. include <../config/wall.scad>
  2. include <../config/thread.scad>
  3. include <hole.scad>
  4. include <thread.scad>
  5. module wall_holes_shape(width, height, diameter = false) {
  6. module hole(move_x, move_y) {
  7. translate([move_x, move_y]) {
  8. if (diameter == false) {
  9. circle(r = thread_screw / 2);
  10. } else {
  11. circle(r = diameter / 2);
  12. }
  13. }
  14. }
  15. base_width = width - width % wall_holes_space;
  16. base_height = height - height % wall_holes_space;
  17. move_x = base_width / 2;
  18. move_y = base_height / 2;
  19. for (count_x = [-move_x : wall_holes_space : move_x]) {
  20. for (count_y = [-move_y : wall_holes_space : move_y]) {
  21. hole(count_x, count_y);
  22. }
  23. }
  24. }
  25. module wall_thread_object(width, height, oversize = 0) {
  26. module hole(move_x, move_y) {
  27. translate([move_x, move_y]) {
  28. thread_object(false, oversize);
  29. }
  30. }
  31. base_width = width - width % wall_holes_space;
  32. base_height = height - height % wall_holes_space;
  33. move_x = base_width / 2;
  34. move_y = base_height / 2;
  35. for (count_x = [-move_x : wall_holes_space : move_x]) {
  36. for (count_y = [-move_y : wall_holes_space : move_y]) {
  37. hole(count_x, count_y);
  38. }
  39. }
  40. }
  41. module wall_base_shape() {
  42. move_x = wall_width / 2 - wall_rounding;
  43. move_y = wall_height / 2 - wall_rounding;
  44. hull() {
  45. translate([move_x, move_y]) {
  46. circle(r = wall_rounding);
  47. }
  48. translate([move_x, -move_y]) {
  49. circle(r = wall_rounding);
  50. }
  51. translate([-move_x, -move_y]) {
  52. circle(r = wall_rounding);
  53. }
  54. translate([-move_x, move_y]) {
  55. circle(r = wall_rounding);
  56. }
  57. }
  58. }
  59. module wall_mount_screws() {
  60. move_x = wall_width / 2 - wall_mounting_screws;
  61. move_y = wall_height / 2 - wall_mounting_screws;
  62. translate([move_x, move_y]) {
  63. circle(r = wall_mounting_screws / 2);
  64. }
  65. translate([move_x, -move_y]) {
  66. circle(r = wall_mounting_screws / 2);
  67. }
  68. translate([-move_x, -move_y]) {
  69. circle(r = wall_mounting_screws / 2);
  70. }
  71. translate([-move_x, move_y]) {
  72. circle(r = wall_mounting_screws / 2);
  73. }
  74. }
  75. module wall_holes_on_x() {
  76. width_without_screws_margin = wall_width - wall_mounting_screws * 2;
  77. width_without_margin = width_without_screws_margin - hole_entrance * 2;
  78. width = width_without_margin - width_without_margin % wall_holes_space;
  79. for (count = [-width / 2 : wall_holes_space : width / 2]) {
  80. translate([count, 0]) {
  81. hole_shape();
  82. }
  83. }
  84. }
  85. module wall_holes() {
  86. hole_height = hole_entrance * 2 + hole_holding * 3;
  87. height_without_screws_margin = wall_height - wall_mounting_screws * 2;
  88. height_without_margin = height_without_screws_margin - hole_height;
  89. height = height_without_margin - height_without_margin % wall_holes_space;
  90. for (count = [-height / 2 : wall_holes_space : height / 2]) {
  91. translate([0, count]) {
  92. wall_holes_on_x();
  93. }
  94. }
  95. }
  96. module wall_with_mount_screw() {
  97. difference() {
  98. wall_base_shape();
  99. wall_mount_screws();
  100. }
  101. }
  102. module wall_shape() {
  103. difference() {
  104. wall_with_mount_screw();
  105. wall_holes();
  106. }
  107. }
  108. module wall_object() {
  109. color(wall_color) {
  110. linear_extrude(height = wall_thickness) {
  111. wall_shape();
  112. }
  113. }
  114. }