catears-v2/scad/base/headband.scad

55 lines
No EOL
1.9 KiB
OpenSCAD

use <bezier_extrusion.scad>;
use <binary.scad>
module headband(thickness, height, vers = false, vers_number = 0){
rake_length = 3;
shape_band = [[thickness/2,height/2-0.4],
[thickness/2,-height/2+0.4],
[thickness/2-0.4,-height/2],
[-thickness/2+0.4,-height/2],
[-thickness/2,-height/2+0.4],
[-thickness/2,height/2-0.4],
[-thickness/2+0.4,height/2],
[thickness/2-0.4,height/2]];
shape_rake = [[0,-height/2],
[0,height/2],
[rake_length,height/2-2],
[rake_length,-height/2+2]];
shape_halfband = [[thickness/2,height/2-0.4],
[thickness/2,-height/2+0.4],
[thickness/2-0.4,-height/2],
[0,-height/2],
[0,height/2],
[thickness/2-0.4,height/2]];
ctrl_band = [[21,0],[77,56],[56,126],[0,126]];
ctrl_end = [[21,0],[20,-1],[18,-4],[17,-8]];
ctrl_rake = [[-52,86],[-40,139.5],[40,139.5],[52,86]];
union(){
difference(){
bezier_extrude(ctrl = ctrl_band, shape = shape_band, sections = 64);
if(vers){
translate([23,-1,-1])
rotate([0,0,49])
binary(n = vers_number, size = 2, depth = 1.5, sep = 1);
}
}
mirror([1,0,0]) bezier_extrude(ctrl = ctrl_band, shape = shape_band, sections = 64);
bezier_extrude(ctrl = ctrl_end, shape = shape_band, sections = 16);
translate([17,-8]){
rotate_extrude(convexity = 10, $fn = 16) polygon(shape_halfband);
}
mirror([1,0,0]) bezier_extrude(ctrl = ctrl_end, shape = shape_band, sections = 16);
translate([-17,-8]){
rotate_extrude(convexity = 10, $fn = 16) polygon(shape_halfband);
}
bezier_extrude(ctrl = ctrl_rake, shape = shape_rake, partial = true, merlon = 2, gap = 3, sections = (2+3)*42+1);
}
}
headband(thickness = 2.7, height = 5.5);