iceMelting.scad 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. //This object changes its state when its temperature is above 0°C for some minutes.
  2. //The ice will melt and flow into the other chamber where it can be detected.
  3. //The temperature is changeable depending on what the ice is made of. For example saturated salt water will melt at ~21°C and can be detected through this method.
  4. //Render conductive or non-conductive parts
  5. conductive = false;
  6. //Render the cross section or complete object
  7. crossSection = true;
  8. //Add a hole to fill the object after finishing printing
  9. fillLater = true;
  10. //Diameter of the conductive part that will be on the touch screen
  11. sizeScreen=4.0;
  12. //Diameter of the conductive part that will be connected to the finger
  13. sizeFinger=4.0;
  14. //The main block where everything else gets cut out
  15. module baseBlock() {
  16. translate([1,0,0])
  17. cube([42,20,30], center=true);
  18. }
  19. //Additional part on the side wall for easier recognition which object this is
  20. module recognitionAddition() {
  21. difference (){
  22. color("green")
  23. translate([-21,0,5])
  24. cube([2,10,40], center=true);
  25. baseBlock();
  26. roofAddition();
  27. }
  28. }
  29. //The chamber where the melted water will be caught
  30. module conductiveChamber() {
  31. color("blue")
  32. translate([10,0,8])
  33. cube([16,16,26], center=true);
  34. }
  35. //The chamber where the ice will be filled in
  36. module iceChamber() {
  37. color("blue")
  38. translate([-10,0,13])
  39. cube([16,16,16], center=true);
  40. }
  41. //The roof of the ice chamber
  42. module iceRoof() {
  43. color("blue")
  44. translate([-10,0,5])
  45. rotate([0,45,0])
  46. cube([11.3,16,11.3], center=true);
  47. }
  48. //The roof of the conductive chamber
  49. module conductiveRoof() {
  50. color("blue")
  51. translate([10,0,-5])
  52. rotate([0,45,0])
  53. cube([11.3,16,11.3], center=true);
  54. }
  55. //The tunnel where the melted water flows through to get into the conductive chamber
  56. module meltingTunnel() {
  57. color("blue")
  58. translate([-4.5,0,-0.5])
  59. rotate([0,100,0])
  60. cylinder(r=1.5,h=15, $fa=1, $fs=0.5, center=true);
  61. }
  62. //Addition to the main block, added later for the roof cutout. TODO move to baseBlock
  63. module roofAddition() {
  64. translate([1,0,20])
  65. cube([42,20,10], center=true);
  66. }
  67. //The hole through which the water can be filled in later
  68. module fillInHole() {
  69. color("blue")
  70. translate([-10,0,23])
  71. cylinder(r=1,h=4, $fa=1, $fs=0.5, center=true);
  72. }
  73. //Conductive bar on the floor, connected to the touch screen
  74. module condBarFloor() {
  75. color("red")
  76. translate([4,0,22])
  77. cube([4,14,2], center=true);
  78. }
  79. //Conductive bar on the wall, connected to the finger
  80. module condBarWall() {
  81. color("red")
  82. translate([19,0,13])
  83. cube([2,14,14], center=true);
  84. }
  85. //Conductive part on the outside, connected to the touchscreen
  86. module condTouchscreen() {
  87. color("red")
  88. translate([4,0,24])
  89. cylinder(r=sizeScreen/2,h=2, $fa=1, $fs=0.5, center=true);
  90. }
  91. //Conductive part on the outside, connected to the finger
  92. module condFinger() {
  93. color("red")
  94. translate([21,0,8])
  95. rotate([0,90,0])
  96. cylinder(r=sizeFinger/2,h=2, $fa=1, $fs=0.5, center=true);
  97. }
  98. //All conductive parts combined to one module
  99. module conductive() {
  100. union() {
  101. condBarFloor();
  102. condBarWall();
  103. condTouchscreen();
  104. condFinger();
  105. }
  106. }
  107. //The complete non-conducitve object
  108. module completeObject() {
  109. difference() {
  110. union() {
  111. baseBlock();
  112. roofAddition();
  113. recognitionAddition();
  114. }
  115. union() {
  116. conductiveChamber();
  117. iceChamber();
  118. iceRoof();
  119. conductiveRoof();
  120. meltingTunnel();
  121. if (fillLater)
  122. fillInHole();
  123. conductive();
  124. }
  125. }
  126. }
  127. //Rotate the object for easier printing
  128. rotate([0,180,0])
  129. //Render the object depending on the input
  130. if (crossSection) {
  131. difference() {
  132. if (conductive) {
  133. conductive();
  134. }
  135. else {
  136. completeObject();
  137. }
  138. translate([-30,-60,-30])
  139. cube([60,60,60]);
  140. }
  141. }
  142. else {
  143. if (conductive) {
  144. conductive();
  145. }
  146. else {
  147. completeObject();
  148. }
  149. }