vesa.scad 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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. hull() {
  162. translate(top_center) {
  163. square(vesa_frame_thickness * 4, center = true);
  164. }
  165. translate(bottom_center) {
  166. square(vesa_frame_thickness * 4, center = true);
  167. }
  168. }
  169. correct = vesa_frame_thickness * 2;
  170. bottom_left = [correct + vesa_rounding, vesa_rounding - correct];
  171. bottom_right = [-bottom_left.x, bottom_left.y];
  172. top_left = [bottom_left.x, correct - vesa_rounding * 2];
  173. top_right = [-bottom_left.x, top_left.y];
  174. translate(bottom_center) {
  175. difference_circle_corner(bottom_left, 0);
  176. difference_circle_corner(bottom_right, 1);
  177. }
  178. translate(top_center) {
  179. difference_circle_corner(top_left, 3);
  180. difference_circle_corner(top_right, 2);
  181. }
  182. }
  183. bottom_y = bottom_center.y - vesa_frame_thickness * 2 - vesa_rounding * 2;
  184. bottom_left = [vesa_width / 2, bottom_y];
  185. bottom_right = [-bottom_left.x, bottom_left.y];
  186. module bottom_shape() {
  187. hull() {
  188. circle_corner([bottom_left.x, bottom_left.y + vesa_rounding]);
  189. circle_corner([bottom_left.x, bottom_left.y - vesa_rounding]);
  190. circle_corner([bottom_right.x, bottom_right.y + vesa_rounding]);
  191. circle_corner([bottom_right.x, bottom_right.y - vesa_rounding]);
  192. }
  193. }
  194. module base_object() {
  195. linear_extrude(height = vesa_thickness) {
  196. top_shape();
  197. center_shape();
  198. bottom_shape();
  199. }
  200. }
  201. module corner_regulation() {
  202. move = [
  203. 0,
  204. vesa_rounding * 2 - vesa_height / 3,
  205. vesa_thickness / 2
  206. ];
  207. translate(move) {
  208. rotate([0, 90, 0]) {
  209. cylinder(
  210. r = vesa_base_screw / 2,
  211. h = vesa_width + vesa_frame_thickness,
  212. center = true
  213. );
  214. }
  215. size = [
  216. vesa_thickness,
  217. vesa_thickness * 1.5,
  218. vesa_thickness
  219. ];
  220. position_x = vesa_width / 2
  221. - vesa_frame_thickness
  222. + vesa_thickness / 2 / 1.5;
  223. translate([position_x, 0, 0]) {
  224. cube(size, center = true);
  225. }
  226. translate([-position_x, 0, 0]) {
  227. cube(size, center = true);
  228. }
  229. }
  230. }
  231. render() {
  232. difference() {
  233. base_object();
  234. corner_regulation();
  235. }
  236. }
  237. module monitor_hinge(x) {
  238. position_z = vesa_thickness - vesa_frame_thickness / 2;
  239. translate([x, top_left.y + vesa_frame_thickness, position_z]) {
  240. rotate([0, 90, 180]) {
  241. vesa_monitor_hinge();
  242. translate([0, vesa_frame_thickness / 2, 0]) {
  243. linear_extrude(height = vesa_thickness, center = true) {
  244. difference() {
  245. circle(r = vesa_frame_thickness / 2);
  246. translate([0, -vesa_frame_thickness / 4]) {
  247. size = [
  248. vesa_frame_thickness,
  249. vesa_frame_thickness / 2
  250. ];
  251. square(size, center = true);
  252. }
  253. }
  254. }
  255. }
  256. }
  257. }
  258. }
  259. module main_hinge(y) {
  260. translate([0, y, -vesa_frame_thickness]) {
  261. rotate([90, 0, 0]) {
  262. vesa_main_hinge();
  263. }
  264. }
  265. }
  266. monitor_hinge(top_left.x + vesa_thickness / 3);
  267. monitor_hinge(top_right.x - vesa_thickness / 3);
  268. main_hinge(vesa_height / 4 + vesa_frame_thickness);
  269. main_hinge(-vesa_height / 4 + vesa_frame_thickness);
  270. if (vesa_width >= 100) {
  271. main_hinge(vesa_frame_thickness);
  272. }
  273. }
  274. module vesa_wall() {
  275. module base_shape() {
  276. difference() {
  277. vesa_rsquare(vesa_wall_width, vesa_wall_height);
  278. inside_width = vesa_wall_width - vesa_frame_thickness * 2;
  279. inside_height = vesa_wall_height - vesa_frame_thickness * (3 + 3);
  280. vesa_rsquare(inside_width, inside_height);
  281. }
  282. square([vesa_frame_thickness * 2, vesa_wall_height], center = true);
  283. }
  284. module shape() {
  285. difference() {
  286. base_shape();
  287. width = vesa_wall_width - vesa_wall_width % wall_holes_space;
  288. height = vesa_wall_height - vesa_wall_height % wall_holes_space;
  289. for (count_y = [-height / 2 : wall_holes_space : height / 2]) {
  290. for (count_x = [-width / 2 : wall_holes_space : width / 2]) {
  291. translate([count_x, count_y]) {
  292. circle(r = hook_mounting_hole / 2);
  293. }
  294. }
  295. }
  296. }
  297. }
  298. module base_object() {
  299. linear_extrude(height = vesa_thickness) {
  300. shape();
  301. }
  302. }
  303. module base_hinge(y) {
  304. translate([0, y, vesa_frame_thickness * 2 + vesa_thickness]) {
  305. rotate([270, 0, 0]) {
  306. vesa_main_hinge();
  307. }
  308. add_size = [
  309. vesa_frame_thickness * 2,
  310. vesa_thickness,
  311. vesa_frame_thickness
  312. ];
  313. translate([0, 0, -vesa_frame_thickness * 1.5]) {
  314. cube(add_size, center = true);
  315. }
  316. }
  317. }
  318. module hinge(y) {
  319. base_hinge(y - vesa_thickness);
  320. base_hinge(y + vesa_thickness);
  321. }
  322. base_object();
  323. hinge(0);
  324. hinge(-vesa_height / 4);
  325. hinge(vesa_height / 4);
  326. }
  327. function vesa_corner_regulation_size() = [
  328. vesa_corner_regulation_space * (vesa_corner_regulation_count - 1),
  329. vesa_thickness
  330. ];
  331. module vesa_corner_regulation() {
  332. move_x = vesa_corner_regulation_size().x / 2;
  333. module base_shape() {
  334. hull() {
  335. translate([move_x, 0]) {
  336. circle(r = vesa_thickness / 2);
  337. }
  338. translate([-move_x, 0]) {
  339. circle(r = vesa_thickness / 2);
  340. }
  341. }
  342. }
  343. module shape() {
  344. difference() {
  345. base_shape();
  346. for (count = [-move_x : vesa_corner_regulation_space : move_x]) {
  347. translate([count, 0]) {
  348. circle(r = vesa_base_screw / 2 + 0.5);
  349. }
  350. }
  351. }
  352. }
  353. linear_extrude(height = vesa_thickness, center = true) {
  354. shape();
  355. }
  356. }