2018-02-04 14:33:12 -05:00
|
|
|
// figures out the scale factor needed to make a 45 degree wall
|
|
|
|
function scale_for_45(height, starting_size) = (height * 2 + starting_size) / starting_size;
|
|
|
|
|
|
|
|
module supports(type, stem_type, loft, height) {
|
|
|
|
if (type == "flared") {
|
|
|
|
flared(stem_type, loft, height);
|
|
|
|
} else if (type == "flat") {
|
|
|
|
flat(stem_type, loft, height);
|
|
|
|
} else if (type == "bars") {
|
|
|
|
bars(stem_type, loft, height);
|
|
|
|
} else {
|
|
|
|
echo("Warning: unsupported $support_type");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// complicated since we want the different stems to work well
|
|
|
|
// also kind of messy... oh well
|
|
|
|
module flared(stem_type, loft, height) {
|
2017-12-20 00:47:03 -05:00
|
|
|
translate([0,0,loft]){
|
2018-02-04 14:33:12 -05:00
|
|
|
if(stem_type == "cherry") {
|
|
|
|
cherry_scale = [scale_for_45(height, $cherry_stem[0]), scale_for_45(height, $cherry_stem[1])];
|
|
|
|
linear_extrude(height=height, scale = cherry_scale){
|
|
|
|
offset(r=1){
|
|
|
|
square($cherry_stem - [2,2], center=true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (stem_type == "cherry_rounded") {
|
|
|
|
linear_extrude(height=height, scale = scale_for_45(height, $rounded_cherry_stem_d)){
|
|
|
|
circle(d=$rounded_cherry_stem_d);
|
|
|
|
}
|
|
|
|
} else if (stem_type == "alps") {
|
|
|
|
alps_scale = [scale_for_45(height, $alps_stem[0]), scale_for_45(height, $alps_stem[1])];
|
|
|
|
linear_extrude(height=height, scale = alps_scale){
|
|
|
|
square($alps_stem, center=true);
|
|
|
|
}
|
2017-12-20 00:47:03 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-04 14:33:12 -05:00
|
|
|
module flat(stem_type, loft, height) {
|
2017-12-20 00:47:03 -05:00
|
|
|
translate([0,0,loft + 500]){
|
|
|
|
cube(1000, center=true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-04 14:33:12 -05:00
|
|
|
module bars(stem_type, loft, height) {
|
2017-12-20 00:47:03 -05:00
|
|
|
translate([0,0,loft + height / 2]){
|
|
|
|
cube([2, 100, height], center = true);
|
|
|
|
cube([100, 2, height], center = true);
|
|
|
|
}
|
|
|
|
}
|