terminal_mount.scad 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. include <../config/terminal_mount.scad>
  2. module terminal_mount_object() {
  3. size = terminal_mount_size;
  4. thickness = terminal_mount_thickness;
  5. screw = terminal_mount_screw;
  6. screw_mount = screw + thickness * 2;
  7. module mount_shape() {
  8. union() {
  9. move_y = size.y / 2 / 3;
  10. move_x = size.x / 2 / 3;
  11. translate([0, move_y + size.y / 3 - screw_mount / 2]) {
  12. square([size.x, screw_mount], center = true);
  13. }
  14. translate([0, -move_y]) {
  15. square([size.x, screw_mount], center = true);
  16. }
  17. translate([move_x, 0]) {
  18. square([screw_mount, size.y], center = true);
  19. }
  20. translate([-move_x, 0]) {
  21. square([screw_mount, size.y], center = true);
  22. }
  23. }
  24. }
  25. module mount_object() {
  26. linear_extrude(height = thickness, center = true) {
  27. mount_shape();
  28. }
  29. }
  30. module screw_mounting() {
  31. module bottom() {
  32. union() {
  33. circle(d = screw_mount);
  34. translate([-screw_mount / 4, 0]) {
  35. square([screw_mount / 2, screw_mount], center = true);
  36. }
  37. }
  38. }
  39. module bottom_object() {
  40. linear_extrude(height = size.z + thickness, center = true) {
  41. bottom();
  42. }
  43. }
  44. module drop() {
  45. full_size = size.z + thickness;
  46. hull() {
  47. translate([0, 0, full_size / 2 + 5 / 2]) {
  48. linear_extrude(height = 5, center = true) {
  49. square([screw_mount, screw_mount], center = true);
  50. }
  51. }
  52. move_z = -(full_size / 2 - thickness + 1 / $fn / 2);
  53. move_x = screw_mount / 2 - 1 / $fn / 2;
  54. translate([move_x, 0, move_z]) {
  55. linear_extrude(height = 1 / $fn, center = true) {
  56. square([1 / $fn, screw_mount], center = true);
  57. }
  58. }
  59. }
  60. }
  61. module screw_difference() {
  62. union() {
  63. cylinder(d = screw, h = size.z + thickness, center = true);
  64. hull_height = screw / 2;
  65. hull_move_z
  66. = hull_height / 2
  67. - (size.z + thickness) / 2
  68. + thickness;
  69. translate([0, 0, hull_move_z]) {
  70. cylinder(
  71. d2 = screw * 2,
  72. d1 = screw,
  73. h = hull_height,
  74. center = true
  75. );
  76. }
  77. second_height = size.z - hull_height;
  78. second_move_z
  79. = second_height / 2
  80. - (size.z + thickness) / 2
  81. + thickness + hull_height;
  82. translate([0, 0, second_move_z]) {
  83. cylinder(d = screw * 2, h = second_height, center = true);
  84. }
  85. }
  86. }
  87. render() {
  88. difference() {
  89. bottom_object();
  90. drop();
  91. screw_difference();
  92. }
  93. }
  94. }
  95. module screws() {
  96. bottom_y = -size.y / 2 - screw_mount / 2;
  97. bottom_x = -size.x / 2 / 3;
  98. top_x = size.x / 2 + screw_mount / 2;
  99. top_y = size.y / 2 / 3 + size.y / 3 - screw_mount / 2;
  100. middle_x = size.x / 2 + screw_mount / 2;
  101. middle_y = -size.y / 2 / 3;
  102. translate([bottom_x, bottom_y, 0]) {
  103. rotate(270) {
  104. screw_mounting();
  105. }
  106. }
  107. translate([-bottom_x, bottom_y, 0]) {
  108. rotate(270) {
  109. screw_mounting();
  110. }
  111. }
  112. translate([top_x, top_y, 0]) {
  113. rotate(0) {
  114. screw_mounting();
  115. }
  116. }
  117. translate([-top_x, top_y, 0]) {
  118. rotate(180) {
  119. screw_mounting();
  120. }
  121. }
  122. translate([middle_x, middle_y, 0]) {
  123. rotate(0) {
  124. screw_mounting();
  125. }
  126. }
  127. translate([-middle_x, middle_y, 0]) {
  128. rotate(180) {
  129. screw_mounting();
  130. }
  131. }
  132. }
  133. module result() {
  134. translate([0, 0, size.z / 2]) {
  135. mount_object();
  136. }
  137. screws();
  138. }
  139. color("#005522") {
  140. render() {
  141. result();
  142. }
  143. }
  144. }