summaryrefslogtreecommitdiff
path: root/another.scad
authorMichael Krelin <hacker@klever.net>2018-08-31 22:20:06 (UTC)
committer Michael Krelin <hacker@klever.net>2018-08-31 22:20:06 (UTC)
commit875ceca4d231a22423c42d44d8d14e02d3b4ef37 (patch) (unidiff)
treedc2240e3696adcbc41512a7659bf6066a3bd2246 /another.scad
parent428ea05af148a788e379a9b84a31c6322271cf37 (diff)
downloadextrudery-875ceca4d231a22423c42d44d8d14e02d3b4ef37.zip
extrudery-875ceca4d231a22423c42d44d8d14e02d3b4ef37.tar.gz
extrudery-875ceca4d231a22423c42d44d8d14e02d3b4ef37.tar.bz2
body label and thickness as parameters
Diffstat (limited to 'another.scad') (more/less context) (show whitespace changes)
-rw-r--r--another.scad7
1 files changed, 4 insertions, 3 deletions
diff --git a/another.scad b/another.scad
index fcd179e..f01e765 100644
--- a/another.scad
+++ b/another.scad
@@ -21,102 +21,103 @@ module the_extruder(
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 = 9.5, idler_h = 4, idler_id = 3,// idler dimensions: outer and inner diameters and height 23 idler_d = 9.5, 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_bore_l = 4, 32 knob_bore_l = 4,
33 knob_indent_d = 4, 33 knob_indent_d = 4,
34 knob_indents = 12, 34 knob_indents = 12,
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=.6, 60 knob_bore_d_tolerance=.6,
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 = 2*layer_height,
70
69 what="lever", // lever|body|knob|springpad|* 71 what="lever", // lever|body|knob|springpad|*
70 left=false, 72 left=false,
71 vitamins = true, 73 vitamins = true,
72 bridges = true, 74 bridges = true,
73 debug = false, 75 debug = false,
74 label = "another"
75) { 76) {
76 fnd = 2*PI; fnr = 2*fnd; 77 fnd = 2*PI; fnr = 2*fnd;
77 function lu(m,k) = m[search([k],m)[0]][1]; 78 function lu(m,k) = m[search([k],m)[0]][1];
78 79
79 pulley_d = lu(pulley,"d"); 80 pulley_d = lu(pulley,"d");
80 pulley_h = lu(pulley,"h"); 81 pulley_h = lu(pulley,"h");
81 teeth_elevation = lu(pulley,"fe"); 82 teeth_elevation = lu(pulley,"fe");
82 filament_offset = lu(pulley,"g")+filament_d/2; 83 filament_offset = lu(pulley,"g")+filament_d/2;
83 pulley_d_clearance = lu(pulley,"ssrc")*2; 84 pulley_d_clearance = lu(pulley,"ssrc")*2;
84 85
85 idler_filament_offset = filament_path_d/2; 86 idler_filament_offset = filament_path_d/2;
86 lever_shell = mount_screwhead_h+0.5; 87 lever_shell = mount_screwhead_h+0.5;
87 lever_thickness=max(spring_d+spring_d_clearance+layer_height*8,idler_h+idler_v_tolerance+2*lever_shell); 88 lever_thickness=max(spring_d+spring_d_clearance+layer_height*8,idler_h+idler_v_tolerance+2*lever_shell);
88 lsd = idler_d-idler_clearance*2; // the diameter of lever thingie 89 lsd = idler_d-idler_clearance*2; // the diameter of lever thingie
89 longwing=(mount_d+mount_screw_d+mount_screw_d_tolerance+spring_d+spring_d_clearance)/2+min_xy_shell; 90 longwing=(mount_d+mount_screw_d+mount_screw_d_tolerance+spring_d+spring_d_clearance)/2+min_xy_shell;
90 shortwing = let(a=mount_d/2,c=(pulley_d+idler_d)/2/sqrt(2)) 91 shortwing = let(a=mount_d/2,c=(pulley_d+idler_d)/2/sqrt(2))
91 sqrt(c*c+pow(a-c,2)); 92 sqrt(c*c+pow(a-c,2));
92 longwing_travel = idler_travel*longwing/shortwing; 93 longwing_travel = idler_travel*longwing/shortwing;
93 h_ = (pulley_d+idler_d)/(2*sqrt(2)); 94 h_ = (pulley_d+idler_d)/(2*sqrt(2));
94 ri = sqrt( pow(h_,2) + pow(mount_d/2-h_,2) ); 95 ri = sqrt( pow(h_,2) + pow(mount_d/2-h_,2) );
95 spring_dl = idler_travel*longwing/ri; 96 spring_dl = idler_travel*longwing/ri;
96 // finger and spring support 97 // finger and spring support
97 fsw = gearbox_d-(gearbox_d-mount_d)/2-max(spring_lc,longwing_travel+(gearbox_d-mount_d)/2); 98 fsw = gearbox_d-(gearbox_d-mount_d)/2-max(spring_lc,longwing_travel+(gearbox_d-mount_d)/2);
98 99
99 mount_min_depth = mounthole_min_depth ? mounthole_min_depth : mounthole_depth-1; 100 mount_min_depth = mounthole_min_depth ? mounthole_min_depth : mounthole_depth-1;
100 mount_max_depth = mounthole_max_depth ? mounthole_max_depth : mounthole_depth+1; 101 mount_max_depth = mounthole_max_depth ? mounthole_max_depth : mounthole_depth+1;
101 filament_elevation=protrusion_h+pulley_elevation+teeth_elevation; 102 filament_elevation=protrusion_h+pulley_elevation+teeth_elevation;
102 ls_z = filament_elevation; // leverspace mid-z 103 ls_z = filament_elevation; // leverspace mid-z
103 ls_h = lever_thickness+lever_v_clearance; // leverspace height 104 ls_h = lever_thickness+lever_v_clearance; // leverspace height
104 mount_depth = mount_screw_l - (ls_z+ls_h/2+min_z_shell); 105 mount_depth = mount_screw_l - (ls_z+ls_h/2+min_z_shell);
105 body_h = max(protrusion_h+bore_l,mount_screw_l-mount_depth+mount_screwhead_h+min_z_shell,ls_z*2); 106 body_h = max(protrusion_h+bore_l,mount_screw_l-mount_depth+mount_screwhead_h+min_z_shell,ls_z*2);
106 echo("mount depth",mount_depth); 107 echo("mount depth",mount_depth);
107 108
108 module teardrop(r,d,h,center=false,angle=45) { 109 module teardrop(r,d,h,center=false,angle=45) {
109 dd = d ? d : (2*r); 110 dd = d ? d : (2*r);
110 $fn = dd*fnd; 111 $fn = dd*fnd;
111 cylinder(d=dd,h=h,center=center); 112 cylinder(d=dd,h=h,center=center);
112 if(angle>0) translate([0,0,center?-h/2:0]) 113 if(angle>0) translate([0,0,center?-h/2:0])
113 rotate([0,0,angle]) 114 rotate([0,0,angle])
114 cube(size=[d/2,d/2,h]); 115 cube(size=[d/2,d/2,h]);
115 } 116 }
116 117
117 module mirrorleft() { 118 module mirrorleft() {
118 mirror([left?0:1,0,0]) children(); 119 mirror([left?0:1,0,0]) children();
119 } 120 }
120 module place_idler() { 121 module place_idler() {
121 rotate([0,0,45]) 122 rotate([0,0,45])
122 translate([(pulley_d+idler_d)/2,0,0]) 123 translate([(pulley_d+idler_d)/2,0,0])
@@ -315,106 +316,106 @@ module the_extruder(
315 square([gearbox_d/2+1,ls_h]); 316 square([gearbox_d/2+1,ls_h]);
316 } 317 }
317 318
318 // back side cutout 319 // back side cutout
319 // XXX: this is somewhat ugly and potentially bugged, 320 // XXX: this is somewhat ugly and potentially bugged,
320 // but I want to sleep. 321 // but I want to sleep.
321 a0_ = atan( 322 a0_ = atan(
322 (mount_d/sqrt(2)/2+mount_screw_d+pf_h(pf)+gearbox_d/2) 323 (mount_d/sqrt(2)/2+mount_screw_d+pf_h(pf)+gearbox_d/2)
323 / 324 /
324 ( 325 (
325 pulley_d/2+filament_offset- 326 pulley_d/2+filament_offset-
326 (pf_d(pf)+2*pf_shell)/2/cos(30) 327 (pf_d(pf)+2*pf_shell)/2/cos(30)
327 ) 328 )
328 ); 329 );
329 a0 = -135 + ( (a0_>0) ? a0_ : 180+a0_ ); 330 a0 = -135 + ( (a0_>0) ? a0_ : 180+a0_ );
330 a1 = atan((longwing-lever_thickness/2)/(gearbox_d/2)); 331 a1 = atan((longwing-lever_thickness/2)/(gearbox_d/2));
331 translate([0,0,ls_z]) difference() { 332 translate([0,0,ls_z]) difference() {
332 rotate([0,0,-180+a0]) 333 rotate([0,0,-180+a0])
333 rotate_extrude(angle=a1-a0) 334 rotate_extrude(angle=a1-a0)
334 translate([0,-ls_h/2]) 335 translate([0,-ls_h/2])
335 square([sqrt(pow(gearbox_d/2,2)+pow(longwing-lever_thickness/2,2))+1, 336 square([sqrt(pow(gearbox_d/2,2)+pow(longwing-lever_thickness/2,2))+1,
336 ls_h]); 337 ls_h]);
337 translate([-mount_d/2,0,0]) 338 translate([-mount_d/2,0,0])
338 cylinder(d=gearbox_d-mount_d,h=ls_h+2,center=true,$fn=fnd*(gearbox_d-mount_d)); 339 cylinder(d=gearbox_d-mount_d,h=ls_h+2,center=true,$fn=fnd*(gearbox_d-mount_d));
339 }//difference translate 340 }//difference translate
340 341
341 // spring tensioner 342 // spring tensioner
342 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0]) { 343 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0]) {
343 mirror([0,0,1]) { 344 mirror([0,0,1]) {
344 translate([0,0,st_thickshell]) 345 translate([0,0,st_thickshell])
345 hull() for(o=[0,spring_d]) translate([0,-o,0]) 346 hull() for(o=[0,spring_d]) translate([0,-o,0])
346 rotate([0,0,30]) 347 rotate([0,0,30])
347 cylinder(d=st_nut_d+st_nut_d_tolerance,h=st_nut_h+st_nut_h_tolerance,$fn=6); 348 cylinder(d=st_nut_d+st_nut_d_tolerance,h=st_nut_h+st_nut_h_tolerance,$fn=6);
348 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)); 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));
349 bigd = spring_d+spring_d_clearance; 350 bigd = spring_d+spring_d_clearance;
350 hf = (bigd-st_screw_d-st_screw_d_tolerance)/2; 351 hf = (bigd-st_screw_d-st_screw_d_tolerance)/2;
351 translate([0,0,st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell-epsilon]) { 352 translate([0,0,st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell-epsilon]) {
352 cylinder(d1=st_screw_d+st_screw_d_tolerance,d2=bigd, 353 cylinder(d1=st_screw_d+st_screw_d_tolerance,d2=bigd,
353 h=hf+epsilon, $fn=fnd*bigd); 354 h=hf+epsilon, $fn=fnd*bigd);
354 translate([0,-(st_split_w+st_split_w_tolerance)/2,0]) 355 translate([0,-(st_split_w+st_split_w_tolerance)/2,0])
355 cube(size=[body_h-ls_z+1,st_split_w+st_split_w_tolerance,fsw+1]); 356 cube(size=[body_h-ls_z+1,st_split_w+st_split_w_tolerance,fsw+1]);
356 }//translate 357 }//translate
357 translate([0,0,st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell+hf-epsilon]) 358 translate([0,0,st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell+hf-epsilon])
358 cylinder(d=bigd,h=fsw+1,$fn=fnd*bigd); 359 cylinder(d=bigd,h=fsw+1,$fn=fnd*bigd);
359 }//mirror 360 }//mirror
360 }//translate 361 }//translate
361 362
362 // label 363 // label
364 if(body_label) let(label=body_label,label_thickness=body_label_thickness) {
363 label_thickness = 2*layer_height; 365 label_thickness = 2*layer_height;
364 label_len = len(label); 366 label_len = len(label);
365 if(label_len) {
366 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]; 367 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];
367 translate([0,0,body_h-label_thickness]) 368 translate([0,0,body_h-label_thickness])
368 linear_extrude(height=label_thickness+epsilon,convexity=64) 369 linear_extrude(height=label_thickness+epsilon,convexity=64)
369 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]) 370 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])
370 mirror([left?0:1,0]) 371 mirror([left?0:1,0])
371 text(text=label,size=labelspace.x/label_len,halign="center",valign="center",font="Arial Black"); 372 text(text=label,size=labelspace.x/label_len,halign="center",valign="center",font="Arial Black");
372 }//if(label_len) 373 }//if(body_label)
373 374
374 }//difference 375 }//difference
375 376
376 }//body module 377 }//body module
377 378
378 module springpad() { 379 module springpad() {
379 smalld=st_screw_d+st_screw_d_tolerance+min_xy_shell; 380 smalld=st_screw_d+st_screw_d_tolerance+min_xy_shell;
380 bigd = spring_d+spring_d_clearance/2; 381 bigd = spring_d+spring_d_clearance/2;
381 hf = (bigd-smalld)/2; 382 hf = (bigd-smalld)/2;
382 h = hf*3.5; 383 h = hf*3.5;
383 translate([-gearbox_d/2+st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell+1,-longwing,filament_elevation]) 384 translate([-gearbox_d/2+st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell+1,-longwing,filament_elevation])
384 rotate([0,90,0]) difference() { 385 rotate([0,90,0]) difference() {
385 union() { 386 union() {
386 cylinder(d1=smalld,d2=bigd,h=hf,$fn=fnd*bigd); 387 cylinder(d1=smalld,d2=bigd,h=hf,$fn=fnd*bigd);
387 translate([0,0,hf-epsilon]) 388 translate([0,0,hf-epsilon])
388 cylinder(d=bigd,h=h-hf,$fn=fnd*bigd); 389 cylinder(d=bigd,h=h-hf,$fn=fnd*bigd);
389 translate([0,0,h]) 390 translate([0,0,h])
390 sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4); 391 sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4);
391 l = body_h-ls_z; 392 l = body_h-ls_z;
392 w = st_split_w; 393 w = st_split_w;
393 hull() translate([0,-st_split_w/2,0]) mirror([1,0,0]) { 394 hull() translate([0,-st_split_w/2,0]) mirror([1,0,0]) {
394 translate([0,0,w]) 395 translate([0,0,w])
395 cube(size=[l,st_split_w,w]); 396 cube(size=[l,st_split_w,w]);
396 cube(size=[l-w,st_split_w,2*w]); 397 cube(size=[l-w,st_split_w,2*w]);
397 } 398 }
398 } 399 }
399 translate([0,0,-epsilon]) 400 translate([0,0,-epsilon])
400 cylinder(d=st_screw_d+st_screw_d_tolerance,h=2*hf+epsilon,$fn=fnd*(st_screw_d+st_screw_d_tolerance)); 401 cylinder(d=st_screw_d+st_screw_d_tolerance,h=2*hf+epsilon,$fn=fnd*(st_screw_d+st_screw_d_tolerance));
401 } 402 }
402 } 403 }
403 404
404 module knob() { 405 module knob() {
405 ch = knob_indent_d/2; 406 ch = knob_indent_d/2;
406 translate([0,0,body_h+epsilon]) { 407 translate([0,0,body_h+epsilon]) {
407 mirror([0,0,1]) translate([0,0,-epsilon]) { 408 mirror([0,0,1]) translate([0,0,-epsilon]) {
408 difference() { 409 difference() {
409 cylinder(d=pulley_d,h=knob_bore_l,$fn=fnd*pulley_d); 410 cylinder(d=pulley_d,h=knob_bore_l,$fn=fnd*pulley_d);
410 translate([0,0,-1]) difference() { 411 translate([0,0,-1]) difference() {
411 cylinder(d=bore_d+knob_bore_d_tolerance,h=knob_bore_l+2); 412 cylinder(d=bore_d+knob_bore_d_tolerance,h=knob_bore_l+2);
412 translate([-bore_d/2-1,bore_dd-bore_d/2+knob_bore_d_tolerance/2,-1]) 413 translate([-bore_d/2-1,bore_dd-bore_d/2+knob_bore_d_tolerance/2,-1])
413 cube([bore_d+2,bore_d/2,knob_bore_l+4]); 414 cube([bore_d+2,bore_d/2,knob_bore_l+4]);
414 } 415 }
415 } 416 }
416 } 417 }
417 difference() { 418 difference() {
418 union() { 419 union() {
419 cylinder(d1=gearbox_d-2*ch,d2=gearbox_d,h=ch+epsilon,$fn=fnd*gearbox_d); 420 cylinder(d1=gearbox_d-2*ch,d2=gearbox_d,h=ch+epsilon,$fn=fnd*gearbox_d);
420 translate([0,0,ch]) 421 translate([0,0,ch])