Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //currantly the box is unfinished, but you can still use faceplate.
  2. $fa=1/1;
  3. $fs=1/2;
  4. bissl=1/100;
  5. part="bottom";//[bottom,top,faceplate]
  6. pegs_h=5;
  7. pegs_id=3;
  8. pegs_od=7;
  9. wall=1;
  10. depth=30;
  11. air=0.5; //wiggle room
  12. //board (and box) size goes here
  13. //defined as corners of inner space relatove to x=y=0 point on the board
  14. //[x1,y1,x2,y2]
  15. board=[-2,-2,90.81+4,118.75+2];
  16. screen=[67.2+2,16.5-10,20,27];
  17. //holes in the front panel
  18. //defined as [x,y,diameter], where x from KiCAD becomes y and y becomes x, because
  19. //coordinate conventions in Kicad and OpenSCAD are mirrored
  20. holes_positions=[
  21. [48.90,66.68,12], //encoder
  22. [48.3,85.4,7], //power
  23. [71.12,48.26,8], //leds
  24. [71.12,67.31,8],
  25. [71.12,86.36,8],
  26. [71.12,105.41,8],
  27. [85.73,48,12], //buttons
  28. [85.73,67.3,12],
  29. [85.73,86.36,12],
  30. [85.73,105.41,12]];
  31. //standoffs to hold the board
  32. //defined as [x,y,id,od,height], where x from KiCAD becomes y and y becomes x, because
  33. //coordinate conventions in Kicad and OpenSCAD are mirrored
  34. mount_pegs=[
  35. [1.90,1.90,pegs_id,pegs_od,pegs_h],
  36. [1.90,116.84,pegs_id,pegs_od,pegs_h],
  37. [88.90,1.90,pegs_id,pegs_od,pegs_h],
  38. [88.90,116.84,pegs_id,pegs_od,pegs_h]
  39. ];
  40. module bottom() {
  41. difference() {
  42. translate([board[0]-wall,board[1]-wall,-wall]) cube([board[2]-board[0]+2*wall,board[3]-board[1]+2*wall,depth+wall]);
  43. translate([board[0],board[1],0]) cube([board[2]-board[0],board[3]-board[1],depth+bissl]);
  44. }
  45. for (peg=mount_pegs) {
  46. translate([peg[0],peg[1],0]) difference() {
  47. cylinder(d=peg[3],h=peg[4]);
  48. translate([0,0,-bissl]) cylinder(d=peg[2],h=peg[4]+2*bissl);
  49. }
  50. }
  51. }
  52. module faceplate() {
  53. difference() {
  54. translate([board[0]-wall,board[1]-wall,0]) cube([board[2]-board[0]+2*wall,board[3]-board[1]+2*wall,wall]);
  55. for (hole=holes_positions) {
  56. translate([hole[0],hole[1],-bissl]) cylinder(d=hole[2],h=wall+2*bissl);
  57. }
  58. translate([screen[0],screen[1],-bissl])cube([screen[2],screen[3],wall+2*bissl]);
  59. }
  60. };
  61. module top() {
  62. mirror([0,0,1])faceplate();
  63. difference() {
  64. translate([board[0]-wall,board[1]-wall,0]) cube([board[2]-board[0]+2*wall,board[3]-board[1]+2*wall,depth]);
  65. translate([board[0],board[1],-bissl]) cube([board[2]-board[0],board[3]-board[1],depth+2*bissl]);
  66. }
  67. }
  68. if (part=="bottom") bottom();
  69. if (part=="faceplate") faceplate();
  70. if (part=="top") top();
  71. if (part=="all") {
  72. bottom();
  73. translate([0,0,depth+wall]) faceplate();
  74. }