author | Michael Krelin <hacker@klever.net> | 2018-07-31 19:53:06 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2018-07-31 19:53:06 (UTC) |
commit | e25427a293ea1f3cbf2e1f90562fb76d8c5632ba (patch) (unidiff) | |
tree | a44a3ac75f9a2ef2b72a30cbc6113a6aa1083cc1 | |
parent | 4a82ab895f87a13be001635118499243f3a6171e (diff) | |
download | extrudery-e25427a293ea1f3cbf2e1f90562fb76d8c5632ba.zip extrudery-e25427a293ea1f3cbf2e1f90562fb76d8c5632ba.tar.gz extrudery-e25427a293ea1f3cbf2e1f90562fb76d8c5632ba.tar.bz2 |
multiswitch: customizer cutoff comment
-rw-r--r-- | multiswitch.scad | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/multiswitch.scad b/multiswitch.scad index 2b909a9..f58b7bd 100644 --- a/multiswitch.scad +++ b/multiswitch.scad | |||
@@ -12,97 +12,99 @@ module multiswitch( | |||
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 | 15 | ||
16 | debug = 0, // how many inputs -1 the debug cutout spans | 16 | debug = 0, // how many inputs -1 the debug cutout spans |
17 | draft = draft, | 17 | draft = draft, |
18 | print = true, | 18 | print = true, |
19 | 19 | ||
20 | liner_d_tolerance=.2 | 20 | liner_d_tolerance=.2 |
21 | ) { | 21 | ) { |
22 | fnd = 4*PI; fnr = 2*fnd; | 22 | fnd = 4*PI; fnr = 2*fnd; |
23 | 23 | ||
24 | pushfit_d = pf_d(pf); | 24 | pushfit_d = pf_d(pf); |
25 | pushfit_h = pf_h(pf); | 25 | pushfit_h = pf_h(pf); |
26 | 26 | ||
27 | angular_step = 360/inputs; | 27 | angular_step = 360/inputs; |
28 | lod = liner_od+liner_d_tolerance; // effective liner diameter | 28 | lod = liner_od+liner_d_tolerance; // effective liner diameter |
29 | 29 | ||
30 | sinsin = sin(angle)*sin(angular_step/2); | 30 | sinsin = sin(angle)*sin(angular_step/2); |
31 | function l_to(d) = d*cos(asin(sinsin))/sinsin; | 31 | function l_to(d) = d*cos(asin(sinsin))/sinsin; |
32 | l_output = lod; | 32 | l_output = lod; |
33 | l_input = l_to((pushfit_d+minshell)/2); | 33 | l_input = l_to((pushfit_d+minshell)/2); |
34 | l_fork = l_to(liner_id/2); | 34 | l_fork = l_to(liner_id/2); |
35 | l_narrow = l_to(lod/2+minshell); | 35 | l_narrow = l_to(lod/2+minshell); |
36 | 36 | ||
37 | module forinputs() { | 37 | module forinputs() { |
38 | for(zr=[0:angular_step:359]) rotate([0,0,zr]) rotate([0,angle,0]) children(); | 38 | for(zr=[0:angular_step:359]) rotate([0,0,zr]) rotate([0,angle,0]) children(); |
39 | }//forinputs module | 39 | }//forinputs module |
40 | module foroutput() { | 40 | module foroutput() { |
41 | rotate([180,0,0]) children(); | 41 | rotate([180,0,0]) children(); |
42 | } | 42 | } |
43 | 43 | ||
44 | module laydown() { | 44 | module laydown() { |
45 | r = pushfit_d/2+shell; | 45 | r = pushfit_d/2+shell; |
46 | h_bottom = l_output+pushfit_h; | 46 | h_bottom = l_output+pushfit_h; |
47 | /* The top point on the cylinder that will touch the bed */ | 47 | /* The top point on the cylinder that will touch the bed */ |
48 | x0 = r*cos(angular_step/2); | 48 | x0 = r*cos(angular_step/2); |
49 | y0 = r*sin(angular_step/2); | 49 | y0 = r*sin(angular_step/2); |
50 | z0 = l_input+pushfit_h; | 50 | z0 = l_input+pushfit_h; |
51 | /* The same point after rotation by "angle" around Y axis */ | 51 | /* The same point after rotation by "angle" around Y axis */ |
52 | x1 = z0*sin(angle)+x0*cos(angle); | 52 | x1 = z0*sin(angle)+x0*cos(angle); |
53 | y1 = y0; | 53 | y1 = y0; |
54 | z1 = z0*cos(angle)-x0*sin(angle); | 54 | z1 = z0*cos(angle)-x0*sin(angle); |
55 | ax1 = atan(y1/x1); | 55 | ax1 = atan(y1/x1); |
56 | /* And its x-coordinate after final "angular_step/2" Z-rotation */ | 56 | /* And its x-coordinate after final "angular_step/2" Z-rotation */ |
57 | ax2 = ax1-angular_step/2; | 57 | ax2 = ax1-angular_step/2; |
58 | x2 = x1*cos(ax2)/cos(ax1); | 58 | x2 = x1*cos(ax2)/cos(ax1); |
59 | laydown_angle = atan((x2-r)/(z1+h_bottom)); | 59 | laydown_angle = atan((x2-r)/(z1+h_bottom)); |
60 | rotate([90-laydown_angle,0,0]) | 60 | rotate([90-laydown_angle,0,0]) |
61 | translate([0,r,h_bottom]) | 61 | translate([0,r,h_bottom]) |
62 | rotate([0,0,angular_step/2-90]) | 62 | rotate([0,0,angular_step/2-90]) |
63 | children(); | 63 | children(); |
64 | } | 64 | } |
65 | module finalize() { | 65 | module finalize() { |
66 | if(print) laydown() children(); | 66 | if(print) laydown() children(); |
67 | else children(); | 67 | else children(); |
68 | } | 68 | } |
69 | 69 | ||
70 | finalize() difference() { | 70 | finalize() difference() { |
71 | hull() { | 71 | hull() { |
72 | forinputs() | 72 | forinputs() |
73 | translate([0,0,l_input+pushfit_h]) mirror([0,0,1]) | 73 | translate([0,0,l_input+pushfit_h]) mirror([0,0,1]) |
74 | cylinder(d=pushfit_d+shell*2,h=epsilon,$fn=pushfit_d*fnd); | 74 | cylinder(d=pushfit_d+shell*2,h=epsilon,$fn=pushfit_d*fnd); |
75 | foroutput() | 75 | foroutput() |
76 | translate([0,0,l_output+pushfit_h]) { | 76 | translate([0,0,l_output+pushfit_h]) { |
77 | cylinder(d=pushfit_d+shell*2,h=epsilon,$fn=pushfit_d*fnd); | 77 | cylinder(d=pushfit_d+shell*2,h=epsilon,$fn=pushfit_d*fnd); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | forinputs() { | 80 | forinputs() { |
81 | translate([0,0,l_input]) pushfit(pf,draft=draft); | 81 | translate([0,0,l_input]) pushfit(pf,draft=draft); |
82 | translate([0,0,l_narrow]) { | 82 | translate([0,0,l_narrow]) { |
83 | cylinder(d=lod,h=l_input+1-l_narrow,$fn=lod*fnd); | 83 | cylinder(d=lod,h=l_input+1-l_narrow,$fn=lod*fnd); |
84 | mirror([0,0,1]) translate([0,0,-epsilon]) | 84 | mirror([0,0,1]) translate([0,0,-epsilon]) |
85 | cylinder(d1=(liner_id+lod)/2,d2=liner_id,h=liner_id,$fn=lod*fnd); | 85 | cylinder(d1=(liner_id+lod)/2,d2=liner_id,h=liner_id,$fn=lod*fnd); |
86 | } | 86 | } |
87 | cylinder(d=liner_id,h=l_input+epsilon,$fn=liner_id*fnd); | 87 | cylinder(d=liner_id,h=l_input+epsilon,$fn=liner_id*fnd); |
88 | } | 88 | } |
89 | foroutput() { | 89 | foroutput() { |
90 | translate([0,0,l_output]) pushfit(pf,draft=draft); | 90 | translate([0,0,l_output]) pushfit(pf,draft=draft); |
91 | cylinder(d=lod,h=l_output+1,$fn=lod*fnd); | 91 | cylinder(d=lod,h=l_output+1,$fn=lod*fnd); |
92 | } | 92 | } |
93 | hull() { | 93 | hull() { |
94 | forinputs() | 94 | forinputs() |
95 | translate([0,0,l_fork]) cylinder(d=liner_id,h=epsilon,$fn=liner_id*fnd); | 95 | translate([0,0,l_fork]) cylinder(d=liner_id,h=epsilon,$fn=liner_id*fnd); |
96 | foroutput() | 96 | foroutput() |
97 | cylinder(d=liner_id,h=epsilon,$fn=liner_id*fnd); | 97 | cylinder(d=liner_id,h=epsilon,$fn=liner_id*fnd); |
98 | } | 98 | } |
99 | if(debug) { | 99 | if(debug) { |
100 | translate([0,0,-20/*TODO:*/]) | 100 | translate([0,0,-20/*TODO:*/]) |
101 | rotate_extrude(angle=angular_step*debug) | 101 | rotate_extrude(angle=angular_step*debug) |
102 | square([50,100]/*TODO:*/); | 102 | square([50,100]/*TODO:*/); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | } | 106 | } |
107 | 107 | ||
108 | multiswitch(debug=2,print=false); | 108 | |
109 | //CUSTOMIZERCUTOFF | ||
110 | multiswitch(debug=1,print=false,inputs=2); | ||