vesa.scad 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. include <../config/vesa.scad>
  2. include <../config/wall.scad>
  3. include <../config/hook.scad>
  4. module vesa_rsquare(width, height) {
  5. move_x = width / 2 - vesa_rounding;
  6. move_y = height / 2 - vesa_rounding;
  7. hull() {
  8. translate([move_x, move_y]) {
  9. circle(r = vesa_rounding);
  10. }
  11. translate([-move_x, move_y]) {
  12. circle(r = vesa_rounding);
  13. }
  14. translate([move_x, -move_y]) {
  15. circle(r = vesa_rounding);
  16. }
  17. translate([-move_x, -move_y]) {
  18. circle(r = vesa_rounding);
  19. }
  20. }
  21. }
  22. module vesa_hinge(size, thickness, hole) {
  23. linear_extrude(height = thickness, center = true) {
  24. difference() {
  25. union() {
  26. circle(r = size / 2);
  27. translate([0, size / 4]) {
  28. square([size, size / 2], center = true);
  29. }
  30. }
  31. circle(r = hole / 2);
  32. }
  33. }
  34. }
  35. module vesa_monitor_hinge() {
  36. vesa_hinge(vesa_frame_thickness, vesa_thickness, vesa_base_screw);
  37. }
  38. module vesa_main_hinge() {
  39. vesa_hinge(vesa_frame_thickness * 2, vesa_thickness, vesa_base_screw);
  40. }
  41. module vesa_monitor() {
  42. outside_width = vesa_frame_thickness + vesa_width;
  43. outside_height = vesa_frame_thickness + vesa_height;
  44. inside_width = vesa_width - vesa_frame_thickness;
  45. inside_height = vesa_height - vesa_frame_thickness;
  46. module base_object() {
  47. linear_extrude(height = vesa_thickness) {
  48. difference() {
  49. vesa_rsquare(outside_width, outside_height);
  50. vesa_rsquare(inside_width, inside_height);
  51. translate([vesa_width / 2, vesa_height / 2]) {
  52. circle(r = vesa_hole / 2);
  53. }
  54. translate([-vesa_width / 2, vesa_height / 2]) {
  55. circle(r = vesa_hole / 2);
  56. }
  57. translate([vesa_width / 2, -vesa_height / 2]) {
  58. circle(r = vesa_hole / 2);
  59. }
  60. translate([-vesa_width / 2, -vesa_height / 2]) {
  61. circle(r = vesa_hole / 2);
  62. }
  63. }
  64. }
  65. }
  66. module hinge() {
  67. translate([0, vesa_height / 2, -vesa_frame_thickness / 2]){
  68. rotate([90, 0, 90]) {
  69. vesa_monitor_hinge();
  70. }
  71. }
  72. }
  73. module double_hinge() {
  74. translate([-vesa_thickness, 0, 0]) {
  75. hinge();
  76. }
  77. translate([vesa_thickness, 0, 0]) {
  78. hinge();
  79. }
  80. }
  81. translate([vesa_width / 3, 0, 0]) {
  82. double_hinge();
  83. }
  84. translate([-vesa_width / 3, 0, 0]) {
  85. double_hinge();
  86. }
  87. module corner_regulation() {
  88. move = [
  89. 0,
  90. vesa_rounding * 2 - vesa_height / 3,
  91. vesa_thickness / 2
  92. ];
  93. translate(move) {
  94. rotate([0, 90, 0]) {
  95. cylinder(
  96. r = vesa_base_screw / 2,
  97. h = vesa_width + vesa_frame_thickness,
  98. center = true
  99. );
  100. }
  101. }
  102. }
  103. render() {
  104. difference() {
  105. base_object();
  106. corner_regulation();
  107. }
  108. }
  109. }
  110. module vesa_thread() {
  111. radius = vesa_thread_diameter / 2;
  112. top_radius = vesa_thread_top_diameter / 2;
  113. cylinder(r = radius, h = vesa_thread_thickness);
  114. cylinder(r = top_radius, h = vesa_thread_top_thickness);
  115. }
  116. module vesa_factor() {
  117. module circle_corner(position = [0, 0]) {
  118. translate(position) {
  119. circle(r = vesa_rounding);
  120. }
  121. }
  122. module square_corner(position = [0, 0]) {
  123. translate(position) {
  124. square(vesa_rounding * 2, center = true);
  125. }
  126. }
  127. module difference_circle_corner(position = [0, 0], angle = 0) {
  128. translate(position) {
  129. rotate(angle * 90) {
  130. render() {
  131. difference() {
  132. square_corner();
  133. circle_corner();
  134. translate([0, -vesa_rounding]) {
  135. square([vesa_rounding, vesa_rounding]);
  136. }
  137. translate([-vesa_rounding, 0]) {
  138. square([vesa_rounding * 2, vesa_rounding]);
  139. }
  140. }
  141. }
  142. }
  143. }
  144. }
  145. top_x = vesa_width / 3 - vesa_thickness / 3;
  146. top_left = [top_x, vesa_height / 2 - vesa_frame_thickness];
  147. top_right = [-top_left.x, top_left.y];
  148. round_top_left = [top_left.x, top_left.y - vesa_frame_thickness];
  149. round_top_right = [top_right.x, top_right.y - vesa_frame_thickness];
  150. module top_shape() {
  151. hull() {
  152. square_corner(top_left);
  153. square_corner(top_right);
  154. circle_corner(round_top_left);
  155. circle_corner(round_top_right);
  156. }
  157. }
  158. top_center = [0, vesa_height / 2 - vesa_frame_thickness * 4];
  159. bottom_center = [0, vesa_frame_thickness * 4 - vesa_height / 3];
  160. module center_shape() {
  161. correct = vesa_frame_thickness * 2;
  162. bottom_left = [correct + vesa_rounding, vesa_rounding - correct];
  163. bottom_right = [-bottom_left.x, bottom_left.y];
  164. top_left = [bottom_left.x, correct - vesa_rounding * 2];
  165. top_right = [-bottom_left.x, top_left.y];
  166. height = top_left.y
  167. - bottom_left.y
  168. + vesa_rounding * 2
  169. - bottom_center.y
  170. + top_center.y;
  171. move = top_left.y
  172. + bottom_left.y
  173. + top_center.y
  174. + bottom_center.y;
  175. width = top_left.x
  176. - top_right.x
  177. - vesa_rounding * 2;
  178. translate([0, move / 2]) {
  179. square([width, height], center = true);
  180. }
  181. translate(bottom_center) {
  182. difference_circle_corner(bottom_left, 0);
  183. difference_circle_corner(bottom_right, 1);
  184. }
  185. translate(top_center) {
  186. difference_circle_corner(top_left, 3);
  187. difference_circle_corner(top_right, 2);
  188. }
  189. }
  190. bottom_y = bottom_center.y - vesa_frame_thickness * 2 - vesa_rounding * 2;
  191. bottom_left = [vesa_width / 2, bottom_y];
  192. bottom_right = [-bottom_left.x, bottom_left.y];
  193. module bottom_shape() {
  194. hull() {
  195. circle_corner([bottom_left.x, bottom_left.y + vesa_rounding]);
  196. circle_corner([bottom_left.x, bottom_left.y - vesa_rounding]);
  197. circle_corner([bottom_right.x, bottom_right.y + vesa_rounding]);
  198. circle_corner([bottom_right.x, bottom_right.y - vesa_rounding]);
  199. }
  200. }
  201. module base_object() {
  202. linear_extrude(height = vesa_thickness) {
  203. top_shape();
  204. center_shape();
  205. bottom_shape();
  206. }
  207. }
  208. module corner_regulation() {
  209. move = [
  210. 0,
  211. vesa_rounding * 2 - vesa_height / 3,
  212. vesa_thickness / 2
  213. ];
  214. translate(move) {
  215. rotate([0, 90, 0]) {
  216. cylinder(
  217. r = vesa_base_screw / 2,
  218. h = vesa_width + vesa_frame_thickness,
  219. center = true
  220. );
  221. }
  222. size = [
  223. vesa_thickness,
  224. vesa_thickness * 1.5,
  225. vesa_thickness
  226. ];
  227. position_x = vesa_width / 2
  228. - vesa_frame_thickness
  229. + vesa_thickness / 2 / 1.5;
  230. translate([position_x, 0, 0]) {
  231. cube(size, center = true);
  232. }
  233. translate([-position_x, 0, 0]) {
  234. cube(size, center = true);
  235. }
  236. }
  237. }
  238. render() {
  239. difference() {
  240. base_object();
  241. corner_regulation();
  242. }
  243. }
  244. module monitor_hinge(x) {
  245. position_z = vesa_thickness - vesa_frame_thickness / 2;
  246. translate([x, top_left.y + vesa_frame_thickness, position_z]) {
  247. rotate([0, 90, 180]) {
  248. vesa_monitor_hinge();
  249. translate([0, vesa_frame_thickness / 2, 0]) {
  250. linear_extrude(height = vesa_thickness, center = true) {
  251. difference() {
  252. circle(r = vesa_frame_thickness / 2);
  253. translate([0, -vesa_frame_thickness / 4]) {
  254. size = [
  255. vesa_frame_thickness,
  256. vesa_frame_thickness / 2
  257. ];
  258. square(size, center = true);
  259. }
  260. }
  261. }
  262. }
  263. }
  264. }
  265. }
  266. module main_hinge(y) {
  267. translate([0, y, -vesa_frame_thickness]) {
  268. rotate([90, 0, 0]) {
  269. vesa_main_hinge();
  270. }
  271. }
  272. }
  273. monitor_hinge(top_left.x + vesa_thickness / 3);
  274. monitor_hinge(top_right.x - vesa_thickness / 3);
  275. main_hinge(vesa_height / 4 + vesa_frame_thickness);
  276. main_hinge(-vesa_height / 4 + vesa_frame_thickness);
  277. if (vesa_width >= 100) {
  278. main_hinge(vesa_frame_thickness);
  279. }
  280. }
  281. module vesa_wall() {
  282. module base_shape() {
  283. difference() {
  284. vesa_rsquare(vesa_wall_width, vesa_wall_height);
  285. inside_width = vesa_wall_width - vesa_frame_thickness * 2;
  286. inside_height = vesa_wall_height - vesa_frame_thickness * (3 + 3);
  287. vesa_rsquare(inside_width, inside_height);
  288. }
  289. square([vesa_frame_thickness * 2, vesa_wall_height], center = true);
  290. }
  291. module shape() {
  292. difference() {
  293. base_shape();
  294. width = vesa_wall_width - vesa_wall_width % wall_holes_space;
  295. height = vesa_wall_height - vesa_wall_height % wall_holes_space;
  296. for (count_y = [-height / 2 : wall_holes_space : height / 2]) {
  297. for (count_x = [-width / 2 : wall_holes_space : width / 2]) {
  298. translate([count_x, count_y]) {
  299. circle(r = hook_mounting_hole / 2);
  300. }
  301. }
  302. }
  303. }
  304. }
  305. module base_object() {
  306. linear_extrude(height = vesa_thickness) {
  307. shape();
  308. }
  309. }
  310. module base_hinge(y) {
  311. translate([0, y, vesa_frame_thickness * 2 + vesa_thickness]) {
  312. rotate([270, 0, 0]) {
  313. vesa_main_hinge();
  314. }
  315. add_size = [
  316. vesa_frame_thickness * 2,
  317. vesa_thickness,
  318. vesa_frame_thickness
  319. ];
  320. translate([0, 0, -vesa_frame_thickness * 1.5]) {
  321. cube(add_size, center = true);
  322. }
  323. }
  324. }
  325. module hinge(y) {
  326. base_hinge(y - vesa_thickness);
  327. base_hinge(y + vesa_thickness);
  328. }
  329. base_object();
  330. if (vesa_height > 75) {
  331. hinge(0);
  332. }
  333. hinge(-vesa_height / 4);
  334. hinge(vesa_height / 4);
  335. }
  336. function vesa_corner_regulation_size() = [
  337. vesa_corner_regulation_space * (vesa_corner_regulation_count - 1),
  338. vesa_thickness
  339. ];
  340. module vesa_corner_regulation() {
  341. move_x = vesa_corner_regulation_size().x / 2;
  342. module base_shape() {
  343. hull() {
  344. translate([move_x, 0]) {
  345. circle(r = vesa_thickness / 2);
  346. }
  347. translate([-move_x, 0]) {
  348. circle(r = vesa_thickness / 2);
  349. }
  350. }
  351. }
  352. module shape() {
  353. difference() {
  354. base_shape();
  355. for (count = [-move_x : vesa_corner_regulation_space : move_x]) {
  356. translate([count, 0]) {
  357. circle(r = vesa_base_screw / 2 + 0.5);
  358. }
  359. }
  360. }
  361. }
  362. linear_extrude(height = vesa_thickness, center = true) {
  363. shape();
  364. }
  365. }