Преглед изворни кода

Start working on lucky bamboo pot.

cixo пре 1 година
родитељ
комит
edfb169556
4 измењених фајлова са 151 додато и 0 уклоњено
  1. 17 0
      assets/geometry.scad
  2. 121 0
      assets/lucky_bamboo_pot.scad
  3. 9 0
      config/lucky_bamboo_pot.scad
  4. 4 0
      renders/lucky_bamboo_pot.scad

+ 17 - 0
assets/geometry.scad

@@ -0,0 +1,17 @@
+module geometry_triangle(x, h, center = true) {
+    if (center) {
+        translate([-x / 2, -h / 2]) {
+            polygon([
+                [0, 0],
+                [x, 0],
+                [0, h]
+            ]);
+        }
+    } else {
+        polygon([
+            [0, 0],
+            [x, 0],
+            [0, h]
+        ]);
+    }
+}

+ 121 - 0
assets/lucky_bamboo_pot.scad

@@ -0,0 +1,121 @@
+include <geometry.scad>
+include <../config/lucky_bamboo_pot.scad>
+
+module lucky_bamboo_pot_top_base_shape() {
+    half_depth = lucky_bamboo_pot_top_depth / 2;
+    move_x = lucky_bamboo_pot_top_width / 2 - lucky_bamboo_pot_top_depth / 2;
+
+    hull() {
+        translate([-move_x, 0]) {
+            rotate(90) {
+                circle(r = half_depth);
+            }
+        }
+
+        translate([move_x, 0]) {
+            rotate(270) {
+                circle(r = half_depth);
+            }
+        }
+    }
+}
+
+module lucky_bamboo_pot_top_mounting_hole_shape() {
+    circle(r = lucky_bamboo_pot_mounting_hole_diameter / 2);    
+}
+
+module lucky_bamboo_pot_bamboo_holes_shape() {
+    size = lucky_bamboo_pot_bamboo_diameter * 3;
+    full_width = lucky_bamboo_pot_top_width - lucky_bamboo_pot_top_depth * 2;
+    top_width = full_width - full_width % size;
+    bottom_width = top_width - size;
+    move_y = lucky_bamboo_pot_top_depth / 4;
+
+    for (count = [-top_width / 2 : size : top_width / 2]) {
+        translate([count, move_y]) {
+            circle(r = lucky_bamboo_pot_bamboo_diameter / 2);
+        }
+    }
+
+    for (count = [-bottom_width / 2 : size : bottom_width / 2]) {
+        translate([count, -move_y]) {
+            circle(r = lucky_bamboo_pot_bamboo_diameter / 2);
+        }
+    }
+}
+
+module lucky_bamboo_pot_top_shape() {
+    move_x = lucky_bamboo_pot_top_width / 2 - lucky_bamboo_pot_top_depth / 2;
+    move_y = lucky_bamboo_pot_top_depth / 4;
+
+    difference() {
+        lucky_bamboo_pot_top_base_shape();
+        
+        translate([move_x, move_y]) {
+            lucky_bamboo_pot_top_mounting_hole_shape();
+        }
+
+        translate([-move_x, move_y]) {
+            lucky_bamboo_pot_top_mounting_hole_shape();
+        }
+
+        translate([move_x, -move_y]) {
+            lucky_bamboo_pot_top_mounting_hole_shape();
+        }
+
+        translate([-move_x, -move_y]) {
+            lucky_bamboo_pot_top_mounting_hole_shape();
+        }
+
+        lucky_bamboo_pot_bamboo_holes_shape();
+    }
+}
+
+module lucky_bamboo_pot_top_object() {
+    color(lucky_bamboo_pot_top_color) {
+        linear_extrude(height = lucky_bamboo_pot_top_thickness) {
+            lucky_bamboo_pot_top_shape();
+        }
+    }
+}
+
+module lucky_bamboo_pot_handle_base_shape() {
+    height = lucky_bamboo_pot_height;
+    depth = lucky_bamboo_pot_top_depth + lucky_bamboo_pot_wall_margin;
+    move_x = depth / 2;
+    move_y = height / 2;
+    rounding = lucky_bamboo_pot_handle_rounding;
+
+    hull() {
+        translate([move_x - rounding, move_y - rounding]) {
+            circle(r = rounding);
+        }
+
+        translate([rounding - move_x, move_y - rounding]) {
+            square(rounding * 2, center = true);
+        }
+
+        translate([rounding - move_x, rounding]) {
+            square(rounding * 2, center = true);
+        }
+    }   
+
+    hull() {
+        translate([move_x - rounding, rounding - move_y]) {
+            circle(r = rounding);
+        }
+
+        translate([rounding - move_x, rounding - move_y]) {
+            square(rounding * 2, center = true);
+        }
+
+        translate([rounding - move_x, -rounding]) {
+            square(rounding * 2, center = true);
+        }
+    }
+}
+
+module lucky_bamboo_pot_object() {
+    //lucky_bamboo_pot_top_object();
+    lucky_bamboo_pot_handle_base_shape();
+}

+ 9 - 0
config/lucky_bamboo_pot.scad

@@ -0,0 +1,9 @@
+lucky_bamboo_pot_top_depth = 50;
+lucky_bamboo_pot_top_width = 300;
+lucky_bamboo_pot_mounting_hole_diameter = 3;
+lucky_bamboo_pot_top_thickness = 3;
+lucky_bamboo_pot_bamboo_diameter = 12;
+lucky_bamboo_pot_top_color = "yellow";
+lucky_bamboo_pot_height = 100;
+lucky_bamboo_pot_wall_margin = 20;
+lucky_bamboo_pot_handle_rounding = 5;

+ 4 - 0
renders/lucky_bamboo_pot.scad

@@ -0,0 +1,4 @@
+include <../assets/lucky_bamboo_pot.scad>
+
+$fn = 100;
+lucky_bamboo_pot_object();