iceFreezing.scad 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. //This object changes its state when the water in the bigger chamber is freezing.
  2. //The ice will break through the red wall, when melting water will flow through the crack into the smaller chamber.
  3. //Render conductive or non-conductive parts
  4. conductive = false;
  5. //Render the cross section or complete object
  6. crossSection = true;
  7. //Add a hole to fill the object after finishing printing
  8. fillLater = true;
  9. //Diameter of the conductive part that will be on the touch screen
  10. sizeScreen=4.0;
  11. //Diameter of the conductive part that will be connected to the finger
  12. sizeFinger=4.0;
  13. //Base block where everything else gets cut out
  14. module baseBlock() {
  15. translate([-7.5,0,-1])
  16. cube([43,20,32], center=true);
  17. }
  18. //Part on the outside for easier recognition which object this is
  19. module recognitionAddition() {
  20. difference (){
  21. color("green")
  22. translate([0,-10,-1])
  23. cylinder(r=3,h=32, $fa=1, $fs=0.5, center=true);
  24. baseBlock();
  25. }
  26. }
  27. //chamber where the water gets filled in
  28. module waterChamber() {
  29. color("blue")
  30. translate([0,0,-2])
  31. cube([25,16,16], center=true);
  32. }
  33. //Chamber where water will be caught
  34. module frozenChamber() {
  35. color("blue")
  36. translate([-19,0,-4])
  37. cube([12,16,12], center=true);
  38. }
  39. //Cheiling for the chamber with the caught water
  40. module ceilingFrozen() {
  41. color("blue")
  42. difference() {
  43. translate([-13,0,2])
  44. rotate([0,45,0])
  45. cube([17,16,17], center=true);
  46. translate([-3,0,2])
  47. cube([20,20,40], center=true);
  48. translate([-13,0,-8])
  49. cube([40,20,20], center=true);
  50. }
  51. }
  52. //Ceiling for the water chamber
  53. module ceiling() {
  54. color("blue")
  55. translate([0,0,6])
  56. rotate([45,0,0])
  57. cube([25,11.3,11.3], center=true);
  58. }
  59. //Hole to fill the object after printing
  60. module fillInHole() {
  61. color("blue")
  62. translate([0,0,14])
  63. cylinder(r=1,h=2, $fa=1, $fs=0.5, center=true);
  64. }
  65. //Wall made out of conductive filament. Not used for recognition, only the fragile characteristic is used.
  66. module condWall() {
  67. color("red")
  68. translate([-12.75,0,2])
  69. cube([0.5,12,20], center=true);
  70. }
  71. //Conductive part on the inside, connected to the touch screen
  72. module condFloor() {
  73. color("red")
  74. translate([-16,0,-10.5])
  75. cube([4,14,1], center=true);
  76. }
  77. //Conductive part on the bottom, connected to the touch screen
  78. module condTouchscreen() {
  79. color("red")
  80. translate([-16,0,-14])
  81. cylinder(r=sizeScreen/2,h=6, $fa=1, $fs=0.5, center=true);
  82. }
  83. //Conductive part on the inside, connected to the finger
  84. module condSide() {
  85. color("red")
  86. translate([-25.5,0,-7])
  87. cube([1,12,4], center=true);
  88. }
  89. //Conducitve part on the outside, connected to the finger
  90. module condFinger() {
  91. color("red")
  92. translate([-28,0,0])
  93. rotate([0,90,0])
  94. cylinder(r=sizeFinger/2,h=2, $fa=1, $fs=0.5, center=true);
  95. }
  96. //Connects the inner and outer part for the finger connection
  97. module condConnection() {
  98. color("red")
  99. translate([-26.5,0,-4])
  100. cube([2,4,10], center=true);
  101. }
  102. //All conducitve parts in one module
  103. module conductive() {
  104. union() {
  105. condWall();
  106. condFloor();
  107. condTouchscreen();
  108. condSide();
  109. condFinger();
  110. condConnection();
  111. }
  112. }
  113. //The whole object
  114. module completeObject() {
  115. difference() {
  116. union() {
  117. baseBlock();
  118. recognitionAddition();
  119. }
  120. union() {
  121. waterChamber();
  122. frozenChamber();
  123. ceilingFrozen();
  124. ceiling();
  125. if (fillLater)
  126. fillInHole();
  127. conductive();
  128. }
  129. }
  130. }
  131. //Render the object depending on the input
  132. if (crossSection) {
  133. difference() {
  134. if (conductive) {
  135. conductive();
  136. }
  137. else {
  138. completeObject();
  139. }
  140. translate([-30,-60,-30])
  141. cube([60,60,60]);
  142. }
  143. }
  144. else {
  145. if (conductive) {
  146. conductive();
  147. }
  148. else {
  149. completeObject();
  150. }
  151. }