summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--another.scad2
1 files changed, 1 insertions, 1 deletions
diff --git a/another.scad b/another.scad
index 915b184..0f696cc 100644
--- a/another.scad
+++ b/another.scad
@@ -1,484 +1,484 @@
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=.6, 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 70
71 what="lever", // lever|body|knob|springpad|* 71 what="lever", // lever|body|knob|springpad|*
72 left=false, 72 left=false,
73 vitamins = true, 73 vitamins = true,
74 bridges = true, 74 bridges = true,
75 debug = false, 75 debug = false,
76) { 76) {
77 fnd = 2*PI; fnr = 2*fnd; 77 fnd = 2*PI; fnr = 2*fnd;
78 function lu(m,k) = m[search([k],m)[0]][1]; 78 function lu(m,k) = m[search([k],m)[0]][1];
79 79
80 pulley_d = lu(pulley,"d"); 80 pulley_d = lu(pulley,"d");
81 pulley_h = lu(pulley,"h"); 81 pulley_h = lu(pulley,"h");
82 teeth_elevation = lu(pulley,"fe"); 82 teeth_elevation = lu(pulley,"fe");
83 filament_offset = lu(pulley,"g")+filament_d/2; 83 filament_offset = lu(pulley,"g")+filament_d/2;
84 pulley_d_clearance = lu(pulley,"ssrc")*2; 84 pulley_d_clearance = lu(pulley,"ssrc")*2;
85 85
86 idler_filament_offset = filament_path_d/2; 86 idler_filament_offset = filament_path_d/2;
87 lever_shell = mount_screwhead_h+0.5; 87 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); 88 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 89 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; 90 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)) 91 shortwing = let(a=mount_d/2,c=(pulley_d+idler_d)/2/sqrt(2))
92 sqrt(c*c+pow(a-c,2)); 92 sqrt(c*c+pow(a-c,2));
93 longwing_travel = idler_travel*longwing/shortwing; 93 longwing_travel = idler_travel*longwing/shortwing;
94 h_ = (pulley_d+idler_d)/(2*sqrt(2)); 94 h_ = (pulley_d+idler_d)/(2*sqrt(2));
95 ri = sqrt( pow(h_,2) + pow(mount_d/2-h_,2) ); 95 ri = sqrt( pow(h_,2) + pow(mount_d/2-h_,2) );
96 spring_dl = idler_travel*longwing/ri; 96 spring_dl = idler_travel*longwing/ri;
97 // finger and spring support 97 // finger and spring support
98 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);
99 99
100 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;
101 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;
102 filament_elevation=protrusion_h+pulley_elevation+teeth_elevation; 102 filament_elevation=protrusion_h+pulley_elevation+teeth_elevation;
103 ls_z = filament_elevation; // leverspace mid-z 103 ls_z = filament_elevation; // leverspace mid-z
104 ls_h = lever_thickness+lever_v_clearance; // leverspace height 104 ls_h = lever_thickness+lever_v_clearance; // leverspace height
105 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);
106 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);
107 echo("mount depth",mount_depth); 107 echo("mount depth",mount_depth);
108 108
109 module teardrop(r,d,h,center=false,angle=45) { 109 module teardrop(r,d,h,center=false,angle=45) {
110 dd = d ? d : (2*r); 110 dd = d ? d : (2*r);
111 $fn = dd*fnd; 111 $fn = dd*fnd;
112 cylinder(d=dd,h=h,center=center); 112 cylinder(d=dd,h=h,center=center);
113 if(angle>0) translate([0,0,center?-h/2:0]) 113 if(angle>0) translate([0,0,center?-h/2:0])
114 rotate([0,0,angle]) 114 rotate([0,0,angle])
115 cube(size=[d/2,d/2,h]); 115 cube(size=[d/2,d/2,h]);
116 } 116 }
117 117
118 module mirrorleft() { 118 module mirrorleft() {
119 mirror([left?0:1,0,0]) children(); 119 mirror([left?0:1,0,0]) children();
120 } 120 }
121 module place_idler() { 121 module place_idler() {
122 rotate([0,0,45]) 122 rotate([0,0,45])
123 translate([(pulley_d+idler_d)/2,0,0]) 123 translate([(pulley_d+idler_d)/2,0,0])
124 children(); 124 children();
125 } 125 }
126 module finger_indent(d=lever_thickness,depth/*=1*/,r/*=15*/) { 126 module finger_indent(d=lever_thickness,depth/*=1*/,r/*=15*/) {
127 if(depth) { 127 if(depth) {
128 hh = (-4*pow(depth,2)+pow(d,2))/(8*depth); 128 hh = (-4*pow(depth,2)+pow(d,2))/(8*depth);
129 rr = depth+hh; 129 rr = depth+hh;
130 translate([0,0,hh]) sphere(r=rr,$fn=fnr*rr); 130 translate([0,0,hh]) sphere(r=rr,$fn=fnr*rr);
131 }else if(r) { 131 }else if(r) {
132 hh=sqrt(pow(r,2)-pow(d,2)/4); 132 hh=sqrt(pow(r,2)-pow(d,2)/4);
133 translate([0,0,hh]) sphere(r=r,$fn=fnr*r); 133 translate([0,0,hh]) sphere(r=r,$fn=fnr*r);
134 } 134 }
135 } 135 }
136 136
137 % if(vitamins) mirrorleft() { 137 % if(vitamins) mirrorleft() {
138 translate([0,0,-epsilon]) mirror([0,0,1]) cylinder(d=gearbox_d,h=1,$fn=60); 138 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]) 139 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); 140 cylinder(d=mount_screw_d,h=20,$fn=30);
141 translate([0,0,-epsilon]) cylinder(d=protrusion_d,h=protrusion_h,$fn=30); 141 translate([0,0,-epsilon]) cylinder(d=protrusion_d,h=protrusion_h,$fn=30);
142 translate([0,0,protrusion_h]) { 142 translate([0,0,protrusion_h]) {
143 difference() { 143 difference() {
144 cylinder(d=bore_d,h=bore_l,$fn=30); 144 cylinder(d=bore_d,h=bore_l,$fn=30);
145 translate([-bore_d/2-1,bore_dd-bore_d/2,-1]) 145 translate([-bore_d/2-1,bore_dd-bore_d/2,-1])
146 cube([bore_d+2,bore_d/2,bore_l+2]); 146 cube([bore_d+2,bore_d/2,bore_l+2]);
147 } 147 }
148 translate([0,0,pulley_elevation]) { 148 translate([0,0,pulley_elevation]) {
149 cylinder(d=pulley_d,h=pulley_h,$fn=30); 149 cylinder(d=pulley_d,h=pulley_h,$fn=30);
150 translate([0,0,teeth_elevation]) { 150 translate([0,0,teeth_elevation]) {
151 place_idler() { 151 place_idler() {
152 cylinder(d=idler_d,h=idler_h,center=true,$fn=30); 152 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); 153 cylinder(d=idler_screw_d,h=lever_thickness+2,center=true,$fn=30);
154 }//place idler 154 }//place idler
155 // filament path 155 // filament path
156 rotate([0,0,45]) { 156 rotate([0,0,45]) {
157 translate([pulley_d/2-idler_filament_offset,0,0]) rotate([90,0,0]) { 157 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); 158 cylinder(d=filament_d,h=gearbox_d,center=false,$fn=15);
159 }//rotate translate 159 }//rotate translate
160 translate([pulley_d/2+filament_offset,0,0]) rotate([-90,0,0]) { 160 translate([pulley_d/2+filament_offset,0,0]) rotate([-90,0,0]) {
161 cylinder(d=filament_d,h=gearbox_d,center=false,$fn=15); 161 cylinder(d=filament_d,h=gearbox_d,center=false,$fn=15);
162 translate([0,0,mount_d/sqrt(2)/2+mount_screw_d]) 162 translate([0,0,mount_d/sqrt(2)/2+mount_screw_d])
163 pushfit(pf); 163 pushfit(pf);
164 }//rotate translate 164 }//rotate translate
165 }//rotate 165 }//rotate
166 }//translate teeth 166 }//translate teeth
167 }//translate pulley 167 }//translate pulley
168 }//translate protrusion 168 }//translate protrusion
169 }//vitamins 169 }//vitamins
170 170
171 module lever() { 171 module lever() {
172 translate([0,0,protrusion_h+pulley_elevation+teeth_elevation]) { 172 translate([0,0,protrusion_h+pulley_elevation+teeth_elevation]) {
173 difference() { 173 difference() {
174 union() { 174 union() {
175 hull() { 175 hull() {
176 place_idler() 176 place_idler()
177 cylinder(d=lsd,h=lever_thickness,center=true,$fn=60); 177 cylinder(d=lsd,h=lever_thickness,center=true,$fn=60);
178 translate([mount_d/2,0,0]) 178 translate([mount_d/2,0,0])
179 cylinder(d=lsd,h=lever_thickness,center=true,$fn=60); 179 cylinder(d=lsd,h=lever_thickness,center=true,$fn=60);
180 }//hull 180 }//hull
181 hull() { 181 hull() {
182 translate([mount_d/2,0,0]) 182 translate([mount_d/2,0,0])
183 cylinder(d=lsd,h=lever_thickness,center=true,$fn=60); 183 cylinder(d=lsd,h=lever_thickness,center=true,$fn=60);
184 translate([mount_d/2,-longwing,0]) rotate([0,90,0]) 184 translate([mount_d/2,-longwing,0]) rotate([0,90,0])
185 cylinder(d=lever_thickness,h=lsd,center=true,$fn=60); 185 cylinder(d=lever_thickness,h=lsd,center=true,$fn=60);
186 }//hull 186 }//hull
187 }//union 187 }//union
188 188
189 // filament path 189 // filament path
190 place_idler() 190 place_idler()
191 translate([-idler_d/2-idler_filament_offset,0,0]) 191 translate([-idler_d/2-idler_filament_offset,0,0])
192 rotate([90,0,0]) { 192 rotate([90,0,0]) {
193 mirror([0,1,0]) 193 mirror([0,1,0])
194 teardrop(d=filament_path_d,h=3*gearbox_d,center=true); 194 teardrop(d=filament_path_d,h=3*gearbox_d,center=true);
195 translate([0,0, 195 translate([0,0,
196 sqrt(2)*(mount_d-pulley_d+lsd)/2 196 sqrt(2)*(mount_d-pulley_d+lsd)/2
197 ]) { 197 ]) {
198 cylinder(d1=filament_path_d,d2=2*filament_path_d, 198 cylinder(d1=filament_path_d,d2=2*filament_path_d,
199 h=filament_path_d,$fn=2*filament_path_d*fnd); 199 h=filament_path_d,$fn=2*filament_path_d*fnd);
200 translate([0,0,filament_path_d-epsilon]) 200 translate([0,0,filament_path_d-epsilon])
201 cylinder(d=2*filament_path_d,h=lsd*sqrt(2),$fn=2*filament_path_d*fnd); 201 cylinder(d=2*filament_path_d,h=lsd*sqrt(2),$fn=2*filament_path_d*fnd);
202 }//translate 202 }//translate
203 }//rotate translate place_idler 203 }//rotate translate place_idler
204 204
205 // idler space and mounting hole 205 // idler space and mounting hole
206 place_idler() { 206 place_idler() {
207 cylinder(d=idler_d+idler_clearance*2,h=idler_h+idler_v_tolerance,center=true,$fn=60); 207 cylinder(d=idler_d+idler_clearance*2,h=idler_h+idler_v_tolerance,center=true,$fn=60);
208 cylinder(d=idler_screw_d,h=lever_thickness+2,center=true,$fn=30); 208 cylinder(d=idler_screw_d,h=lever_thickness+2,center=true,$fn=30);
209 translate([0,0,lever_thickness/2-idler_screwhead_h]) 209 translate([0,0,lever_thickness/2-idler_screwhead_h])
210 cylinder(d=idler_screwhead_d,h=idler_screwhead_h+1,$fn=fnd*idler_screwhead_d); 210 cylinder(d=idler_screwhead_d,h=idler_screwhead_h+1,$fn=fnd*idler_screwhead_d);
211 } 211 }
212 // mounting screw hole 212 // mounting screw hole
213 translate([mount_d/2,0,0]) 213 translate([mount_d/2,0,0])
214 cylinder(d=mount_screw_d+mount_screw_d_tolerance,h=lever_thickness+2,center=true,$fn=fnd*mount_screw_d); 214 cylinder(d=mount_screw_d+mount_screw_d_tolerance,h=lever_thickness+2,center=true,$fn=fnd*mount_screw_d);
215 215
216 // lever end 216 // lever end
217 translate([mount_d/2,0,0]) rotate([0,90,0]) { 217 translate([mount_d/2,0,0]) rotate([0,90,0]) {
218 translate([0,-longwing,lsd/2]) finger_indent(d=lever_thickness-1,r=15); 218 translate([0,-longwing,lsd/2]) finger_indent(d=lever_thickness-1,r=15);
219 translate([0,-longwing,0]) 219 translate([0,-longwing,0])
220 mirror([0,0,1]) 220 mirror([0,0,1])
221 difference() { 221 difference() {
222 cylinder(d=spring_d+spring_d_clearance,h=lsd,$fn=fnd*(spring_d+spring_d_clearance)); 222 cylinder(d=spring_d+spring_d_clearance,h=lsd,$fn=fnd*(spring_d+spring_d_clearance));
223 sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4); 223 sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4);
224 } 224 }
225 }//rotate-translate 225 }//rotate-translate
226 }//difference 226 }//difference
227 // bridging patch 227 // bridging patch
228 if(bridges) place_idler() 228 if(bridges) place_idler()
229 translate([0,0,lever_thickness/2-mount_screwhead_h]) 229 translate([0,0,lever_thickness/2-mount_screwhead_h])
230 mirror([0,0,1]) 230 mirror([0,0,1])
231 cylinder(d=mount_screwhead_d,h=layer_height); 231 cylinder(d=mount_screwhead_d,h=layer_height);
232 }//translate 232 }//translate
233 }//lever module 233 }//lever module
234 234
235 module body() { 235 module body() {
236 difference() { 236 difference() {
237 union() { 237 union() {
238 cylinder(d=gearbox_d,h=body_h,$fn=fnd*gearbox_d); 238 cylinder(d=gearbox_d,h=body_h,$fn=fnd*gearbox_d);
239 // spring tensioner part 239 // spring tensioner part
240 translate([-gearbox_d/2,0,0]) hull() { 240 translate([-gearbox_d/2,0,0]) hull() {
241 translate([0,-longwing,ls_z]) 241 translate([0,-longwing,ls_z])
242 rotate([0,90,0]) 242 rotate([0,90,0])
243 cylinder(d=lever_thickness,h=fsw,$fn=fnd*lever_thickness); 243 cylinder(d=lever_thickness,h=fsw,$fn=fnd*lever_thickness);
244 hh=body_h-ls_z; 244 hh=body_h-ls_z;
245 translate([0,0,ls_z]) 245 translate([0,0,ls_z])
246 mirror([0,1,0]) cube(size=[fsw,longwing+(st_split_w+st_split_w_tolerance)/2+st_thickshell,body_h-ls_z]); 246 mirror([0,1,0]) cube(size=[fsw,longwing+(st_split_w+st_split_w_tolerance)/2+st_thickshell,body_h-ls_z]);
247 hhh=ls_z; 247 hhh=ls_z;
248 translate([0,0,0]) 248 translate([0,0,0])
249 mirror([0,1,0]) cube(size=[fsw,longwing-hhh+lever_thickness/sqrt(2),hhh+lever_thickness/2]); 249 mirror([0,1,0]) cube(size=[fsw,longwing-hhh+lever_thickness/sqrt(2),hhh+lever_thickness/2]);
250 }//hull translate 250 }//hull translate
251 251
252 // pushfit bracket 252 // pushfit bracket
253 translate([0,0,filament_elevation]) 253 translate([0,0,filament_elevation])
254 rotate([0,0,45]) translate([pulley_d/2+filament_offset,0,0]) 254 rotate([0,0,45]) translate([pulley_d/2+filament_offset,0,0])
255 rotate([-90,0,0]) 255 rotate([-90,0,0])
256 translate([0,0,mount_d/sqrt(2)/2+mount_screw_d-gearbox_d/2/*TODO:*/]) { 256 translate([0,0,mount_d/sqrt(2)/2+mount_screw_d-gearbox_d/2/*TODO:*/]) {
257 pfbl = pf_h(pf)+gearbox_d/2; //TODO: 257 pfbl = pf_h(pf)+gearbox_d/2; //TODO:
258 pfbd = pf_d(pf)+2*pf_shell; 258 pfbd = pf_d(pf)+2*pf_shell;
259 hull() { 259 hull() {
260 cylinder(d=pfbd,h=pfbl,$fn=pfbd*fnd); 260 cylinder(d=pfbd,h=pfbl,$fn=pfbd*fnd);
261 translate([-epsilon/2,0,0]) { 261 translate([-epsilon/2,0,0]) {
262 cube(size=[epsilon,filament_elevation,pfbl-filament_elevation+pfbd/2]); 262 cube(size=[epsilon,filament_elevation,pfbl-filament_elevation+pfbd/2]);
263 mirror([0,1,0]) 263 mirror([0,1,0])
264 cube(size=[epsilon,body_h-filament_elevation,pfbl-body_h+filament_elevation+pfbd/2]); 264 cube(size=[epsilon,body_h-filament_elevation,pfbl-body_h+filament_elevation+pfbd/2]);
265 }//translate 265 }//translate
266 }//hull 266 }//hull
267 }//translate rotate translate rotate translate 267 }//translate rotate translate rotate translate
268 }//union (first child of difference) 268 }//union (first child of difference)
269 269
270 // protrusion 270 // protrusion
271 translate([0,0,-1]) 271 translate([0,0,-1])
272 cylinder(d=protrusion_d+protrusion_tolerance_h,h=protrusion_h+protrusion_tolerance_v+1,$fn=fnd*(protrusion_d+protrusion_tolerance_h)); 272 cylinder(d=protrusion_d+protrusion_tolerance_h,h=protrusion_h+protrusion_tolerance_v+1,$fn=fnd*(protrusion_d+protrusion_tolerance_h));
273 // mount screw holes 273 // mount screw holes
274 for(zr=[0:90:359]) rotate([0,0,zr]) translate([mount_d/2,0,0]) { 274 for(zr=[0:90:359]) rotate([0,0,zr]) translate([mount_d/2,0,0]) {
275 translate([0,0,mount_screw_l-mount_depth-(bridges?layer_height:-epsilon)]) 275 translate([0,0,mount_screw_l-mount_depth-(bridges?layer_height:-epsilon)])
276 mirror([0,0,1]) 276 mirror([0,0,1])
277 cylinder(d=mount_screw_d+mount_screw_d_tolerance, 277 cylinder(d=mount_screw_d+mount_screw_d_tolerance,
278 h=mount_screw_l-mount_depth+1, 278 h=mount_screw_l-mount_depth+1,
279 $fn=fnd*(mount_screw_d+mount_screw_d_tolerance)); 279 $fn=fnd*(mount_screw_d+mount_screw_d_tolerance));
280 translate([0,0,mount_screw_l-mount_depth]) 280 translate([0,0,mount_screw_l-mount_depth])
281 cylinder(d=mount_screwhead_d,h=body_h+1,$fn=fnd*mount_screwhead_d); 281 cylinder(d=mount_screwhead_d,h=body_h+1,$fn=fnd*mount_screwhead_d);
282 }//for 282 }//for
283 // pushfit 283 // pushfit
284 pf_offset = mount_d/sqrt(2)/2+mount_screw_d; 284 pf_offset = mount_d/sqrt(2)/2+mount_screw_d;
285 translate([0,0,filament_elevation]) 285 translate([0,0,filament_elevation])
286 rotate([0,0,45]) translate([pulley_d/2+filament_offset,0,0]) 286 rotate([0,0,45]) translate([pulley_d/2+filament_offset,0,0])
287 rotate([-90,0,0]) 287 rotate([-90,0,0])
288 translate([0,0,pf_offset]) 288 translate([0,0,pf_offset])
289 rotate([0,0,180]) { 289 rotate([0,0,180]) {
290 pushfit(pf); 290 pushfit(pf);
291 mirror([0,0,1]) { 291 mirror([0,0,1]) {
292 fh = 1.5* (filament_guide_d-filament_path_d)/2; 292 fh = 1.5* (filament_guide_d-filament_path_d)/2;
293 fo = pf_offset -filament_path_d /*(idler_d+idler_clearance)/2*/-fh; 293 fo = pf_offset -filament_path_d /*(idler_d+idler_clearance)/2*/-fh;
294 translate([0,0,-1]) teardrop(d=filament_guide_d,h=fo/2,angle=225); 294 translate([0,0,-1]) teardrop(d=filament_guide_d,h=fo/2,angle=225);
295 translate([0,0,-1]) teardrop(d=filament_path_d,h=gearbox_d/2+1,angle=-225); 295 translate([0,0,-1]) teardrop(d=filament_path_d,h=gearbox_d/2+1,angle=-225);
296 translate([0,0,fo+epsilon]) 296 translate([0,0,fo+epsilon])
297 cylinder(d1=filament_path_d,d2=filament_guide_d,h=fh,$fn=fnd*filament_guide_d); 297 cylinder(d1=filament_path_d,d2=filament_guide_d,h=fh,$fn=fnd*filament_guide_d);
298 }//mirror 298 }//mirror
299 }//rotate translate rotate translate rotate translate 299 }//rotate translate rotate translate rotate translate
300 // pulley 300 // pulley
301 cylinder(d=pulley_d+pulley_small_d_clearance,h=body_h+1,$fn=fnd*(pulley_d+pulley_d_clearance)); 301 cylinder(d=pulley_d+pulley_small_d_clearance,h=body_h+1,$fn=fnd*(pulley_d+pulley_d_clearance));
302 cylinder(d=pulley_d+pulley_d_clearance,ls_z-max(idler_h,filament_guide_d)/2,$fn=fnd*(pulley_d+pulley_d_clearance)); 302 cylinder(d=pulley_d+pulley_d_clearance,ls_z-max(idler_h,filament_guide_d)/2,$fn=fnd*(pulley_d+pulley_d_clearance));
303 303
304 translate([0,0,ls_z-ls_h/2]) { 304 translate([0,0,ls_z-ls_h/2]) {
305 // idler travel 305 // idler travel
306 translate([mount_d/2,0,0]) 306 translate([mount_d/2,0,0])
307 rotate([0,0,45]) 307 rotate([0,0,45])
308 rotate_extrude(angle=90,$fn=fnr*(shortwing+(idler_d+idler_clearance)/2)) 308 rotate_extrude(angle=90,$fn=fnr*(shortwing+(idler_d+idler_clearance)/2))
309 square([shortwing+(idler_d+idler_clearance)/2,ls_h]); 309 square([shortwing+(idler_d+idler_clearance)/2,ls_h]);
310 // idler itself 310 // idler itself
311 place_idler() 311 place_idler()
312 cylinder(d=idler_d+idler_clearance,h=ls_h,$fn=fnd*(idler_d+idler_clearance)); 312 cylinder(d=idler_d+idler_clearance,h=ls_h,$fn=fnd*(idler_d+idler_clearance));
313 // lever space 313 // lever space
314 rotate([0,0,45]) 314 rotate([0,0,45])
315 rotate_extrude(angle=-135+max(atan(2*fsw/gearbox_d-1),atan(gearbox_d/mount_d-1))) 315 rotate_extrude(angle=-135+max(atan(2*fsw/gearbox_d-1),atan(gearbox_d/mount_d-1)))
316 square([gearbox_d/2+1,ls_h]); 316 square([gearbox_d/2+1,ls_h]);
317 } 317 }
318 318
319 // back side cutout 319 // back side cutout
320 // XXX: this is somewhat ugly and potentially bugged, 320 // XXX: this is somewhat ugly and potentially bugged,
321 // but I want to sleep. 321 // but I want to sleep.
322 a0_ = atan( 322 a0_ = atan(
323 (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)
324 / 324 /
325 ( 325 (
326 pulley_d/2+filament_offset- 326 pulley_d/2+filament_offset-
327 (pf_d(pf)+2*pf_shell)/2/cos(30) 327 (pf_d(pf)+2*pf_shell)/2/cos(30)
328 ) 328 )
329 ); 329 );
330 a0 = -135 + ( (a0_>0) ? a0_ : 180+a0_ ); 330 a0 = -135 + ( (a0_>0) ? a0_ : 180+a0_ );
331 a1 = atan((longwing-lever_thickness/2)/(gearbox_d/2)); 331 a1 = atan((longwing-lever_thickness/2)/(gearbox_d/2));
332 translate([0,0,ls_z]) difference() { 332 translate([0,0,ls_z]) difference() {
333 rotate([0,0,-180+a0]) 333 rotate([0,0,-180+a0])
334 rotate_extrude(angle=a1-a0) 334 rotate_extrude(angle=a1-a0)
335 translate([0,-ls_h/2]) 335 translate([0,-ls_h/2])
336 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,
337 ls_h]); 337 ls_h]);
338 translate([-mount_d/2,0,0]) 338 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)); 339 cylinder(d=gearbox_d-mount_d,h=ls_h+2,center=true,$fn=fnd*(gearbox_d-mount_d));
340 }//difference translate 340 }//difference translate
341 341
342 // spring tensioner 342 // spring tensioner
343 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0]) { 343 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0]) {
344 mirror([0,0,1]) { 344 mirror([0,0,1]) {
345 translate([0,0,st_thickshell]) 345 translate([0,0,st_thickshell])
346 hull() for(o=[0,spring_d]) translate([0,-o,0]) 346 hull() for(o=[0,spring_d]) translate([0,-o,0])
347 rotate([0,0,30]) 347 rotate([0,0,30])
348 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);
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 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; 350 bigd = spring_d+spring_d_clearance;
351 hf = (bigd-st_screw_d-st_screw_d_tolerance)/2; 351 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]) { 352 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, 353 cylinder(d1=st_screw_d+st_screw_d_tolerance,d2=bigd,
354 h=hf+epsilon, $fn=fnd*bigd); 354 h=hf+epsilon, $fn=fnd*bigd);
355 translate([0,-(st_split_w+st_split_w_tolerance)/2,0]) 355 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]); 356 cube(size=[body_h-ls_z+1,st_split_w+st_split_w_tolerance,fsw+1]);
357 }//translate 357 }//translate
358 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])
359 cylinder(d=bigd,h=fsw+1,$fn=fnd*bigd); 359 cylinder(d=bigd,h=fsw+1,$fn=fnd*bigd);
360 }//mirror 360 }//mirror
361 }//translate 361 }//translate
362 362
363 // label 363 // label
364 body_label(); 364 body_label();
365 365
366 }//difference 366 }//difference
367 367
368 }//body module 368 }//body module
369 module body_label() { 369 module body_label() {
370 if(body_label) { 370 if(body_label) {
371 label=body_label; 371 label=body_label;
372 label_thickness=body_label_thickness; 372 label_thickness=body_label_thickness;
373 label_len = len(label); 373 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]; 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 translate([0,0,body_h-label_thickness]) 375 translate([0,0,body_h-label_thickness])
376 linear_extrude(height=label_thickness+epsilon,convexity=64) 376 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]) 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 mirror([left?0:1,0]) 378 mirror([left?0:1,0])
379 text(text=label,size=labelspace.x/label_len,halign="center",valign="center",font="Arial Black"); 379 text(text=label,size=labelspace.x/label_len,halign="center",valign="center",font="Arial Black");
380 }//if(body_label) 380 }//if(body_label)
381 } 381 }
382 382
383 module springpad() { 383 module springpad() {
384 smalld=st_screw_d+st_screw_d_tolerance+min_xy_shell; 384 smalld=st_screw_d+st_screw_d_tolerance+min_xy_shell;
385 bigd = spring_d+spring_d_clearance/2; 385 bigd = spring_d+spring_d_clearance/2;
386 hf = (bigd-smalld)/2; 386 hf = (bigd-smalld)/2;
387 h = hf*3.5; 387 h = hf*3.5;
388 translate([-gearbox_d/2+st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell+1,-longwing,filament_elevation]) 388 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() { 389 rotate([0,90,0]) difference() {
390 union() { 390 union() {
391 cylinder(d1=smalld,d2=bigd,h=hf,$fn=fnd*bigd); 391 cylinder(d1=smalld,d2=bigd,h=hf,$fn=fnd*bigd);
392 translate([0,0,hf-epsilon]) 392 translate([0,0,hf-epsilon])
393 cylinder(d=bigd,h=h-hf,$fn=fnd*bigd); 393 cylinder(d=bigd,h=h-hf,$fn=fnd*bigd);
394 translate([0,0,h]) 394 translate([0,0,h])
395 sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4); 395 sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4);
396 l = body_h-ls_z; 396 l = body_h-ls_z;
397 w = st_split_w; 397 w = st_split_w;
398 hull() translate([0,-st_split_w/2,0]) mirror([1,0,0]) { 398 hull() translate([0,-st_split_w/2,0]) mirror([1,0,0]) {
399 translate([0,0,w]) 399 translate([0,0,w])
400 cube(size=[l,st_split_w,w]); 400 cube(size=[l,st_split_w,w]);
401 cube(size=[l-w,st_split_w,2*w]); 401 cube(size=[l-w,st_split_w,2*w]);
402 } 402 }
403 } 403 }
404 translate([0,0,-epsilon]) 404 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)); 405 cylinder(d=st_screw_d+st_screw_d_tolerance,h=2*hf+epsilon,$fn=fnd*(st_screw_d+st_screw_d_tolerance));
406 } 406 }
407 } 407 }
408 408
409 module knob() { 409 module knob() {
410 ch = knob_indent_d/2; 410 ch = knob_indent_d/2;
411 knob_bore_l = body_h-protrusion_h-pulley_elevation-pulley_h-knob_v_clearance; 411 knob_bore_l = body_h-protrusion_h-pulley_elevation-pulley_h-knob_v_clearance;
412 translate([0,0,body_h+epsilon]) { 412 translate([0,0,body_h+epsilon]) {
413 mirror([0,0,1]) translate([0,0,-epsilon]) { 413 mirror([0,0,1]) translate([0,0,-epsilon]) {
414 difference() { 414 difference() {
415 cylinder(d=pulley_d,h=knob_bore_l,$fn=fnd*pulley_d); 415 cylinder(d=pulley_d,h=knob_bore_l,$fn=fnd*pulley_d);
416 translate([0,0,-1]) difference() { 416 translate([0,0,-1]) difference() {
417 cylinder(d=bore_d+knob_bore_d_tolerance,h=knob_bore_l+2); 417 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]) 418 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]); 419 cube([bore_d+2,bore_d/2,knob_bore_l+4]);
420 } 420 }
421 } 421 }
422 } 422 }
423 difference() { 423 difference() {
424 union() { 424 union() {
425 cylinder(d1=gearbox_d-2*ch,d2=gearbox_d,h=ch+epsilon,$fn=fnd*gearbox_d); 425 cylinder(d1=gearbox_d-2*ch,d2=gearbox_d,h=ch+epsilon,$fn=fnd*gearbox_d);
426 translate([0,0,ch]) 426 translate([0,0,ch])
427 cylinder(d=gearbox_d,h=knob_h-2*ch+epsilon,$fn=fnd*gearbox_d); 427 cylinder(d=gearbox_d,h=knob_h-2*ch+epsilon,$fn=fnd*gearbox_d);
428 translate([0,0,knob_h-ch]) 428 translate([0,0,knob_h-ch])
429 cylinder(d1=gearbox_d,d2=gearbox_d-2*ch,h=ch,$fn=fnd*gearbox_d); 429 cylinder(d1=gearbox_d,d2=gearbox_d-2*ch,h=ch,$fn=fnd*gearbox_d);
430 } 430 }
431 for(a=[0:360/knob_indents:359]) rotate([0,0,a]) 431 for(a=[0:360/knob_indents:359]) rotate([0,0,a])
432 translate([0,gearbox_d/2,-1]) 432 translate([0,gearbox_d/2,-1])
433 cylinder(d=knob_indent_d,h=knob_h+2,$fn=fnd*knob_indent_d); 433 cylinder(d=knob_indent_d,h=knob_h+2,$fn=fnd*knob_indent_d);
434 } 434 }
435 } 435 }
436 }//knob module 436 }//knob module
437 437
438 module debug() { 438 module debug() {
439 difference() { 439 difference() {
440 children(); 440 children();
441 if(debug) { 441 if(debug) {
442 // spring tensioner debug cutout 442 // spring tensioner debug cutout
443 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0]) 443 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0])
444 translate([0,-lever_thickness/2-1,-gearbox_d]) 444 translate([0,-lever_thickness/2-1,-gearbox_d])
445 cube(size=[body_h/2+1,lever_thickness/2+1,gearbox_d+2]); 445 cube(size=[body_h/2+1,lever_thickness/2+1,gearbox_d+2]);
446 // lever axis debug cutout 446 // lever axis debug cutout
447 translate([mount_d/2,0,-1]) 447 translate([mount_d/2,0,-1])
448 rotate([0,0,-45]) 448 rotate([0,0,-45])
449 cube(size=[gearbox_d-mount_d,gearbox_d-mount_d,body_h+knob_h+2]); 449 cube(size=[gearbox_d-mount_d,gearbox_d-mount_d,body_h+knob_h+2]);
450 // idler debug cutout 450 // idler debug cutout
451 translate([0,0,ls_z]) 451 translate([0,0,ls_z])
452 place_idler() 452 place_idler()
453 rotate([0,0,-45]) 453 rotate([0,0,-45])
454 translate([0,0,-lever_thickness/2-epsilon]) 454 translate([0,0,-lever_thickness/2-epsilon])
455 cube(size=[lsd*sqrt(2)/2+1,lsd*sqrt(2)/2+1, 455 cube(size=[lsd*sqrt(2)/2+1,lsd*sqrt(2)/2+1,
456 lever_thickness+2*epsilon]); 456 lever_thickness+2*epsilon]);
457 // pushfit debug cutout 457 // pushfit debug cutout
458 place_idler() 458 place_idler()
459 translate([-idler_d/2+filament_offset,0,ls_z]) 459 translate([-idler_d/2+filament_offset,0,ls_z])
460 cube(size=[gearbox_d/2,gearbox_d/2+pf_h(pf),body_h-ls_z+knob_h+1]); 460 cube(size=[gearbox_d/2,gearbox_d/2+pf_h(pf),body_h-ls_z+knob_h+1]);
461 }//if debug 461 }//if debug
462 }//difference 462 }//difference
463 } 463 }
464 464
465 mirrorleft() 465 mirrorleft()
466 debug() 466 debug()
467 if(what=="lever") color("green",0.7) lever(); 467 if(what=="lever") color("green",0.7) lever();
468 else if(what=="body") color("yellow",0.7) body(); 468 else if(what=="body") color("yellow",0.7) body();
469 else if(what=="body.label") color("brown",0.7) body_label(); 469 else if(what=="body.label") color("brown",0.7) body_label();
470 else if(what=="knob") color("red",0.7) knob(); 470 else if(what=="knob") color("red",0.7) knob();
471 else if(what=="springpad") color("blue",0.7) springpad(); 471 else if(what=="springpad") color("blue",0.7) springpad();
472 else if(what=="both") { 472 else if(what=="both") {
473 color("green",0.7) lever(); 473 color("green",0.7) lever();
474 color("yellow",0.7) body(); 474 color("yellow",0.7) body();
475 color("brown",0.7) body_label(); 475 color("brown",0.7) body_label();
476 }else{ 476 }else{
477 color("green",0.7) lever(); 477 color("green",0.7) lever();
478 color("yellow",0.7) body(); 478 color("yellow",0.7) body();
479 color("red",0.7) knob(); 479 color("red",0.7) knob();
480 color("blue",0.7) springpad(); 480 color("blue",0.7) springpad();
481 } 481 }
482} 482}
483 483
484the_extruder(what="*",left=false,debug=true); 484the_extruder(what="*",left=false,debug=true);