tilt.scad 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. //Render conductive or non-conductive parts
  2. conductive = false;
  3. //Render the cross section or complete object
  4. crossSection = true;
  5. //Add a hole to fill the object after finishing printing
  6. fillLater = false;
  7. //Diameter of the conductive part that will be on the touch screen
  8. sizeScreen=4.0;
  9. //Diameter of the conductive part that will be connected to the finger
  10. sizeFinger=4.0;
  11. //Base block where everything else gets cut out
  12. module baseBlock() {
  13. translate([0,0,0])
  14. cube([30,18,40], center=true);
  15. }
  16. //Chamber that will be filled with water
  17. module waterChamber() {
  18. color("blue")
  19. translate([-6,0,-2])
  20. cylinder(r=7.5,h=30, $fa=1, $fs=0.5, center=true);
  21. }
  22. //Roof of the water chamber
  23. module waterRoof() {
  24. color("blue")
  25. translate([-6,0,12])
  26. sphere(r=7.5, center=true);
  27. }
  28. //Hole to fill water into the chamber
  29. module waterHole() {
  30. color("blue")
  31. translate([-6,0,18])
  32. cylinder(r=1,h=6, $fa=1, $fs=0.5, center=true);
  33. }
  34. //Connection between the two chambers
  35. module tunnel() {
  36. color("blue")
  37. translate([])
  38. rotate([0,90,0])
  39. cylinder(r=3,h=10, $fa=1, $fs=0.5, center=true);
  40. }
  41. //Second chamber that catches the water
  42. module catchChamber() {
  43. color("blue")
  44. translate([8,0,0])
  45. cylinder(r=5,h=30, $fa=1, $fs=0.5, center=true);
  46. }
  47. //Roof of the second chamber
  48. module roofCatch() {
  49. color("blue")
  50. translate([8,0,14])
  51. sphere(r=5, center=true);
  52. }
  53. //Hole where the air gets pushed through
  54. module holeCatch() {
  55. color("blue")
  56. translate([8,0,18])
  57. cylinder(r=1,h=6, $fa=1, $fs=0.5, center=true);
  58. }
  59. //Conductive part on the inside bottom
  60. module condFloor() {
  61. color("red")
  62. translate([8,0,-16])
  63. cylinder(r=5,h=2, $fa=1, $fs=0.5, center=true);
  64. }
  65. //Touchscreen electrode
  66. module condTouchscreen() {
  67. color("red")
  68. translate([8,0,-18.5])
  69. cylinder(r=sizeScreen/2,h=3, $fa=1, $fs=0.5, center=true);
  70. }
  71. //Finger electrode
  72. module condFinger() {
  73. color("red")
  74. translate([13,0,-10])
  75. rotate([0,90,0])
  76. cylinder(r=sizeFinger/2,h=4, $fa=1, $fs=0.5, center=true);
  77. }
  78. //Finger electrode cut to match the cylinder shape
  79. module condFingerCut() {
  80. difference() {
  81. condFinger();
  82. catchChamber();
  83. }
  84. }
  85. module conductive() {
  86. difference() {
  87. union() {
  88. condFloor();
  89. condTouchscreen();
  90. condFingerCut();
  91. }
  92. catchChamber();
  93. }
  94. }
  95. module completeObject() {
  96. difference() {
  97. baseBlock();
  98. union() {
  99. waterChamber();
  100. waterRoof();
  101. waterHole();
  102. tunnel();
  103. catchChamber();
  104. roofCatch();
  105. holeCatch();
  106. conductive();
  107. }
  108. }
  109. }
  110. //Render the object depending on the input
  111. if (crossSection) {
  112. difference() {
  113. if (conductive) {
  114. conductive();
  115. }
  116. else {
  117. completeObject();
  118. }
  119. translate([-30,-60,-30])
  120. cube([60,60,60]);
  121. }
  122. }
  123. else {
  124. if (conductive) {
  125. conductive();
  126. }
  127. else {
  128. completeObject();
  129. }
  130. }