You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

127 lines
3.8 KiB

  1. include <BOSL/constants.scad>
  2. use <BOSL/transforms.scad>
  3. use <BOSL/shapes.scad>
  4. xray = false;
  5. model = 1;
  6. pcb_pos = [0, 0, 6];
  7. pcb_size = [108, 63, 2];
  8. sensor_size = [pcb_size.x, pcb_size.y, 18 + 2];
  9. pcb_stand_diam = 5.2;
  10. pcb_hole_diam = 3;
  11. box_wall = 2;
  12. box_wall_rounding = 1;
  13. box_core_size = [sensor_size.x + 9 + box_wall*2, sensor_size.y + 3 + box_wall*2, sensor_size.z + box_wall*1.8];
  14. /*box_switchboard_size = [16, box_core_size.y, box_core_size.z];
  15. box_switchboard_chamber_pos = [(box_core_size.x + box_switchboard_size.x)/2 - 2*box_wall, 0, box_switchboard_size.z/2];
  16. box_switchboard_chamber_size = [box_switchboard_size.x + box_wall, box_switchboard_size.y - box_wall*2, box_switchboard_size.z - box_wall*3];*/
  17. box_cavity_size = [sensor_size.x + 4, sensor_size.y + 1, sensor_size.z + box_wall*2];
  18. box_lid_pos = [0, 0, sensor_size.z];
  19. box_lid_size = [115, 67.5, 1.7];
  20. box_pos = [/*box_switchboard_size.x/2*/0, 0, 0];
  21. box_size = [box_core_size.x /*+ box_switchboard_size.x*/, box_core_size.y, box_core_size.z];
  22. function get_servo_box_size() = box_size;
  23. module foreach_mount_hole() {
  24. for (x = [0:1]) {
  25. for (y = [0:1]) {
  26. left((1-2*x)*(pcb_size.x/2 - pcb_stand_diam/2 - pcb_hole_diam/4 + 0.5))
  27. fwd((1-2*y)*(pcb_size.y/2 - pcb_stand_diam/2 - pcb_hole_diam/4))
  28. children();
  29. }
  30. }
  31. }
  32. module pcb_mount_holes() {
  33. foreach_mount_hole() {
  34. cylinder(h=sensor_size.z, d=pcb_hole_diam, $fn=10);
  35. }
  36. }
  37. module pcb_stands() {
  38. foreach_mount_hole() {
  39. cylinder(h=sensor_size.z, d=pcb_stand_diam + 1.8, $fn=15);
  40. cylinder(h=sensor_size.z + 5.6, d=pcb_hole_diam + 1.0, $fn=10);
  41. }
  42. }
  43. module sensor_connectors_power() {
  44. pwr_diam=10;
  45. fwd(pcb_size.y/2 - 22.3) right(pcb_size.x/2 - 2) up(pcb_pos.z + 8.2) zrot(-90) xrot(-90) cylinder(h=50, d1=pwr_diam, d2=pwr_diam+2, $fn=20);
  46. }
  47. module sensor_connectors_space() {
  48. jack_diam=12;
  49. fwd(pcb_size.y/2 - 15.5) left(pcb_size.x/2 - 2) up(pcb_pos.z + 4) zrot(-90) xrot(90) cylinder(h=/*20*/7, d=jack_diam, $fn=20);
  50. //sensor_connectors_power();
  51. /*switch_size=[20, 8, 3.8];
  52. back(pcb_size.y/2 - 28.2) right(pcb_size.x/2 + switch_size.x/2 - 2) up(pcb_pos.z + switch_size.z/2 + 2.3) cube(switch_size, center=true);*/
  53. /*conn_size=[20, 8, 3.8];
  54. back(3) left(pcb_size.x/2 + conn_size.x/2 - 2) up(pcb_pos.z + conn_size.z/2 + 2.3) cube(conn_size, center=true);*/
  55. }
  56. module sensor() {
  57. difference() {
  58. translate(pcb_pos) up(pcb_size.z/2)
  59. cube(pcb_size, center=true);
  60. pcb_mount_holes();
  61. }
  62. pcb_stands();
  63. }
  64. module sensor_lid() {
  65. difference() {
  66. translate(box_lid_pos) up(box_lid_size.z/2)
  67. cube(box_lid_size, center=true);
  68. pcb_mount_holes();
  69. }
  70. }
  71. // ----
  72. module box() {
  73. difference() {
  74. translate(box_pos) up(box_size.z/2) cuboid(box_size, chamfer=box_wall_rounding);
  75. up(sensor_size.z/2 + box_wall*2.5) cube(box_cavity_size, center=true);
  76. up(box_lid_size.z/2 + box_wall) translate(box_lid_pos) cube(box_lid_size, center=true);
  77. up(box_wall) sensor_connectors_space();
  78. up(box_wall) pcb_stands();
  79. up(box_wall) up(sensor_size.z) xrot(180) pcb_stands();
  80. /*up(box_size.z - box_wall) {
  81. back(box_size.y/2 - 12) right(box_size.x/2 - 2) switch();
  82. back(box_size.y/2 - 32) right(box_size.x/2 - 2) switch();
  83. fwd(box_size.y/2 - 12) right(box_size.x/2 - 2) switch();
  84. }*/
  85. //translate(box_switchboard_chamber_pos) cuboid(box_switchboard_chamber_size, chamfer=1);
  86. }
  87. }
  88. module model_box() {
  89. box();
  90. }
  91. // ----
  92. if (xray) {
  93. intersection() {
  94. box();
  95. down(500) left(10) fwd(10) cube([1000, 1000, 1000]);
  96. }
  97. } else {
  98. box();
  99. }
  100. if (model == 0) {
  101. up(box_wall) union() {
  102. //sensor();
  103. //sensor_lid();
  104. %sensor_connectors_space();
  105. }
  106. }