summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--multimixer.scad14
1 files changed, 9 insertions, 5 deletions
diff --git a/multimixer.scad b/multimixer.scad
index 21f71e4..80f41f1 100644
--- a/multimixer.scad
+++ b/multimixer.scad
@@ -4,71 +4,75 @@ epsilon=.01;
4use <pushfittery.scad>; 4use <pushfittery.scad>;
5include <pushfit_data.scad>; 5include <pushfit_data.scad>;
6 6
7module multimixer( 7module multimixer(
8 filament_d = 1.75, 8 filament_d = 1.75,
9 liner_od = 4, liner_id = 2, 9 liner_od = 4, liner_id = 2,
10 angle = 15, // to the vertical (output) axis 10 angle = 15, // to the vertical (output) axis
11 inputs = 4, 11 inputs = 4,
12 minshell = 2*extrusion_width, 12 minshell = 2*extrusion_width,
13 shell = 5*extrusion_width, 13 shell = 5*extrusion_width,
14 pf = pushfit_embeddest, 14 pf = pushfit_embeddest,
15 debug = 0, // how many inputs -1 the debug cutout spans 15 debug = 0, // how many inputs -1 the debug cutout spans
16 print = false,
16) { 17) {
17 fnd = 4*PI; fnr = 2*fnd; 18 fnd = 4*PI; fnr = 2*fnd;
18 19
19 pushfit_d = pf_d(pf); 20 pushfit_d = pf_d(pf);
20 pushfit_h = pf_h(pf); 21 pushfit_h = pf_h(pf);
21 22
22 angular_step = 360/inputs; 23 angular_step = 360/inputs;
23 inputogon_angle = 180*(inputs-2)/inputs; 24 inputogon_angle = 180*(inputs-2)/inputs;
24 25
25 sinsin = sin(angle)*sin(angular_step/2); 26 sinsin = sin(angle)*sin(angular_step/2);
26 function l_to(d) = d*cos(asin(sinsin))/sinsin; 27 function l_to(d) = d*cos(asin(sinsin))/sinsin;
27 l_output = liner_od; 28 l_output = liner_od;
28 l_input = l_to(pushfit_d/2+minshell); 29 l_input = l_to(pushfit_d/2+minshell);
29 l_fork = l_to(liner_id/2); 30 l_fork = l_to(liner_id/2);
30 l_narrow = l_to(liner_od/2+minshell); 31 l_narrow = l_to(liner_od/2+minshell);
31 32
32 module forinputs() { 33 module forinputs() {
33 for(zr=[0:angular_step:359]) rotate([0,0,zr]) rotate([0,angle,0]) children(); 34 for(zr=[0:angular_step:359]) rotate([0,0,zr]) rotate([0,angle,0]) children();
34 }//forinputs module 35 }//forinputs module
35 module foroutput() { 36 module foroutput() {
36 rotate([180,0,0]) children(); 37 rotate([180,0,0]) children();
37 } 38 }
38 39
39 //translate([pf_d(pf)/2+shell,0,0]) 40 module laydown() {
40 //translate([0,0,l_output+pushfit_h]) 41 r = pushfit_d/2+shell;
41 module laydown(dia) {
42 r = dia/2;
43 h_bottom = l_output+pushfit_h; 42 h_bottom = l_output+pushfit_h;
44 /* The top point on the cylinder that will touch the bed */ 43 /* The top point on the cylinder that will touch the bed */
45 x0 = r*cos(angular_step/2); 44 x0 = r*cos(angular_step/2);
46 y0 = r*sin(angular_step/2); 45 y0 = r*sin(angular_step/2);
47 z0 = l_input+pushfit_h; 46 z0 = l_input+pushfit_h;
48 /* The same point after rotation by "angle" around Y axis */ 47 /* The same point after rotation by "angle" around Y axis */
49 x1 = z0*sin(angle)+x0*cos(angle); 48 x1 = z0*sin(angle)+x0*cos(angle);
50 y1 = y0; 49 y1 = y0;
51 z1 = z0*cos(angle)-x0*sin(angle); 50 z1 = z0*cos(angle)-x0*sin(angle);
52 ax1 = atan(y1/x1); 51 ax1 = atan(y1/x1);
53 /* And its x-coordinate after final "angular_step/2" Z-rotation */ 52 /* And its x-coordinate after final "angular_step/2" Z-rotation */
54 ax2 = ax1-angular_step/2; 53 ax2 = ax1-angular_step/2;
55 x2 = x1*cos(ax2)/cos(ax1); 54 x2 = x1*cos(ax2)/cos(ax1);
56 laydown_angle = atan((x2-r)/(z1+h_bottom)); 55 laydown_angle = atan((x2-r)/(z1+h_bottom));
57 rotate([90-laydown_angle,0,0]) 56 rotate([90-laydown_angle,0,0])
58 translate([0,r,h_bottom]) 57 translate([0,r,h_bottom])
59 rotate([0,0,angular_step/2-90]) 58 rotate([0,0,angular_step/2-90])
60 children(); 59 children();
61 } 60 }
62 laydown(dia=pushfit_d+shell*2) difference() { 61 module finalize() {
62 if(print) laydown() children();
63 else children();
64 }
65
66 finalize() difference() {
63 hull() { 67 hull() {
64 forinputs() 68 forinputs()
65 translate([0,0,l_input+pushfit_h]) mirror([0,0,1]) 69 translate([0,0,l_input+pushfit_h]) mirror([0,0,1])
66 cylinder(d=pushfit_d+shell*2,h=epsilon,$fn=pushfit_d*fnd); 70 cylinder(d=pushfit_d+shell*2,h=epsilon,$fn=pushfit_d*fnd);
67 foroutput() 71 foroutput()
68 translate([0,0,l_output+pushfit_h]) { 72 translate([0,0,l_output+pushfit_h]) {
69 cylinder(d=pushfit_d+shell*2,h=epsilon,$fn=pushfit_d*fnd); 73 cylinder(d=pushfit_d+shell*2,h=epsilon,$fn=pushfit_d*fnd);
70 } 74 }
71 } 75 }
72 forinputs() { 76 forinputs() {
73 translate([0,0,l_input]) pushfit(pf); 77 translate([0,0,l_input]) pushfit(pf);
74 translate([0,0,l_narrow]) { 78 translate([0,0,l_narrow]) {