wall.scad 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. include <hole.scad>
  2. include <../config/wall.scad>
  3. module wall_base_shape() {
  4. move_x = wall_width / 2 - wall_rounding;
  5. move_y = wall_height / 2 - wall_rounding;
  6. hull() {
  7. translate([move_x, move_y]) {
  8. circle(r = wall_rounding);
  9. }
  10. translate([move_x, -move_y]) {
  11. circle(r = wall_rounding);
  12. }
  13. translate([-move_x, -move_y]) {
  14. circle(r = wall_rounding);
  15. }
  16. translate([-move_x, move_y]) {
  17. circle(r = wall_rounding);
  18. }
  19. }
  20. }
  21. module wall_mount_screws() {
  22. move_x = wall_width / 2 - wall_mounting_screws;
  23. move_y = wall_height / 2 - wall_mounting_screws;
  24. translate([move_x, move_y]) {
  25. circle(r = wall_mounting_screws / 2);
  26. }
  27. translate([move_x, -move_y]) {
  28. circle(r = wall_mounting_screws / 2);
  29. }
  30. translate([-move_x, -move_y]) {
  31. circle(r = wall_mounting_screws / 2);
  32. }
  33. translate([-move_x, move_y]) {
  34. circle(r = wall_mounting_screws / 2);
  35. }
  36. }
  37. module wall_holes_on_x() {
  38. width_without_screws_margin = wall_width - wall_mounting_screws * 2;
  39. width_without_margin = width_without_screws_margin - hole_entrance * 2;
  40. width = width_without_margin - width_without_margin % wall_holes_space;
  41. for (count = [-width / 2 : wall_holes_space : width / 2]) {
  42. translate([count, 0]) {
  43. hole_shape();
  44. }
  45. }
  46. }
  47. module wall_holes() {
  48. hole_height = hole_entrance * 2 + hole_holding * 3;
  49. height_without_screws_margin = wall_height - wall_mounting_screws * 2;
  50. height_without_margin = height_without_screws_margin - hole_height;
  51. height = height_without_margin - height_without_margin % wall_holes_space;
  52. for (count = [-height / 2 : wall_holes_space : height / 2]) {
  53. translate([0, count]) {
  54. wall_holes_on_x();
  55. }
  56. }
  57. }
  58. module wall_with_mount_screw() {
  59. difference() {
  60. wall_base_shape();
  61. wall_mount_screws();
  62. }
  63. }
  64. module wall_shape() {
  65. difference() {
  66. wall_with_mount_screw();
  67. wall_holes();
  68. }
  69. }
  70. module wall_object() {
  71. color(wall_color) {
  72. linear_extrude(height = wall_thickness) {
  73. wall_shape();
  74. }
  75. }
  76. }