/ src / stems / cherry.scad
cherry.scad
 1  include <../functions.scad>
 2  
 3  // extra length to the vertical tine of the inside cherry cross
 4  // splits the stem into halves - allows easier fitment
 5  extra_vertical = 0.6;
 6  
 7  module inside_cherry_cross(slop) {
 8    // inside cross
 9    // translation purely for aesthetic purposes, to get rid of that awful lattice
10    translate([0,0,-SMALLEST_POSSIBLE]) {
11      linear_extrude(height = $stem_throw) {
12        square(cherry_cross(slop, extra_vertical)[0], center=true);
13        square(cherry_cross(slop, extra_vertical)[1], center=true);
14      }
15    }
16  
17    // Guides to assist insertion and mitigate first layer squishing
18    if ($cherry_bevel){
19      for (i = cherry_cross(slop, extra_vertical)) hull() {
20        linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
21        translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false)  square(i, center=true);
22      }
23    }
24  }
25  
26  module cherry_stem(depth, slop, throw) {
27    difference(){
28      // outside shape
29      linear_extrude(height = depth) {
30        offset(r=1){
31          square(outer_cherry_stem(slop) - [2,2], center=true);
32        }
33      }
34  
35      inside_cherry_cross($stem_inner_slop);
36    }
37  }