hygrometer-stand.scad 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. /*
  2. ** Hygrometer Stand
  3. **
  4. ** Created by Wolfgang Thomas
  5. **
  6. */
  7. // Print view
  8. printView = 0; // [0,1]
  9. // View Hygrometer
  10. viewHygrometer = 0; // [0,1]
  11. // Stand angle
  12. standAngle = 70; // [30 : 90]
  13. // Stand width (mm)
  14. width = 55; // [50 : 70]
  15. // Hold offset (mm)
  16. holdOffset =5; // [1 : 20]
  17. // Stand bottom area width (mm 0 = solid )
  18. standBottomWidth = 10.0; //
  19. // generate a simpler bottom - could be printed without support
  20. simpleBottom = 1;
  21. // Additional Text offset from bottom (mm)
  22. textOffset = 0.5;
  23. // text cut depth - should be a multible of a layer height
  24. textCutDepth = 1.0;
  25. // circle detail (steps to generate a circle)
  26. stepsPerCycle = 180; // [30:360]
  27. // Some text on front
  28. drawText = "Sample";
  29. // Text font to use ( the default is Arial )
  30. textFont="Arial";
  31. // Height of text (mm)
  32. textHeight = 6;
  33. // Use a bold font
  34. useBoldFont = 1; // [0,1]
  35. // Use a bold font
  36. useItalicFont = 1; // [0,1]
  37. // Hygrometer diamter (mm)
  38. diameter = 41.2;
  39. // printing tollerance (mm)
  40. tolerance = 0.3;
  41. // Stand thickness (mm)
  42. thickness =2.4;
  43. // wall to create (mm) 0 = no wall will be created
  44. wallWidth = 1.2;
  45. // Cut width (mm)
  46. cutWidth = 7.0;
  47. // Cut angle
  48. cutAngle = 0.0;
  49. // Cut distance (mm)
  50. cutDistance = 44.28;
  51. // First layer height
  52. //firstLayerHeight = 0.2;
  53. // general layer height
  54. //layerHeight = 0.2;
  55. printAngle = (180 - standAngle) * printView ;
  56. /* [Hidden] */
  57. $fn = stepsPerCycle;
  58. //
  59. // view the stand
  60. //
  61. rotate([printAngle,0,0])
  62. difference()
  63. {
  64. zOffset = sin(standAngle)*(holdOffset+width/2) ;//- thickness;
  65. xOffset = cos(standAngle) * (holdOffset+width/2);//-0.5;
  66. // Areas to view
  67. union()
  68. {
  69. translate([0,xOffset,zOffset])
  70. rotate([standAngle,0,0])
  71. {
  72. hull()
  73. {
  74. cylinder(r= width/2 , h = thickness ,center=true);
  75. translate([0,-width/2,0])
  76. cube([width,holdOffset*2,thickness],center=true);
  77. }
  78. // behind text area
  79. // translate([0,-width/2+textOffset,thickness/2-layerHeight+0])
  80. // cube([width-10,holdOffset*1.5,layerHeight],center=true);
  81. }
  82. // connectiong bottom and front
  83. rotate([0,90,0])
  84. cylinder(r=thickness/2, h=width,center=true);
  85. if( simpleBottom )
  86. {
  87. sizeY = holdOffset+width/2;
  88. translate([0,+sizeY/2,0])
  89. {
  90. cube([width,+sizeY,thickness],center=true);
  91. translate([0,(+sizeY)/2,0])
  92. for( xMul = [1,-1])
  93. {
  94. translate( [xMul * ( width/2 - standBottomWidth/2 ),0,0] )
  95. cylinder( d=standBottomWidth, h=thickness, center = true );
  96. }
  97. }
  98. }
  99. else
  100. {
  101. translate([0,holdOffset+width/2,0])
  102. hull()
  103. {
  104. cylinder(r= width/2 , h = thickness ,center=true);
  105. translate([0,-width/2,0])
  106. cube([width,holdOffset*2,thickness],center=true);
  107. }
  108. }
  109. // bottom - front enforcement
  110. if(1)
  111. hull()
  112. translate([0,0,0])
  113. {
  114. s = standBottomWidth;//*4/5;
  115. if( standBottomWidth == 0 )
  116. {
  117. s = 10;
  118. }
  119. w = width;
  120. translate([-w/2,0,0])
  121. cube([w,s,0.01]);
  122. translate([-w/2,0,0])
  123. rotate([standAngle,0,0])
  124. cube([w,s,0.01]);
  125. }
  126. // walls
  127. if( wallWidth > 0 )
  128. {
  129. wallSize = zOffset;
  130. difference()
  131. {
  132. union()
  133. {
  134. // translate([0,thickness+wallSize/2,wallWidth/2-0.1])
  135. {
  136. for( xOffset = [-1,1] )
  137. translate([xOffset*(width/2-wallWidth/2),0,0])
  138. {
  139. hull()
  140. for( angle = [0,standAngle] )
  141. rotate([angle,0,0])
  142. translate([0,thickness+wallSize/2,wallWidth/2])
  143. {
  144. cube([wallWidth,wallSize,0.1],center=true);
  145. }
  146. }
  147. }
  148. }
  149. union()
  150. {
  151. beta = standAngle/2;
  152. h = tan( beta ) * wallSize;
  153. rotate([0,90,0])
  154. translate([-h,zOffset,0])
  155. cylinder( r = h, h = width+2 ,center = true );
  156. }
  157. }
  158. }
  159. }
  160. // Areas to cut from view
  161. union()
  162. {
  163. // front cut
  164. translate([0,xOffset,zOffset])
  165. rotate([standAngle,0,0])
  166. {
  167. cutDiameter = diameter + tolerance;
  168. cylinder(r=cutDiameter/2 , h = thickness+0.2 ,center=true);
  169. // Cut in upper circle
  170. rotate([0,0,cutAngle])
  171. cube([cutDistance,cutWidth,thickness+1],center=true);
  172. if( drawText != "" )
  173. {
  174. translate([0,-width/2-holdOffset/2+textOffset,thickness/2-textCutDepth+0.01])
  175. linear_extrude(height = textCutDepth) {
  176. if( useBoldFont )
  177. {
  178. if( useItalicFont )
  179. {
  180. styledFont=str(textFont , ":style=Bold Italic");
  181. text(drawText,size=textHeight,halign="center",font=styledFont );
  182. }
  183. else
  184. {
  185. styledFont=str(textFont , ":style=Bold");
  186. text(drawText,size=textHeight,halign="center",font=styledFont );
  187. }
  188. }
  189. else
  190. {
  191. if( useItalicFont )
  192. {
  193. styledFont=str(textFont ,":style=Italic");
  194. text(drawText,size=textHeight,halign="center",font=styledFont );
  195. }
  196. else
  197. {
  198. styledFont=textFont;
  199. text(drawText,size=textHeight,halign="center",font=styledFont );
  200. }
  201. }
  202. }
  203. }
  204. }
  205. if( simpleBottom )
  206. {
  207. if( standBottomWidth > 0 && standBottomWidth < width/2)
  208. {
  209. translate([0,holdOffset+width/2,0])
  210. cylinder(r= width/2-standBottomWidth , h = thickness+1 ,center=true);
  211. }
  212. // translate([0,zOffset,0])
  213. // cube([width+1,10,thickness+1],center=true);
  214. }
  215. else
  216. {
  217. // bottom cut
  218. if( standBottomWidth > 0 && standBottomWidth < width/2)
  219. translate([0,holdOffset+width/2,0])
  220. hull()
  221. {
  222. cylinder(r= width/2-standBottomWidth , h = thickness+1 ,center=true);
  223. translate([0,-width/2+standBottomWidth,0])
  224. cube([width-standBottomWidth*2,holdOffset*2,thickness],center=true);
  225. }
  226. }
  227. }
  228. }
  229. //
  230. // view the Hygrometer
  231. //
  232. if( printView == 0 && viewHygrometer)
  233. rotate([printAngle,0,0])
  234. union()
  235. {
  236. zOffset = sin(standAngle)*(holdOffset+width/2) ;//- thickness;
  237. xOffset = cos(standAngle) * (holdOffset+width/2);//-0.5;
  238. // Hygrometer to view
  239. color([0.8,0.8,0.8])
  240. union()
  241. {
  242. bottomWidth = diameter + 4;
  243. topWidth = bottomWidth -12;
  244. innerWidth = 25;
  245. translate([0,xOffset,zOffset])
  246. rotate([standAngle,0,0])
  247. {
  248. difference()
  249. {
  250. union()
  251. {
  252. h=14;
  253. translate([0,0,-h/2+thickness/2])
  254. {
  255. cylinder (r=diameter/2,h=h,center=true);
  256. }
  257. translate([0,0,thickness/2])
  258. cylinder( r1= bottomWidth/2, r2=topWidth/2,h=1.5);
  259. }
  260. union()
  261. {
  262. translate([0,0,1.8])
  263. cylinder( r2=topWidth/2,r1=innerWidth/2,h=2,center=true);
  264. }
  265. }
  266. }
  267. }
  268. }