summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--another.scad14
1 files changed, 14 insertions, 0 deletions
diff --git a/another.scad b/another.scad
index 05bfab3..49833ec 100644
--- a/another.scad
+++ b/another.scad
@@ -1,165 +1,166 @@
1draft=true; 1draft=true;
2layer_height=0.2; extrusion_width=0.4; 2layer_height=0.2; extrusion_width=0.4;
3epsilon=0.01; 3epsilon=0.01;
4$fs=0.0125; 4$fs=0.0125;
5 5
6use <pushfittery.scad>; 6use <pushfittery.scad>;
7include <pushfit_data.scad>; 7include <pushfit_data.scad>;
8include <pulley_data.scad>; 8include <pulley_data.scad>;
9 9
10module the_extruder( 10module the_extruder(
11 // motor properties 11 // motor properties
12 gearbox_d = 36, 12 gearbox_d = 36,
13 mount_d = 28, // the distance between opposite mounting holes 13 mount_d = 28, // the distance between opposite mounting holes
14 mounthole_depth = 5, 14 mounthole_depth = 5,
15 mounthole_min_depth = 3, mounthole_max_depth = 4, 15 mounthole_min_depth = 3, mounthole_max_depth = 4,
16 protrusion_d = 22, protrusion_h = 2.2, // the dimensions of the protrusion on top of gearbox 16 protrusion_d = 22, protrusion_h = 2.2, // the dimensions of the protrusion on top of gearbox
17 bore_d = 8, bore_l = 17.6, 17 bore_d = 8, bore_l = 17.6,
18 bore_dd = 7, 18 bore_dd = 7,
19 // pulley properties 19 // pulley properties
20 pulley = pulley_e3d, 20 pulley = pulley_e3d,
21 pulley_elevation = 1, // pulley elevation above the protrusion 21 pulley_elevation = 1, // pulley elevation above the protrusion
22 // idler properties 22 // idler properties
23 idler_d = 10, idler_h = 4, idler_id = 3,// idler dimensions: outer and inner diameters and height 23 idler_d = 10, idler_h = 4, idler_id = 3,// idler dimensions: outer and inner diameters and height
24 // spring properties 24 // spring properties
25 spring_d = 10, spring_lc = 9.6, // spring diameter and compressed length 25 spring_d = 10, spring_lc = 9.6, // spring diameter and compressed length
26 // filament path properties 26 // filament path properties
27 filament_d = 1.75, 27 filament_d = 1.75,
28 filament_path_d = 2, 28 filament_path_d = 2,
29 filament_guide_d = 4, // PTFE filament guide diameter 29 filament_guide_d = 4, // PTFE filament guide diameter
30 // knob properties 30 // knob properties
31 knob_h = 10, 31 knob_h = 10,
32 knob_indent_d = 4, 32 knob_indent_d = 4,
33 knob_indents = 12, 33 knob_indents = 12,
34 knob_v_clearance = 1, 34 knob_v_clearance = 1,
35 // spring tensioner 35 // spring tensioner
36 st_nut_d = 9, st_nut_h = 4, 36 st_nut_d = 9, st_nut_h = 4,
37 st_screw_d = 5, 37 st_screw_d = 5,
38 st_thickshell = 8*extrusion_width, st_thinshell = 2*extrusion_width, 38 st_thickshell = 8*extrusion_width, st_thinshell = 2*extrusion_width,
39 st_split_w = 4*extrusion_width, 39 st_split_w = 4*extrusion_width,
40 40
41 // screw it 41 // screw it
42 mount_screw_d = 3.1, mount_screw_l = 20, 42 mount_screw_d = 3.1, mount_screw_l = 20,
43 mount_screwhead_d=6, mount_screwhead_h=3, 43 mount_screwhead_d=6, mount_screwhead_h=3,
44 idler_screw_d = 3, 44 idler_screw_d = 3,
45 idler_screwhead_d=6, idler_screwhead_h=3, 45 idler_screwhead_d=6, idler_screwhead_h=3,
46 46
47 pf = pushfit_metal, 47 pf = pushfit_metal,
48 pf_shell = max(3*layer_height,3*extrusion_width), 48 pf_shell = max(3*layer_height,3*extrusion_width),
49 49
50 // empty spaces 50 // empty spaces
51 idler_travel = 3, // how far should idler travel when pressed 51 idler_travel = 3, // how far should idler travel when pressed
52 idler_clearance=.5, 52 idler_clearance=.5,
53 pulley_small_d_clearance=.5, 53 pulley_small_d_clearance=.5,
54 lever_v_clearance=.7, // vertical clearance for the lever 54 lever_v_clearance=.7, // vertical clearance for the lever
55 spring_d_clearance=1, 55 spring_d_clearance=1,
56 protrusion_tolerance_h=.5, // horizontal tolerance for the motor protrusion 56 protrusion_tolerance_h=.5, // horizontal tolerance for the motor protrusion
57 protrusion_tolerance_v=.5, // vertical tolerance for the motor protrusion 57 protrusion_tolerance_v=.5, // vertical tolerance for the motor protrusion
58 mount_screw_d_tolerance=.4, 58 mount_screw_d_tolerance=.4,
59 idler_v_tolerance=.5, 59 idler_v_tolerance=.5,
60 knob_bore_d_tolerance=.8, 60 knob_bore_d_tolerance=.8,
61 st_nut_h_tolerance=.2, 61 st_nut_h_tolerance=.2,
62 st_nut_d_tolerance=.2,/* TODO: make it st_nut_w_tolerance */ 62 st_nut_d_tolerance=.2,/* TODO: make it st_nut_w_tolerance */
63 st_screw_d_tolerance=.5, 63 st_screw_d_tolerance=.5,
64 st_split_w_tolerance = .3, 64 st_split_w_tolerance = .3,
65 65
66 min_z_shell = 4*layer_height, // the very minimal shell thickness along z-axis. 66 min_z_shell = 4*layer_height, // the very minimal shell thickness along z-axis.
67 min_xy_shell = 2*extrusion_width, 67 min_xy_shell = 2*extrusion_width,
68 68
69 body_label = "another", body_label_thickness = layer_height, 69 body_label = "another", body_label_thickness = layer_height,
70 knob_label = "another", knob_label_thickness = 2*layer_height, knob_label_size=undef,
70 71
71 what="lever", // lever|body|knob|springpad|* 72 what="lever", // lever|body|knob|springpad|*
72 left=false, 73 left=false,
73 vitamins = true, 74 vitamins = true,
74 bridges = true, 75 bridges = true,
75 debug = false, 76 debug = false,
76) { 77) {
77 fnd = 2*PI; fnr = 2*fnd; 78 fnd = 2*PI; fnr = 2*fnd;
78 function lu(m,k) = m[search([k],m)[0]][1]; 79 function lu(m,k) = m[search([k],m)[0]][1];
79 80
80 pulley_d = lu(pulley,"d"); 81 pulley_d = lu(pulley,"d");
81 pulley_h = lu(pulley,"h"); 82 pulley_h = lu(pulley,"h");
82 teeth_elevation = lu(pulley,"fe"); 83 teeth_elevation = lu(pulley,"fe");
83 filament_offset = lu(pulley,"g")+filament_d/2; 84 filament_offset = lu(pulley,"g")+filament_d/2;
84 pulley_d_clearance = lu(pulley,"ssrc")*2; 85 pulley_d_clearance = lu(pulley,"ssrc")*2;
85 86
86 idler_filament_offset = filament_path_d/2; 87 idler_filament_offset = filament_path_d/2;
87 lever_shell = mount_screwhead_h+0.5; 88 lever_shell = mount_screwhead_h+0.5;
88 lever_thickness=max(spring_d+spring_d_clearance+layer_height*8,idler_h+idler_v_tolerance+2*lever_shell); 89 lever_thickness=max(spring_d+spring_d_clearance+layer_height*8,idler_h+idler_v_tolerance+2*lever_shell);
89 lsd = idler_d-idler_clearance*2; // the diameter of lever thingie 90 lsd = idler_d-idler_clearance*2; // the diameter of lever thingie
90 longwing=(mount_d+mount_screw_d+mount_screw_d_tolerance+spring_d+spring_d_clearance)/2+min_xy_shell; 91 longwing=(mount_d+mount_screw_d+mount_screw_d_tolerance+spring_d+spring_d_clearance)/2+min_xy_shell;
91 shortwing = let(a=mount_d/2,c=(pulley_d+idler_d)/2/sqrt(2)) 92 shortwing = let(a=mount_d/2,c=(pulley_d+idler_d)/2/sqrt(2))
92 sqrt(c*c+pow(a-c,2)); 93 sqrt(c*c+pow(a-c,2));
93 longwing_travel = idler_travel*longwing/shortwing; 94 longwing_travel = idler_travel*longwing/shortwing;
94 h_ = (pulley_d+idler_d)/(2*sqrt(2)); 95 h_ = (pulley_d+idler_d)/(2*sqrt(2));
95 ri = sqrt( pow(h_,2) + pow(mount_d/2-h_,2) ); 96 ri = sqrt( pow(h_,2) + pow(mount_d/2-h_,2) );
96 spring_dl = idler_travel*longwing/ri; 97 spring_dl = idler_travel*longwing/ri;
97 // finger and spring support 98 // finger and spring support
98 fsw = gearbox_d-(gearbox_d-mount_d)/2-max(spring_lc,longwing_travel+(gearbox_d-mount_d)/2); 99 fsw = gearbox_d-(gearbox_d-mount_d)/2-max(spring_lc,longwing_travel+(gearbox_d-mount_d)/2);
99 100
100 mount_min_depth = mounthole_min_depth ? mounthole_min_depth : mounthole_depth-1; 101 mount_min_depth = mounthole_min_depth ? mounthole_min_depth : mounthole_depth-1;
101 mount_max_depth = mounthole_max_depth ? mounthole_max_depth : mounthole_depth+1; 102 mount_max_depth = mounthole_max_depth ? mounthole_max_depth : mounthole_depth+1;
102 filament_elevation=protrusion_h+pulley_elevation+teeth_elevation; 103 filament_elevation=protrusion_h+pulley_elevation+teeth_elevation;
103 ls_z = filament_elevation; // leverspace mid-z 104 ls_z = filament_elevation; // leverspace mid-z
104 ls_h = lever_thickness+lever_v_clearance; // leverspace height 105 ls_h = lever_thickness+lever_v_clearance; // leverspace height
105 mount_depth = mount_screw_l - (ls_z+ls_h/2+min_z_shell); 106 mount_depth = mount_screw_l - (ls_z+ls_h/2+min_z_shell);
106 body_h = max(protrusion_h+bore_l,mount_screw_l-mount_depth+mount_screwhead_h+min_z_shell,ls_z*2); 107 body_h = max(protrusion_h+bore_l,mount_screw_l-mount_depth+mount_screwhead_h+min_z_shell,ls_z*2);
107 echo("mount depth",mount_depth); 108 echo("mount depth",mount_depth);
108 109
109 module teardrop(r,d,h,center=false,angle=45) { 110 module teardrop(r,d,h,center=false,angle=45) {
110 dd = d ? d : (2*r); 111 dd = d ? d : (2*r);
111 $fn = dd*fnd; 112 $fn = dd*fnd;
112 cylinder(d=dd,h=h,center=center); 113 cylinder(d=dd,h=h,center=center);
113 if(angle>0) translate([0,0,center?-h/2:0]) 114 if(angle>0) translate([0,0,center?-h/2:0])
114 rotate([0,0,angle]) 115 rotate([0,0,angle])
115 cube(size=[d/2,d/2,h]); 116 cube(size=[d/2,d/2,h]);
116 } 117 }
117 118
118 module mirrorleft() { 119 module mirrorleft() {
119 mirror([left?0:1,0,0]) children(); 120 mirror([left?0:1,0,0]) children();
120 } 121 }
121 module place_idler() { 122 module place_idler() {
122 rotate([0,0,45]) 123 rotate([0,0,45])
123 translate([(pulley_d+idler_d)/2,0,0]) 124 translate([(pulley_d+idler_d)/2,0,0])
124 children(); 125 children();
125 } 126 }
126 module finger_indent(d=lever_thickness,depth/*=1*/,r/*=15*/) { 127 module finger_indent(d=lever_thickness,depth/*=1*/,r/*=15*/) {
127 if(depth) { 128 if(depth) {
128 hh = (-4*pow(depth,2)+pow(d,2))/(8*depth); 129 hh = (-4*pow(depth,2)+pow(d,2))/(8*depth);
129 rr = depth+hh; 130 rr = depth+hh;
130 translate([0,0,hh]) sphere(r=rr,$fn=fnr*rr); 131 translate([0,0,hh]) sphere(r=rr,$fn=fnr*rr);
131 }else if(r) { 132 }else if(r) {
132 hh=sqrt(pow(r,2)-pow(d,2)/4); 133 hh=sqrt(pow(r,2)-pow(d,2)/4);
133 translate([0,0,hh]) sphere(r=r,$fn=fnr*r); 134 translate([0,0,hh]) sphere(r=r,$fn=fnr*r);
134 } 135 }
135 } 136 }
136 137
137 % if(vitamins) mirrorleft() { 138 % if(vitamins) mirrorleft() {
138 translate([0,0,-epsilon]) mirror([0,0,1]) cylinder(d=gearbox_d,h=1,$fn=60); 139 translate([0,0,-epsilon]) mirror([0,0,1]) cylinder(d=gearbox_d,h=1,$fn=60);
139 for(zr=[0:90:359]) rotate([0,0,zr]) translate([mount_d/2,0,0]) 140 for(zr=[0:90:359]) rotate([0,0,zr]) translate([mount_d/2,0,0])
140 cylinder(d=mount_screw_d,h=20,$fn=30); 141 cylinder(d=mount_screw_d,h=20,$fn=30);
141 translate([0,0,-epsilon]) cylinder(d=protrusion_d,h=protrusion_h,$fn=30); 142 translate([0,0,-epsilon]) cylinder(d=protrusion_d,h=protrusion_h,$fn=30);
142 translate([0,0,protrusion_h]) { 143 translate([0,0,protrusion_h]) {
143 difference() { 144 difference() {
144 cylinder(d=bore_d,h=bore_l,$fn=30); 145 cylinder(d=bore_d,h=bore_l,$fn=30);
145 translate([-bore_d/2-1,bore_dd-bore_d/2,-1]) 146 translate([-bore_d/2-1,bore_dd-bore_d/2,-1])
146 cube([bore_d+2,bore_d/2,bore_l+2]); 147 cube([bore_d+2,bore_d/2,bore_l+2]);
147 } 148 }
148 translate([0,0,pulley_elevation]) { 149 translate([0,0,pulley_elevation]) {
149 cylinder(d=pulley_d,h=pulley_h,$fn=30); 150 cylinder(d=pulley_d,h=pulley_h,$fn=30);
150 translate([0,0,teeth_elevation]) { 151 translate([0,0,teeth_elevation]) {
151 place_idler() { 152 place_idler() {
152 cylinder(d=idler_d,h=idler_h,center=true,$fn=30); 153 cylinder(d=idler_d,h=idler_h,center=true,$fn=30);
153 cylinder(d=idler_screw_d,h=lever_thickness+2,center=true,$fn=30); 154 cylinder(d=idler_screw_d,h=lever_thickness+2,center=true,$fn=30);
154 }//place idler 155 }//place idler
155 // filament path 156 // filament path
156 rotate([0,0,45]) { 157 rotate([0,0,45]) {
157 translate([pulley_d/2-idler_filament_offset,0,0]) rotate([90,0,0]) { 158 translate([pulley_d/2-idler_filament_offset,0,0]) rotate([90,0,0]) {
158 cylinder(d=filament_d,h=gearbox_d,center=false,$fn=15); 159 cylinder(d=filament_d,h=gearbox_d,center=false,$fn=15);
159 }//rotate translate 160 }//rotate translate
160 translate([pulley_d/2+filament_offset,0,0]) rotate([-90,0,0]) { 161 translate([pulley_d/2+filament_offset,0,0]) rotate([-90,0,0]) {
161 cylinder(d=filament_d,h=gearbox_d,center=false,$fn=15); 162 cylinder(d=filament_d,h=gearbox_d,center=false,$fn=15);
162 translate([0,0,mount_d/sqrt(2)/2+mount_screw_d]) 163 translate([0,0,mount_d/sqrt(2)/2+mount_screw_d])
163 pushfit(pf); 164 pushfit(pf);
164 }//rotate translate 165 }//rotate translate
165 }//rotate 166 }//rotate
@@ -336,147 +337,160 @@ module the_extruder(
336 square([sqrt(pow(gearbox_d/2,2)+pow(longwing-lever_thickness/2,2))+1, 337 square([sqrt(pow(gearbox_d/2,2)+pow(longwing-lever_thickness/2,2))+1,
337 ls_h]); 338 ls_h]);
338 translate([-mount_d/2,0,0]) 339 translate([-mount_d/2,0,0])
339 cylinder(d=gearbox_d-mount_d,h=ls_h+2,center=true,$fn=fnd*(gearbox_d-mount_d)); 340 cylinder(d=gearbox_d-mount_d,h=ls_h+2,center=true,$fn=fnd*(gearbox_d-mount_d));
340 }//difference translate 341 }//difference translate
341 342
342 // spring tensioner 343 // spring tensioner
343 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0]) { 344 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0]) {
344 mirror([0,0,1]) { 345 mirror([0,0,1]) {
345 translate([0,0,st_thickshell]) 346 translate([0,0,st_thickshell])
346 hull() for(o=[0,spring_d]) translate([0,-o,0]) 347 hull() for(o=[0,spring_d]) translate([0,-o,0])
347 rotate([0,0,30]) 348 rotate([0,0,30])
348 cylinder(d=st_nut_d+st_nut_d_tolerance,h=st_nut_h+st_nut_h_tolerance,$fn=6); 349 cylinder(d=st_nut_d+st_nut_d_tolerance,h=st_nut_h+st_nut_h_tolerance,$fn=6);
349 translate([0,0,-1]) cylinder(d=st_screw_d+st_screw_d_tolerance,h=fsw+2,$fn=fnd*(st_screw_d+st_screw_d_tolerance)); 350 translate([0,0,-1]) cylinder(d=st_screw_d+st_screw_d_tolerance,h=fsw+2,$fn=fnd*(st_screw_d+st_screw_d_tolerance));
350 bigd = spring_d+spring_d_clearance; 351 bigd = spring_d+spring_d_clearance;
351 hf = (bigd-st_screw_d-st_screw_d_tolerance)/2; 352 hf = (bigd-st_screw_d-st_screw_d_tolerance)/2;
352 translate([0,0,st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell-epsilon]) { 353 translate([0,0,st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell-epsilon]) {
353 cylinder(d1=st_screw_d+st_screw_d_tolerance,d2=bigd, 354 cylinder(d1=st_screw_d+st_screw_d_tolerance,d2=bigd,
354 h=hf+epsilon, $fn=fnd*bigd); 355 h=hf+epsilon, $fn=fnd*bigd);
355 translate([0,-(st_split_w+st_split_w_tolerance)/2,0]) 356 translate([0,-(st_split_w+st_split_w_tolerance)/2,0])
356 cube(size=[body_h-ls_z+1,st_split_w+st_split_w_tolerance,fsw+1]); 357 cube(size=[body_h-ls_z+1,st_split_w+st_split_w_tolerance,fsw+1]);
357 }//translate 358 }//translate
358 translate([0,0,st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell+hf-epsilon]) 359 translate([0,0,st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell+hf-epsilon])
359 cylinder(d=bigd,h=fsw+1,$fn=fnd*bigd); 360 cylinder(d=bigd,h=fsw+1,$fn=fnd*bigd);
360 }//mirror 361 }//mirror
361 }//translate 362 }//translate
362 363
363 // label 364 // label
364 body_label(); 365 body_label();
365 366
366 }//difference 367 }//difference
367 368
368 }//body module 369 }//body module
369 module body_label() { 370 module body_label() {
370 if(body_label) { 371 if(body_label) {
371 label=body_label; 372 label=body_label;
372 label_thickness=body_label_thickness; 373 label_thickness=body_label_thickness;
373 label_len = len(label); 374 label_len = len(label);
374 labelspace = [gearbox_d/2-mount_screwhead_d/2-min_xy_shell,longwing-(mount_screwhead_d-st_split_w-st_split_w_tolerance)/2-2*min_xy_shell]; 375 labelspace = [gearbox_d/2-mount_screwhead_d/2-min_xy_shell,longwing-(mount_screwhead_d-st_split_w-st_split_w_tolerance)/2-2*min_xy_shell];
375 translate([0,0,body_h-label_thickness]) 376 translate([0,0,body_h-label_thickness])
376 linear_extrude(height=label_thickness+epsilon,convexity=64) 377 linear_extrude(height=label_thickness+epsilon,convexity=64)
377 translate([-mount_screwhead_d/2-min_xy_shell-labelspace.x/2,-longwing+(st_split_w+st_split_w_tolerance)/2+min_xy_shell+labelspace.y/2]) 378 translate([-mount_screwhead_d/2-min_xy_shell-labelspace.x/2,-longwing+(st_split_w+st_split_w_tolerance)/2+min_xy_shell+labelspace.y/2])
378 mirror([left?0:1,0]) 379 mirror([left?0:1,0])
379 text(text=label,size=labelspace.x/label_len,halign="center",valign="center",font="Arial Black"); 380 text(text=label,size=labelspace.x/label_len,halign="center",valign="center",font="Arial Black");
380 }//if(body_label) 381 }//if(body_label)
381 } 382 }
382 383
383 module springpad() { 384 module springpad() {
384 smalld=st_screw_d+st_screw_d_tolerance+min_xy_shell; 385 smalld=st_screw_d+st_screw_d_tolerance+min_xy_shell;
385 bigd = spring_d+spring_d_clearance/2; 386 bigd = spring_d+spring_d_clearance/2;
386 hf = (bigd-smalld)/2; 387 hf = (bigd-smalld)/2;
387 h = hf*3.5; 388 h = hf*3.5;
388 translate([-gearbox_d/2+st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell+1,-longwing,filament_elevation]) 389 translate([-gearbox_d/2+st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell+1,-longwing,filament_elevation])
389 rotate([0,90,0]) difference() { 390 rotate([0,90,0]) difference() {
390 union() { 391 union() {
391 cylinder(d1=smalld,d2=bigd,h=hf,$fn=fnd*bigd); 392 cylinder(d1=smalld,d2=bigd,h=hf,$fn=fnd*bigd);
392 translate([0,0,hf-epsilon]) 393 translate([0,0,hf-epsilon])
393 cylinder(d=bigd,h=h-hf,$fn=fnd*bigd); 394 cylinder(d=bigd,h=h-hf,$fn=fnd*bigd);
394 translate([0,0,h]) 395 translate([0,0,h])
395 sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4); 396 sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4);
396 l = body_h-ls_z; 397 l = body_h-ls_z;
397 w = st_split_w; 398 w = st_split_w;
398 hull() translate([0,-st_split_w/2,0]) mirror([1,0,0]) { 399 hull() translate([0,-st_split_w/2,0]) mirror([1,0,0]) {
399 translate([0,0,w]) 400 translate([0,0,w])
400 cube(size=[l,st_split_w,w]); 401 cube(size=[l,st_split_w,w]);
401 cube(size=[l-w,st_split_w,2*w]); 402 cube(size=[l-w,st_split_w,2*w]);
402 } 403 }
403 } 404 }
404 translate([0,0,-epsilon]) 405 translate([0,0,-epsilon])
405 cylinder(d=st_screw_d+st_screw_d_tolerance,h=2*hf+epsilon,$fn=fnd*(st_screw_d+st_screw_d_tolerance)); 406 cylinder(d=st_screw_d+st_screw_d_tolerance,h=2*hf+epsilon,$fn=fnd*(st_screw_d+st_screw_d_tolerance));
406 } 407 }
407 } 408 }
408 409
409 module knob() { 410 module knob() {
410 ch = knob_indent_d/2; 411 ch = knob_indent_d/2;
411 knob_bore_l = body_h-protrusion_h-pulley_elevation-pulley_h-knob_v_clearance; 412 knob_bore_l = body_h-protrusion_h-pulley_elevation-pulley_h-knob_v_clearance;
412 translate([0,0,body_h+epsilon]) { 413 translate([0,0,body_h+epsilon]) {
413 mirror([0,0,1]) translate([0,0,-epsilon]) { 414 mirror([0,0,1]) translate([0,0,-epsilon]) {
414 difference() { 415 difference() {
415 cylinder(d=pulley_d,h=knob_bore_l,$fn=fnd*pulley_d); 416 cylinder(d=pulley_d,h=knob_bore_l,$fn=fnd*pulley_d);
416 translate([0,0,-1]) difference() { 417 translate([0,0,-1]) difference() {
417 cylinder(d=bore_d+knob_bore_d_tolerance,h=knob_bore_l+2); 418 cylinder(d=bore_d+knob_bore_d_tolerance,h=knob_bore_l+2);
418 translate([-bore_d/2-1,bore_dd-bore_d/2+knob_bore_d_tolerance/2,-1]) 419 translate([-bore_d/2-1,bore_dd-bore_d/2+knob_bore_d_tolerance/2,-1])
419 cube([bore_d+2,bore_d/2,knob_bore_l+4]); 420 cube([bore_d+2,bore_d/2,knob_bore_l+4]);
420 } 421 }
421 } 422 }
422 } 423 }
423 difference() { 424 difference() {
424 hull() { 425 hull() {
425 cylinder(d=gearbox_d-2*ch,h=knob_h,$fn=fnd*gearbox_d); 426 cylinder(d=gearbox_d-2*ch,h=knob_h,$fn=fnd*gearbox_d);
426 translate([0,0,ch]) 427 translate([0,0,ch])
427 cylinder(d=gearbox_d,h=knob_h-2*ch,$fn=fnd*gearbox_d); 428 cylinder(d=gearbox_d,h=knob_h-2*ch,$fn=fnd*gearbox_d);
428 } 429 }
429 for(a=[0:360/knob_indents:359]) rotate([0,0,a]) 430 for(a=[0:360/knob_indents:359]) rotate([0,0,a])
430 translate([0,gearbox_d/2,-1]) 431 translate([0,gearbox_d/2,-1])
431 cylinder(d=knob_indent_d,h=knob_h+2,$fn=fnd*knob_indent_d); 432 cylinder(d=knob_indent_d,h=knob_h+2,$fn=fnd*knob_indent_d);
433 translate([0,0,-body_h-epsilon]) knob_label();
432 } 434 }
433 } 435 }
434 }//knob module 436 }//knob module
437 module knob_label() {
438 if(knob_label) {
439 ll = len(knob_label);
440 lsl = gearbox_d-knob_indent_d;
441 ts = knob_label_size?knob_label_size:min(lsl/ll,gearbox_d/4);
442 translate([0,0,body_h+epsilon+knob_h-knob_label_thickness])
443 linear_extrude(height=knob_label_thickness+epsilon,convexity=64)
444 mirror([left?0:1,0])
445 text(text=knob_label,size=ts,halign="center",valign="center",font="Arial Black");
446 }
447 }
435 448
436 module debug() { 449 module debug() {
437 difference() { 450 difference() {
438 children(); 451 children();
439 if(debug) { 452 if(debug) {
440 // spring tensioner debug cutout 453 // spring tensioner debug cutout
441 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0]) 454 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0])
442 translate([0,-lever_thickness/2-1,-gearbox_d]) 455 translate([0,-lever_thickness/2-1,-gearbox_d])
443 cube(size=[body_h/2+1,lever_thickness/2+1,gearbox_d+2]); 456 cube(size=[body_h/2+1,lever_thickness/2+1,gearbox_d+2]);
444 // lever axis debug cutout 457 // lever axis debug cutout
445 translate([mount_d/2,0,-1]) 458 translate([mount_d/2,0,-1])
446 rotate([0,0,-45]) 459 rotate([0,0,-45])
447 cube(size=[gearbox_d-mount_d,gearbox_d-mount_d,body_h+knob_h+2]); 460 cube(size=[gearbox_d-mount_d,gearbox_d-mount_d,body_h+knob_h+2]);
448 // idler debug cutout 461 // idler debug cutout
449 translate([0,0,ls_z]) 462 translate([0,0,ls_z])
450 place_idler() 463 place_idler()
451 rotate([0,0,-45]) 464 rotate([0,0,-45])
452 translate([0,0,-lever_thickness/2-epsilon]) 465 translate([0,0,-lever_thickness/2-epsilon])
453 cube(size=[lsd*sqrt(2)/2+1,lsd*sqrt(2)/2+1, 466 cube(size=[lsd*sqrt(2)/2+1,lsd*sqrt(2)/2+1,
454 lever_thickness+2*epsilon]); 467 lever_thickness+2*epsilon]);
455 // pushfit debug cutout 468 // pushfit debug cutout
456 place_idler() 469 place_idler()
457 translate([-idler_d/2+filament_offset,0,ls_z]) 470 translate([-idler_d/2+filament_offset,0,ls_z])
458 cube(size=[gearbox_d/2,gearbox_d/2+pf_h(pf),body_h-ls_z+knob_h+1]); 471 cube(size=[gearbox_d/2,gearbox_d/2+pf_h(pf),body_h-ls_z+knob_h+1]);
459 }//if debug 472 }//if debug
460 }//difference 473 }//difference
461 } 474 }
462 475
463 mirrorleft() 476 mirrorleft()
464 debug() 477 debug()
465 if(what=="lever") color("green",0.7) lever(); 478 if(what=="lever") color("green",0.7) lever();
466 else if(what=="body") color("yellow",0.7) body(); 479 else if(what=="body") color("yellow",0.7) body();
467 else if(what=="body.label") color("brown",0.7) body_label(); 480 else if(what=="body.label") color("brown",0.7) body_label();
468 else if(what=="knob") color("red",0.7) knob(); 481 else if(what=="knob") color("red",0.7) knob();
469 else if(what=="springpad") color("blue",0.7) springpad(); 482 else if(what=="springpad") color("blue",0.7) springpad();
470 else if(what=="both") { 483 else if(what=="both") {
471 color("green",0.7) lever(); 484 color("green",0.7) lever();
472 color("yellow",0.7) body(); 485 color("yellow",0.7) body();
473 color("brown",0.7) body_label(); 486 color("brown",0.7) body_label();
474 }else{ 487 }else{
475 color("green",0.7) lever(); 488 color("green",0.7) lever();
476 color("yellow",0.7) body(); 489 color("yellow",0.7) body();
477 color("red",0.7) knob(); 490 color("red",0.7) knob();
491 color("brown",0.7) knob_label();
478 color("blue",0.7) springpad(); 492 color("blue",0.7) springpad();
479 } 493 }
480} 494}
481 495
482the_extruder(what="*",left=false,debug=true); 496the_extruder(what="*",left=false,debug=true);