vesa.scad 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. include <../config/vesa.scad>
  2. include <../config/wall.scad>
  3. include <../config/hook.scad>
  4. function vesa_hinge_full_height() =
  5. vesa_hinge_height
  6. + vesa_hinge_thickness * 2;
  7. module vesa_hinge_object() {
  8. module bottom_base_object() {
  9. move_x = vesa_hinge_width / 2;
  10. move_y = vesa_hinge_full_height() / 2;
  11. linear_extrude(height = vesa_hinge_thickness) {
  12. square([move_x * 2, move_y * 2], center = true);
  13. }
  14. }
  15. module hanging_object() {
  16. rotate([90, 0, 0]) {
  17. linear_extrude(height = vesa_hinge_thickness, center = true) {
  18. radius = vesa_hinge_depth / 2;
  19. difference() {
  20. hull() {
  21. translate([0, radius]) {
  22. circle(r = radius);
  23. }
  24. translate([0, radius / 2]) {
  25. square([radius * 2, radius], center = true);
  26. }
  27. }
  28. translate([0, radius]) {
  29. circle(r = vesa_hinge_screw / 2);
  30. }
  31. }
  32. }
  33. }
  34. }
  35. move_y = vesa_hinge_height / 2 + vesa_hinge_thickness / 2;
  36. move_z = vesa_hinge_thickness;
  37. translate([0, move_y, move_z]) {
  38. hanging_object();
  39. }
  40. translate([0, -move_y, move_z]) {
  41. hanging_object();
  42. }
  43. bottom_base_object();
  44. }
  45. module vesa_thread(rotated = true) {
  46. module base_object() {
  47. cylinder(r = vesa_thread_radius / 2, h = vesa_thread_height);
  48. cylinder(r = vesa_thread_top_radius / 2, h = vesa_thread_top_height);
  49. }
  50. if (rotated) {
  51. rotate([0, 180, 0]) {
  52. base_object();
  53. }
  54. } else {
  55. base_object();
  56. }
  57. }
  58. module vesa_connector_object(center = false) {
  59. module base_shape() {
  60. hull() {
  61. move_x = vesa_connector_length / 2 - vesa_hinge_depth / 2;
  62. translate([move_x, 0]) {
  63. circle(r = vesa_hinge_depth / 2);
  64. }
  65. translate([-move_x, 0]) {
  66. circle(r = vesa_hinge_depth / 2);
  67. }
  68. }
  69. }
  70. module mounting_screws() {
  71. radius = vesa_hinge_screw / 2;
  72. move_x = vesa_connector_length / 2 - vesa_hinge_depth / 2 + radius;
  73. translate([move_x, 0]) {
  74. circle(r = radius);
  75. }
  76. translate([-move_x, 0]) {
  77. circle(r = radius);
  78. }
  79. }
  80. module base_object() {
  81. height = vesa_hinge_height - vesa_connector_margin;
  82. linear_extrude(height = height, center = center) {
  83. difference() {
  84. base_shape();
  85. mounting_screws();
  86. }
  87. }
  88. }
  89. module threads() {
  90. translate([0, 0, vesa_hinge_height - vesa_connector_margin]) {
  91. vesa_thread();
  92. }
  93. translate([0, 0, 0]) {
  94. vesa_thread(false);
  95. }
  96. }
  97. render() {
  98. difference() {
  99. radius = vesa_hinge_screw / 2;
  100. move_x = vesa_connector_length / 2 - vesa_hinge_depth / 2 + radius;
  101. correct = vesa_hinge_height - vesa_connector_margin;
  102. center_correct = center ? -correct / 2 : 0;
  103. base_object();
  104. translate([move_x, 0, center_correct]) {
  105. threads();
  106. }
  107. translate([-move_x, 0, center_correct]) {
  108. threads();
  109. }
  110. first_cable_x = move_x
  111. - vesa_cable_hole / 1.5
  112. - vesa_thread_top_radius;
  113. cable_z = vesa_cable_hole / 1.5;
  114. translate([first_cable_x , 0, cable_z]) {
  115. rotate([90, 0, 0]) {
  116. cylinder(
  117. r = vesa_cable_hole / 2,
  118. h = vesa_hinge_height,
  119. center = true
  120. );
  121. }
  122. }
  123. translate([0 , 0, cable_z]) {
  124. rotate([90, 0, 0]) {
  125. cylinder(
  126. r = vesa_cable_hole / 2,
  127. h = vesa_hinge_height,
  128. center = true
  129. );
  130. }
  131. }
  132. translate([-first_cable_x , 0, cable_z]) {
  133. rotate([90, 0, 0]) {
  134. cylinder(
  135. r = vesa_cable_hole / 2,
  136. h = vesa_hinge_height,
  137. center = true
  138. );
  139. }
  140. }
  141. }
  142. }
  143. }
  144. module vesa_wall_hinge_object() {
  145. module wall_base_shape() {
  146. move_x = vesa_wall_width / 2 - vesa_rounding;
  147. move_y = vesa_wall_height / 2 - vesa_rounding;
  148. rounding = vesa_rounding;
  149. hull() {
  150. translate([move_x, move_y]) {
  151. circle(r = rounding);
  152. }
  153. translate([-move_x, move_y]) {
  154. circle(r = rounding);
  155. }
  156. translate([move_x, -move_y]) {
  157. circle(r = rounding);
  158. }
  159. translate([-move_x, -move_y]) {
  160. circle(r = rounding);
  161. }
  162. }
  163. }
  164. module wall_holes() {
  165. move_x = (
  166. vesa_wall_width
  167. - (vesa_wall_width % wall_holes_space)
  168. ) / 2;
  169. move_y = (
  170. vesa_wall_height
  171. - (vesa_wall_height % wall_holes_space)
  172. ) / 2;
  173. for (count_x = [-move_x : wall_holes_space : move_x]) {
  174. for (count_y = [-move_y : wall_holes_space : move_y]) {
  175. translate([count_x, count_y]) {
  176. circle(r = hook_mounting_hole / 2);
  177. }
  178. }
  179. }
  180. }
  181. module wall_shape() {
  182. difference() {
  183. wall_base_shape();
  184. wall_holes();
  185. }
  186. }
  187. module wall_object() {
  188. linear_extrude(height = vesa_hinge_thickness) {
  189. wall_shape();
  190. }
  191. }
  192. union() {
  193. vesa_hinge_object();
  194. wall_object();
  195. }
  196. }
  197. module vesa_corner_base_object(move = false) {
  198. radius = vesa_hinge_full_height() / 2;
  199. move_x = vesa_hinge_height / 3;
  200. rotate([90, 0, 90]) {
  201. linear_extrude(height = vesa_corner_thickness, center = true) {
  202. difference() {
  203. hull() {
  204. translate([0, radius / 2]) {
  205. square([radius * 2, radius], center = true);
  206. }
  207. circle(r = radius);
  208. }
  209. circle(r = vesa_hinge_screw / 2);
  210. if (move) {
  211. difference() {
  212. size = radius - vesa_hinge_screw;
  213. move = (size + vesa_hinge_screw) * 2;
  214. circle(r = size + vesa_hinge_screw / 2);
  215. circle(r = size - vesa_hinge_screw / 2);
  216. translate([0, move / 4]) {
  217. square([move, move / 2], center = true);
  218. }
  219. }
  220. } else {
  221. translate([0, radius - vesa_hinge_screw]) {
  222. circle(r = vesa_hinge_screw / 2);
  223. }
  224. }
  225. }
  226. }
  227. }
  228. }
  229. module vesa_corner_hinge_object() {
  230. radius = vesa_hinge_full_height() / 2;
  231. move_x = vesa_hinge_width / 3;
  232. module corner_object() {
  233. vesa_corner_base_object();
  234. }
  235. union() {
  236. vesa_hinge_object();
  237. translate([move_x, 0, -radius]) {
  238. corner_object();
  239. }
  240. translate([-move_x, 0, -radius]) {
  241. corner_object();
  242. }
  243. }
  244. }
  245. module vesa_plate_corner_object() {
  246. module vesa_plate_base_shape() {
  247. move_x = vesa_width / 2 - vesa_rounding + vesa_margin;
  248. move_y = vesa_height / 2 - vesa_rounding + vesa_margin;
  249. rounding = vesa_rounding;
  250. hull() {
  251. translate([move_x, move_y]) {
  252. circle(r = rounding);
  253. }
  254. translate([move_x, -move_y]) {
  255. circle(r = rounding);
  256. }
  257. translate([-move_x, move_y]) {
  258. circle(r = rounding);
  259. }
  260. translate([-move_x, -move_y]) {
  261. circle(r = rounding);
  262. }
  263. }
  264. }
  265. module vesa_plate_shape() {
  266. radius = vesa_screw / 2;
  267. move_x = vesa_width / 2;
  268. move_y = vesa_height / 2;
  269. difference() {
  270. vesa_plate_base_shape();
  271. translate([move_x, move_y]) {
  272. circle(r = radius);
  273. }
  274. translate([-move_x, move_y]) {
  275. circle(r = radius);
  276. }
  277. translate([move_x, -move_y]) {
  278. circle(r = radius);
  279. }
  280. translate([-move_x, -move_y]) {
  281. circle(r = radius);
  282. }
  283. }
  284. }
  285. module vesa_plate_object() {
  286. height = max(vesa_hinge_thickness, vesa_plate_thickness);
  287. correct = vesa_hinge_thickness - height;
  288. translate([0, 0, correct - height]) {
  289. linear_extrude(height = height) {
  290. vesa_plate_shape();
  291. }
  292. }
  293. }
  294. union() {
  295. vesa_plate_object();
  296. translate([0, 0, vesa_hinge_full_height() / 2]) {
  297. rotate([180, 0, 0]) {
  298. vesa_corner_base_object(true);
  299. }
  300. }
  301. }
  302. }