From 746ba2b55a681786c8dbc8381a9c535e7f49c0ed Mon Sep 17 00:00:00 2001 From: jaseg Date: Sat, 11 Apr 2020 15:28:53 +0200 Subject: initial commit --- fader_knob.scad | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 fader_knob.scad (limited to 'fader_knob.scad') diff --git a/fader_knob.scad b/fader_knob.scad new file mode 100644 index 0000000..7456fc3 --- /dev/null +++ b/fader_knob.scad @@ -0,0 +1,102 @@ + +/* base */ +base_w = 10; +roundness = 0.5; /* should match offset constraint in sovlespace */ +wall_thickness = 1.0; + +side_dxf = "knob_side.dxf"; + +/* stem */ +stem_wall_thickness = 1.5; +stem_w = 2.4; +stem_h = 6.8; +cut_corners_w = 1.6; +cut_corners_h = 2.0; + +/* don't touch */ +lots = 1000; +eps = 0.01; + +module offset_shell(offx) { + intersection() { + translate([-lots/2, 0, 0]) + square([lots, lots]); + + offset(r=-offx) + union() { + children(); + mirror([0, 1, 0]) children(); + } + } +} + +module dxf_shell(file, w, d, r) { + intersection() { + translate([0, 0, lots/2]) + cube([lots, lots, lots], center=true); + + difference() { + minkowski(){ + sphere(r=r, $fn=32); + + rotate([90, 0, 0]) + linear_extrude(height=w - 2*r, center=true) + offset_shell(r) + import(file, $fn=128); + } + + translate([0, 0, -eps]) + rotate([90, 0, 0]) + linear_extrude(height=w-2*d, center=true) + offset_shell(d) + import(file, $fn=128); + } + } +} + +module stem() { + difference() { + cube([stem_h + 2*stem_wall_thickness, stem_w + 2*stem_wall_thickness, lots], center=true); + cube([stem_h, stem_w, lots], center=true); + + translate([0, 0, -lots/2]) + cube([lots, lots, lots], center=true); + + translate([-(stem_h+stem_wall_thickness)/2-eps, -(stem_w+stem_wall_thickness)/2-eps, 0]) + cube([cut_corners_h, cut_corners_w, lots], center=true); + translate([(stem_h+stem_wall_thickness)/2+eps, -(stem_w+stem_wall_thickness)/2-eps, 0]) + cube([cut_corners_h, cut_corners_w, lots], center=true); + translate([-(stem_h+stem_wall_thickness)/2-eps, (stem_w+stem_wall_thickness)/2+eps, 0]) + cube([cut_corners_h, cut_corners_w, lots], center=true); + translate([(stem_h+stem_wall_thickness)/2+eps, (stem_w+stem_wall_thickness)/2+eps, 0]) + cube([cut_corners_h, cut_corners_w, lots], center=true); + } +} + +ridge_w = 0.8; +ridge_f = 0.3; +ridge_h = 3.7; + +difference() { + union () { + dxf_shell(side_dxf, base_w, wall_thickness, roundness); + + intersection() { + stem(); + + rotate([90, 0, 0]) + linear_extrude(height=base_w, center=true) + import(side_dxf, $fn=128); + } + } + + translate([0, -base_w/2 - ridge_w*ridge_f, -eps]) + cylinder(d=ridge_w, h=lots, $fn=32); + + translate([0, base_w/2 + ridge_w*ridge_f, -eps]) + cylinder(d=ridge_w, h=lots, $fn=32); + + translate([0, 0, ridge_h]) + rotate([90, 0, 0]) + cylinder(d=ridge_w, h=lots, center=true, $fn=32); +} \ No newline at end of file -- cgit