bamboo_pot.scad 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. include <../config/bamboo_pot.scad>
  2. include <../config/thread.scad>
  3. include <../config/wall.scad>
  4. include <thread.scad>
  5. module bamboo_pot_object() {
  6. module water_shape() {
  7. outside_radius
  8. = bamboo_pot_plant_entrance_diameter / 2
  9. + bamboo_pot_thickness;
  10. inside_radius
  11. = outside_radius
  12. - bamboo_pot_thickness;
  13. difference() {
  14. circle(r = outside_radius);
  15. circle(r = inside_radius);
  16. }
  17. }
  18. module entrance_object() {
  19. inside_radius
  20. = bamboo_pot_plant_entrance_diameter / 2;
  21. outside_radius
  22. = inside_radius
  23. + bamboo_pot_thickness
  24. + thread_height / 2;
  25. flat_width
  26. = thread_top_diameter;
  27. module base_shape() {
  28. move = flat_width / 2;
  29. center_size = [flat_width, outside_radius * 2];
  30. square(center_size, center = true);
  31. translate([-move, 0]) {
  32. circle(r = outside_radius);
  33. }
  34. translate([move, 0]) {
  35. circle(r = outside_radius);
  36. }
  37. }
  38. module shape() {
  39. move_center
  40. = thread_height / 2;
  41. difference() {
  42. base_shape();
  43. translate([0, move_center]) {
  44. circle(r = inside_radius);
  45. }
  46. }
  47. }
  48. module base_object() {
  49. height
  50. = bamboo_pot_height;
  51. linear_extrude(height = height, center = true) {
  52. shape();
  53. }
  54. }
  55. module mount_holes_object() {
  56. module hole_object() {
  57. height
  58. = bamboo_pot_thickness;
  59. move_y
  60. = outside_radius
  61. - height / 2;
  62. radius
  63. = bamboo_pot_mount_holes_diameter / 2;
  64. translate([0, move_y, 0]) {
  65. rotate([90, 0, 0]) {
  66. cylinder(r = radius, h = height, center = true);
  67. }
  68. }
  69. }
  70. move_x
  71. = flat_width / 2
  72. - bamboo_pot_mount_holes_diameter;
  73. translate([-move_x, 0, 0]) {
  74. hole_object();
  75. }
  76. translate([move_x, 0, 0]) {
  77. hole_object();
  78. }
  79. }
  80. module bottom_hull_object() {
  81. height
  82. = bamboo_pot_hull_height;
  83. hole_move_y
  84. = thread_height / 2;
  85. thickness
  86. = 1 / $fn;
  87. module start_object() {
  88. translate([0, 0, -thickness]) {
  89. linear_extrude(height = thickness) {
  90. base_shape();
  91. }
  92. }
  93. }
  94. module end_object() {
  95. linear_extrude(height = thickness) {
  96. translate([0, hole_move_y, 0]) {
  97. water_shape();
  98. }
  99. }
  100. }
  101. module base_object() {
  102. hull() {
  103. translate([0, 0, height / 2]) {
  104. start_object();
  105. }
  106. translate([0, 0, -height / 2]) {
  107. end_object();
  108. }
  109. }
  110. }
  111. module water_hole_object() {
  112. radius
  113. = bamboo_pot_plant_entrance_diameter / 2;
  114. translate([0, hole_move_y, 0]) {
  115. cylinder(r = radius, h = height, center = true);
  116. }
  117. }
  118. difference() {
  119. base_object();
  120. water_hole_object();
  121. }
  122. }
  123. module bamboo_object() {
  124. height
  125. = bamboo_pot_height
  126. - bamboo_pot_thickness * 2;
  127. top
  128. = height / 2
  129. - thread_top_diameter / 2;
  130. move_y
  131. = thread_height / 2
  132. - outside_radius;
  133. mount_holes_z
  134. = bamboo_pot_height / 2
  135. - bamboo_pot_mount_holes_margin;
  136. difference() {
  137. base_object();
  138. translate([0, 0, mount_holes_z]) {
  139. mount_holes_object();
  140. }
  141. for (count = [0 : wall_holes_space : height]) {
  142. translate([0, move_y, top - count]) {
  143. rotate([270, 0, 0]) {
  144. thread_object();
  145. }
  146. }
  147. }
  148. }
  149. }
  150. module object() {
  151. move_bamboo
  152. = bamboo_pot_hull_height / 2;
  153. move_bottom_hull
  154. = -bamboo_pot_height / 2;
  155. translate([0, 0, move_bamboo]) {
  156. bamboo_object();
  157. }
  158. translate([0, 0, move_bottom_hull]) {
  159. bottom_hull_object();
  160. }
  161. }
  162. render() {
  163. object();
  164. }
  165. }
  166. module water_object() {
  167. module base_object() {
  168. rotate_extrude(angle = 180) {
  169. move
  170. = bamboo_pot_water_size / 2
  171. + bamboo_pot_plant_entrance_diameter / 2
  172. + bamboo_pot_thickness;
  173. translate([move, 0]) {
  174. water_shape();
  175. }
  176. }
  177. }
  178. move_center_z
  179. = bamboo_pot_water_size / 4
  180. + bamboo_pot_plant_entrance_diameter / 2
  181. + bamboo_pot_thickness;
  182. translate([0, 0, move_center_z]) {
  183. rotate([270, 0, 90]) {
  184. base_object();
  185. }
  186. }
  187. }
  188. module watering_object() {
  189. module top_shape(inside = true) {
  190. radius
  191. = bamboo_pot_water_entrance / 2
  192. + (inside ? 0 : bamboo_pot_thickness);
  193. circle(r = radius);
  194. }
  195. move
  196. = bamboo_pot_hull_height / 2;
  197. thickness
  198. = 1 / $fn;
  199. module base_object() {
  200. module bottom_object() {
  201. linear_extrude(height = thickness) {
  202. water_shape();
  203. }
  204. }
  205. module top_object() {
  206. translate([0, 0, -thickness]) {
  207. linear_extrude(height = thickness) {
  208. top_shape(false);
  209. }
  210. }
  211. }
  212. hull() {
  213. translate([0, 0, move]) {
  214. top_object();
  215. }
  216. translate([0, 0, -move]) {
  217. bottom_object();
  218. }
  219. }
  220. }
  221. module hole_object() {
  222. module bottom_object() {
  223. radius
  224. = bamboo_pot_plant_entrance_diameter / 2;
  225. cylinder(r = radius, h = thickness);
  226. }
  227. module top_object() {
  228. translate([0, 0, -thickness]) {
  229. linear_extrude(height = thickness) {
  230. top_shape(true);
  231. }
  232. }
  233. }
  234. hull() {
  235. translate([0, 0, move]) {
  236. top_object();
  237. }
  238. translate([0, 0, -move]) {
  239. bottom_object();
  240. }
  241. }
  242. }
  243. difference() {
  244. base_object();
  245. hole_object();
  246. }
  247. }
  248. module water_level_set_object() {
  249. height
  250. = bamboo_pot_water_level;
  251. linear_extrude(height = height, center = true) {
  252. water_shape();
  253. }
  254. }
  255. module final_object() {
  256. entrance_move_z
  257. = bamboo_pot_water_size / 4
  258. + bamboo_pot_plant_entrance_diameter / 2
  259. + bamboo_pot_thickness;
  260. entrance_move_y
  261. = -bamboo_pot_plant_entrance_diameter / 2
  262. - thread_height / 2
  263. - bamboo_pot_thickness
  264. - bamboo_pot_water_size / 2;
  265. water_move_z
  266. = -bamboo_pot_height / 2
  267. - bamboo_pot_hull_height / 2;
  268. water_level_set_move_y
  269. = bamboo_pot_water_size / 2
  270. + bamboo_pot_thickness
  271. + bamboo_pot_plant_entrance_diameter / 2;
  272. water_level_set_move_z
  273. = bamboo_pot_water_level / 2
  274. + entrance_move_z
  275. - bamboo_pot_height / 2
  276. - bamboo_pot_hull_height / 2;
  277. watering_move_y
  278. = water_level_set_move_y;
  279. watering_move_z
  280. = water_level_set_move_z
  281. + bamboo_pot_water_level / 2
  282. + bamboo_pot_hull_height / 2;
  283. translate([0, entrance_move_y, entrance_move_z]) {
  284. entrance_object();
  285. }
  286. translate([0, 0, water_move_z]) {
  287. water_object();
  288. }
  289. translate([0, water_level_set_move_y, water_level_set_move_z]) {
  290. water_level_set_object();
  291. }
  292. translate([0, watering_move_y, watering_move_z]) {
  293. watering_object();
  294. }
  295. }
  296. color("#20B347") {
  297. render() {
  298. final_object();
  299. }
  300. }
  301. }