Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. panel_w = 127.8;
  2. panel_d = 13;
  3. panel_hole_dia = 2.5;
  4. panel_hole_dist_x = 114.4 - panel_hole_dia;
  5. panel_hole_dist_y = 92.4 - panel_hole_dia;
  6. hole_off_x = (panel_w - panel_hole_dist_x) / 2;
  7. hole_off_y = (panel_w - panel_hole_dist_y) / 2;
  8. panel_nub_d = 3.0;
  9. panel_nub_h = 4.0;
  10. panel_nub_off_x = 24.25 - (panel_nub_d / 2);
  11. panel_nub_off_y = 10.0 - (panel_nub_d / 2);
  12. panel_nub_hole = panel_nub_d + 1.0;
  13. strip_w = hole_off_x * 2 + 10;
  14. strip_d = 6.0;
  15. strip_hole_d = 4.0;
  16. foot_h = 10;
  17. foot_plate_h = foot_h + hole_off_y + 10;
  18. foot_d = strip_d;
  19. foot_l = 100.0;
  20. conn_h = hole_off_y * 2 + 50;
  21. conn_w = strip_w;
  22. conn_d = foot_d;
  23. conn_hole_d = strip_hole_d;
  24. pi_width = 85;
  25. pi_height = 56;
  26. pi_hole_dist_x = 58;
  27. pi_hole_dist_y = 49;
  28. pi_hole_off_x = 3.5;
  29. pi_hole_off_y = 3.5;
  30. pi_hole = 2.8;
  31. pi_off_x = 10;
  32. pi_off_y = 25;
  33. pi_mount_dist = 10;
  34. pi_mount_w = 15.0;
  35. pi_mount_d = foot_d;
  36. $fn = 42;
  37. module holes(h, d1 = pi_hole, d2 = pi_hole) {
  38. for (x = [0, pi_hole_dist_x])
  39. for (y = [0, pi_hole_dist_y])
  40. translate([pi_hole_off_x + x, 0, pi_hole_off_y + y])
  41. rotate([90, 0, 0])
  42. cylinder(d1 = d1, d2 = d2, h = h);
  43. }
  44. module pi() {
  45. cube([pi_width, 2.0, pi_height]);
  46. translate([0, 10, 0])
  47. holes(20);
  48. }
  49. module panel() {
  50. difference() {
  51. cube([panel_w, panel_d, panel_w]);
  52. for (x = [0, panel_hole_dist_x])
  53. for (y = [0, panel_hole_dist_y])
  54. translate([hole_off_x + x, -1, hole_off_y + y])
  55. rotate([-90, 0, 0])
  56. cylinder(d = panel_hole_dia, h = panel_d + 2);
  57. }
  58. // actually only bottom-left and top-right
  59. for (x = [panel_nub_off_x, panel_w - panel_nub_off_x])
  60. for (y = [panel_nub_off_y, panel_w - panel_nub_off_y])
  61. translate([x, 0, y])
  62. rotate([90, 0, 0])
  63. cylinder(d = panel_nub_d, h = panel_nub_h);
  64. }
  65. module foot() {
  66. translate([0, -strip_d * 2, 0])
  67. difference() {
  68. translate([-strip_w / 2, 0, -foot_h])
  69. cube([strip_w, strip_d, foot_plate_h]);
  70. for (x = [-1, 1])
  71. translate([x * hole_off_x, -1, hole_off_y])
  72. rotate([-90, 0, 0])
  73. cylinder(d = strip_hole_d, h = strip_d + 2);
  74. }
  75. translate([-strip_w / 2, -strip_d * 2 - foot_l / 2 + foot_d / 2, -foot_h - foot_d])
  76. cube([strip_w, foot_l, foot_d]);
  77. for (d = [-strip_d * 2 - 5, -strip_d])
  78. translate([-strip_w / 2, d, -foot_h])
  79. cube([strip_w, 5, 5]);
  80. }
  81. module foot_strip() {
  82. translate([0, -strip_d, 0])
  83. difference() {
  84. translate([-strip_w / 2, 0, 0])
  85. cube([strip_w, strip_d, panel_w]);
  86. for (x = [-1, 1])
  87. for (y = [0, panel_hole_dist_y])
  88. translate([x * hole_off_x, -1, hole_off_y + y])
  89. rotate([-90, 0, 0])
  90. cylinder(d = strip_hole_d, h = strip_d + 2);
  91. }
  92. difference() {
  93. for (x = [-1, 1])
  94. scale([x, 1, 1])
  95. for (y = [0, panel_w - 15])
  96. translate([strip_w / 2, -strip_d, y])
  97. cube([20, strip_d, 15]);
  98. for (x = [-panel_nub_off_x, panel_nub_off_x])
  99. for (y = [panel_nub_off_y, panel_w - panel_nub_off_y])
  100. translate([x, 1, y])
  101. rotate([90, 0, 0])
  102. cylinder(d = panel_nub_hole, h = strip_d + 2);
  103. }
  104. }
  105. module conn() {
  106. difference() {
  107. translate([-conn_w / 2, -conn_d, -conn_h / 2])
  108. cube([conn_w, conn_d, conn_h]);
  109. for (x = [-1, 1])
  110. for (y = [0, -hole_off_y * 2])
  111. translate([x * hole_off_x, -conn_d - 1, hole_off_y + y])
  112. rotate([-90, 0, 0])
  113. cylinder(d = strip_hole_d, h = strip_d + 2);
  114. }
  115. }
  116. module foot_half() {
  117. difference() {
  118. foot();
  119. translate([-50, -100, -50])
  120. cube([50, 200, 200]);
  121. }
  122. }
  123. module foot_strip_half() {
  124. difference() {
  125. foot_strip();
  126. translate([-50, -10, -5])
  127. cube([50, 20, 200]);
  128. }
  129. }
  130. module conn_half() {
  131. difference() {
  132. conn();
  133. translate([-50, -10, -100])
  134. cube([50, 20, 200]);
  135. }
  136. }
  137. module pi_mount_piece(l, z) {
  138. translate([0, 0, z])
  139. difference() {
  140. translate([0, -pi_mount_d - strip_d - conn_d, 0])
  141. cube([panel_w, pi_mount_d, pi_mount_w]);
  142. for (x = [hole_off_x, panel_w - hole_off_x])
  143. translate([x, -strip_d - foot_d - pi_mount_d - 1, pi_mount_w / 2])
  144. rotate([-90, 0, 0])
  145. cylinder(d = strip_hole_d, h = strip_d + 2);
  146. }
  147. difference() {
  148. // TODO hardcoded
  149. for (x = [32, (pi_height + panel_w) / 2 - 11])
  150. translate([x + pi_off_x, -pi_mount_d - strip_d - conn_d, ((sign(l) < 0) ? l : pi_mount_w) + z])
  151. cube([pi_mount_w, pi_mount_d, abs(l) + 0.1]);
  152. translate([(pi_height + panel_w) / 2 + pi_off_x, -2 - strip_d - foot_d - conn_d - pi_mount_dist, pi_off_y])
  153. rotate([0, -90, 0])
  154. translate([0, 25, 0])
  155. holes(20, 3.5, 3.5);
  156. }
  157. // TODO missing slot nub holes!
  158. }
  159. module pi_mount() {
  160. %translate([(pi_height + panel_w) / 2 + pi_off_x, -2 - strip_d - foot_d - pi_mount_d - pi_mount_dist, pi_off_y])
  161. rotate([0, -90, 0])
  162. pi();
  163. color("red") {
  164. // TODO hardcoded
  165. pi_mount_piece(7, hole_off_y - pi_mount_w / 2);
  166. pi_mount_piece(-20, panel_w - hole_off_y - pi_mount_w / 2);
  167. }
  168. }
  169. psu_w = 98.3;
  170. psu_h = 129.2;
  171. psu_d = 40.1;
  172. psu_hole_dia = 4.0;
  173. psu_hole_w = 35.5 - 2.4;
  174. psu_hole_h = 44.4 - 2.4;
  175. psu_hole_x = 29.85 + 1.2;
  176. psu_hole_y = 34.85 + 1.2;
  177. psu_y_off = 30;
  178. psu_mount_w = 15;
  179. psu_mount_d = foot_d;
  180. module psu_holes() {
  181. for (x = [0, psu_hole_w])
  182. for (y = [0, psu_hole_h])
  183. translate([x + psu_hole_x, -1, y + psu_hole_y])
  184. rotate([-90, 0, 0])
  185. cylinder(d = psu_hole_dia, h = psu_d + 10);
  186. }
  187. module psu_mount_piece(l, z) {
  188. difference() {
  189. translate([0, 0, z])
  190. union() {
  191. translate([0, -psu_mount_d - strip_d - conn_d, 0])
  192. cube([panel_w, psu_mount_d, psu_mount_w]);
  193. for (x = [0, psu_hole_w])
  194. translate([x + (panel_w - psu_w) / 2 + psu_hole_x - psu_mount_w / 2, -psu_mount_d - strip_d - conn_d, ((sign(l) < 0) ? l : psu_mount_w)])
  195. cube([psu_mount_w, psu_mount_d, abs(l) + 0.1]);
  196. }
  197. translate([0, 0, z])
  198. for (x = [hole_off_x, panel_w - hole_off_x])
  199. translate([x, -strip_d - foot_d - psu_mount_d - 1, psu_mount_w / 2])
  200. rotate([-90, 0, 0])
  201. cylinder(d = strip_hole_d, h = strip_d + 2);
  202. translate([(panel_w - psu_w) / 2, -psu_d - strip_d - foot_d - psu_mount_d, psu_y_off])
  203. psu_holes();
  204. // TODO missing slot nub holes!
  205. }
  206. }
  207. module psu_mount() {
  208. %translate([(panel_w - psu_w) / 2, -psu_d - strip_d - foot_d - psu_mount_d, psu_y_off])
  209. difference() {
  210. cube([psu_w, psu_d, psu_h]);
  211. translate([0, -5, 0])
  212. psu_holes();
  213. }
  214. color("red") {
  215. // TODO hardcoded
  216. psu_mount_piece(46, hole_off_y - psu_mount_w / 2);
  217. psu_mount_piece(0, panel_w - hole_off_y - psu_mount_w / 2);
  218. }
  219. }
  220. module two_by_two() {
  221. %for (x = [0, panel_w])
  222. for (y = [0, panel_w])
  223. translate([x, 0, y])
  224. panel();
  225. pi_mount();
  226. translate([panel_w, 0, 0])
  227. psu_mount();
  228. translate([panel_w, 0, 0]) {
  229. color("green")
  230. for (y = [0, panel_w])
  231. translate([0, 0, y])
  232. foot_strip();
  233. color("yellow")
  234. foot();
  235. }
  236. for (y = [0, panel_w])
  237. translate([0, 0, y]) {
  238. color("cyan")
  239. foot_strip_half();
  240. color("orange")
  241. if (y == 0)
  242. foot_half();
  243. translate([panel_w * 2, 0, 0])
  244. scale([-1, 1, 1]) {
  245. color("cyan")
  246. foot_strip_half();
  247. color("orange")
  248. if (y == 0)
  249. foot_half();
  250. }
  251. }
  252. color("magenta")
  253. translate([panel_w, -strip_d, panel_w])
  254. conn();
  255. color("blue")
  256. for (x = [0, panel_w * 2])
  257. translate([x, -strip_d, panel_w])
  258. scale([x == 0 ? 1 : -1, 1, 1])
  259. conn_half();
  260. }
  261. module three_by_one() {
  262. %for (x = [0, panel_w, panel_w * 2])
  263. translate([x, 0, 0])
  264. panel();
  265. pi_mount();
  266. translate([panel_w * 2, 0, 0])
  267. psu_mount();
  268. // TODO filler pieces for top gap
  269. for (x = [panel_w, panel_w * 2])
  270. translate([x, 0, 0]) {
  271. color("green")
  272. foot_strip();
  273. color("yellow")
  274. foot();
  275. }
  276. color("cyan")
  277. foot_strip_half();
  278. color("orange")
  279. foot_half();
  280. translate([panel_w * 3, 0, 0])
  281. scale([-1, 1, 1]) {
  282. color("cyan")
  283. foot_strip_half();
  284. color("orange")
  285. foot_half();
  286. }
  287. }
  288. two_by_two();
  289. //three_by_one();
  290. //foot_strip();
  291. //foot_strip_half();
  292. //foot();
  293. //foot_half();
  294. //conn();
  295. //conn_half();
  296. //pi_mount();
  297. //psu_mount();