summaryrefslogtreecommitdiff
authorMichael Krelin <hacker@klever.net>2018-09-06 20:58:54 (UTC)
committer Michael Krelin <hacker@klever.net>2018-09-06 20:58:54 (UTC)
commit1409beae6cdd6520ef037b0d2a083844ce0e0c47 (patch) (unidiff)
treef6a4df48f0f870a3f152db11bf464052b5add237
parent4cc8be3ab27f44d8a298b8df3df0092d1f95e067 (diff)
downloadextrudery-1409beae6cdd6520ef037b0d2a083844ce0e0c47.zip
extrudery-1409beae6cdd6520ef037b0d2a083844ce0e0c47.tar.gz
extrudery-1409beae6cdd6520ef037b0d2a083844ce0e0c47.tar.bz2
spring compression scale
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile4
-rw-r--r--another.scad37
2 files changed, 35 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 5753a68..b9d2b4c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,44 +1,46 @@
1-include Makefile.local 1-include Makefile.local
2 2
3OPENSCAD_APP?=/Applications/OpenSCAD.app 3OPENSCAD_APP?=/Applications/OpenSCAD.app
4OPENSCAD_BIN?=${OPENSCAD_APP}/Contents/MacOS/OpenSCAD 4OPENSCAD_BIN?=${OPENSCAD_APP}/Contents/MacOS/OpenSCAD
5OPENSCAD_FLAGS=-D draft=false -D debug=false 5OPENSCAD_FLAGS=-D draft=false -D debug=false
6SED?=sed 6SED?=sed
7ECHO?=/bin/echo 7ECHO?=/bin/echo
8AWK?=awk 8AWK?=awk
9 9
10default: 10default:
11 @echo "And?" 11 @echo "And?"
12 12
13clean: 13clean:
14 rm -f *.stl *.gcode 14 rm -f *.stl *.gcode
15 15
16stl-another-%: 16stl-another-%:
17 $(MAKE) another-$*-{body,body-label,lever,knob,knob-label,springpad}.stl 17 $(MAKE) another-$*-{body,body-label,body-scale,lever,knob,knob-label,springpad}.stl
18 18
19another-%-body.stl: another-%.scad another.scad 19another-%-body.stl: another-%.scad another.scad
20 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D 'what="body"' -o "$@" "$<" 20 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D 'what="body"' -o "$@" "$<"
21another-%-body-label.stl: another-%.scad another.scad 21another-%-body-label.stl: another-%.scad another.scad
22 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D 'what="body.label"' -o "$@" "$<" 22 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D 'what="body.label"' -o "$@" "$<"
23another-%-body-scale.stl: another-%.scad another.scad
24 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D 'what="body.scale"' -o "$@" "$<"
23another-%-lever.stl: another-%.scad another.scad 25another-%-lever.stl: another-%.scad another.scad
24 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D 'what="lever"' -o "$@" "$<" 26 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D 'what="lever"' -o "$@" "$<"
25another-%-knob.stl: another-%.scad another.scad 27another-%-knob.stl: another-%.scad another.scad
26 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D 'what="knob"' -o "$@" "$<" 28 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D 'what="knob"' -o "$@" "$<"
27another-%-knob-label.stl: another-%.scad another.scad 29another-%-knob-label.stl: another-%.scad another.scad
28 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D 'what="knob.label"' -o "$@" "$<" 30 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D 'what="knob.label"' -o "$@" "$<"
29another-%-springpad.stl: another-%.scad another.scad 31another-%-springpad.stl: another-%.scad another.scad
30 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D 'what="springpad"' -o "$@" "$<" 32 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D 'what="springpad"' -o "$@" "$<"
31 33
32multiswitch: multiswitch.c8r.scad $(addsuffix .stl,$(addprefix multiswitch-embeddest-,2 3 4 5 6)) 34multiswitch: multiswitch.c8r.scad $(addsuffix .stl,$(addprefix multiswitch-embeddest-,2 3 4 5 6))
33multiswitch-embeddest-%.stl: multiswitch-embeddest.scad 35multiswitch-embeddest-%.stl: multiswitch-embeddest.scad
34 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D inputs=$* -o "$@" "$<" 36 $(OPENSCAD_BIN) $(OPENSCAD_FLAGS) -D inputs=$* -o "$@" "$<"
35 37
36multiswitch.c8r.scad: multiswitch-c8r.scad threads.scad pushfit_data.scad pushfittery.scad multiswitch.scad 38multiswitch.c8r.scad: multiswitch-c8r.scad threads.scad pushfit_data.scad pushfittery.scad multiswitch.scad
37 @echo "Preprocessing into $@…" 39 @echo "Preprocessing into $@…"
38 @( \ 40 @( \
39 $(ECHO) "/* DO NOT. JUST DO NOT. FORGET THIS FILE, IT'S PREPROCESSED, GET THE SOURCE. */" ;\ 41 $(ECHO) "/* DO NOT. JUST DO NOT. FORGET THIS FILE, IT'S PREPROCESSED, GET THE SOURCE. */" ;\
40 $(AWK) '/^\/\/CUSTOMIZERCUTOFF/ {nextfile} {print}' $^ | $(SED) -Ee 's,^(use|include),//\1,g' \ 42 $(AWK) '/^\/\/CUSTOMIZERCUTOFF/ {nextfile} {print}' $^ | $(SED) -Ee 's,^(use|include),//\1,g' \
41 ) > $@ 43 ) > $@
42 44
43%.stl: %.scad 45%.stl: %.scad
44 ${OPENSCAD_BIN} ${OPENSCAD_FLAGS} -o "$@" "$<" 46 ${OPENSCAD_BIN} ${OPENSCAD_FLAGS} -o "$@" "$<"
diff --git a/another.scad b/another.scad
index fd73a61..83a4e43 100644
--- a/another.scad
+++ b/another.scad
@@ -184,335 +184,362 @@ module the_extruder(
184 hull() { 184 hull() {
185 place_idler() 185 place_idler()
186 cylinder(d=lsd,h=lever_thickness,center=true,$fn=60); 186 cylinder(d=lsd,h=lever_thickness,center=true,$fn=60);
187 translate([mount_d/2,0,0]) 187 translate([mount_d/2,0,0])
188 cylinder(d=lsd,h=lever_thickness,center=true,$fn=60); 188 cylinder(d=lsd,h=lever_thickness,center=true,$fn=60);
189 }//hull 189 }//hull
190 hull() { 190 hull() {
191 translate([mount_d/2,0,0]) 191 translate([mount_d/2,0,0])
192 cylinder(d=lsd,h=lever_thickness,center=true,$fn=60); 192 cylinder(d=lsd,h=lever_thickness,center=true,$fn=60);
193 translate([mount_d/2,-longwing,0]) rotate([0,90,0]) 193 translate([mount_d/2,-longwing,0]) rotate([0,90,0])
194 cylinder(d=lever_thickness,h=lsd,center=true,$fn=60); 194 cylinder(d=lever_thickness,h=lsd,center=true,$fn=60);
195 }//hull 195 }//hull
196 }//union 196 }//union
197 197
198 // filament path 198 // filament path
199 place_idler() 199 place_idler()
200 translate([-idler_d/2-idler_filament_offset,0,0]) 200 translate([-idler_d/2-idler_filament_offset,0,0])
201 rotate([90,0,0]) { 201 rotate([90,0,0]) {
202 mirror([0,1,0]) 202 mirror([0,1,0])
203 teardrop(d=filament_path_d,h=3*gearbox_d,center=true); 203 teardrop(d=filament_path_d,h=3*gearbox_d,center=true);
204 translate([0,0, 204 translate([0,0,
205 sqrt(2)*(mount_d-pulley_d+lsd)/2 205 sqrt(2)*(mount_d-pulley_d+lsd)/2
206 ]) { 206 ]) {
207 cylinder(d1=filament_path_d,d2=2*filament_path_d, 207 cylinder(d1=filament_path_d,d2=2*filament_path_d,
208 h=filament_path_d,$fn=2*filament_path_d*fnd); 208 h=filament_path_d,$fn=2*filament_path_d*fnd);
209 translate([0,0,filament_path_d-epsilon]) 209 translate([0,0,filament_path_d-epsilon])
210 cylinder(d=2*filament_path_d,h=lsd*sqrt(2),$fn=2*filament_path_d*fnd); 210 cylinder(d=2*filament_path_d,h=lsd*sqrt(2),$fn=2*filament_path_d*fnd);
211 }//translate 211 }//translate
212 }//rotate translate place_idler 212 }//rotate translate place_idler
213 213
214 // idler space and mounting hole 214 // idler space and mounting hole
215 place_idler() { 215 place_idler() {
216 cylinder(d=idler_d+idler_clearance*2,h=idler_h+idler_v_tolerance,center=true,$fn=60); 216 cylinder(d=idler_d+idler_clearance*2,h=idler_h+idler_v_tolerance,center=true,$fn=60);
217 cylinder(d=idler_screw_d,h=lever_thickness+2,center=true,$fn=30); 217 cylinder(d=idler_screw_d,h=lever_thickness+2,center=true,$fn=30);
218 translate([0,0,lever_thickness/2-idler_screwhead_h]) 218 translate([0,0,lever_thickness/2-idler_screwhead_h])
219 cylinder(d=idler_screwhead_d,h=idler_screwhead_h+1,$fn=fnd*idler_screwhead_d); 219 cylinder(d=idler_screwhead_d,h=idler_screwhead_h+1,$fn=fnd*idler_screwhead_d);
220 } 220 }
221 // mounting screw hole 221 // mounting screw hole
222 translate([mount_d/2,0,0]) 222 translate([mount_d/2,0,0])
223 cylinder(d=mount_screw_d+mount_screw_d_tolerance,h=lever_thickness+2,center=true,$fn=fnd*mount_screw_d); 223 cylinder(d=mount_screw_d+mount_screw_d_tolerance,h=lever_thickness+2,center=true,$fn=fnd*mount_screw_d);
224 224
225 // lever end 225 // lever end
226 translate([mount_d/2,0,0]) rotate([0,90,0]) { 226 translate([mount_d/2,0,0]) rotate([0,90,0]) {
227 translate([0,-longwing,lsd/2]) finger_indent(d=lever_thickness-1,r=15); 227 translate([0,-longwing,lsd/2]) finger_indent(d=lever_thickness-1,r=15);
228 translate([0,-longwing,0]) 228 translate([0,-longwing,0])
229 mirror([0,0,1]) 229 mirror([0,0,1])
230 difference() { 230 difference() {
231 cylinder(d=spring_d+spring_d_clearance,h=lsd,$fn=fnd*(spring_d+spring_d_clearance)); 231 cylinder(d=spring_d+spring_d_clearance,h=lsd,$fn=fnd*(spring_d+spring_d_clearance));
232 sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4); 232 sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4);
233 } 233 }
234 }//rotate-translate 234 }//rotate-translate
235 }//difference 235 }//difference
236 // bridging patch 236 // bridging patch
237 if(bridges) place_idler() 237 if(bridges) place_idler()
238 translate([0,0,lever_thickness/2-mount_screwhead_h]) 238 translate([0,0,lever_thickness/2-mount_screwhead_h])
239 mirror([0,0,1]) 239 mirror([0,0,1])
240 cylinder(d=mount_screwhead_d,h=layer_height); 240 cylinder(d=mount_screwhead_d,h=layer_height);
241 }//translate 241 }//translate
242 }//lever module 242 }//lever module
243 243
244 module body() { 244 module body() {
245 difference() { 245 difference() {
246 union() { 246 union() {
247 cylinder(d=gearbox_d,h=body_h,$fn=fnd*gearbox_d); 247 cylinder(d=gearbox_d,h=body_h,$fn=fnd*gearbox_d);
248 // spring tensioner part 248 // spring tensioner part
249 translate([-gearbox_d/2,0,0]) hull() { 249 translate([-gearbox_d/2,0,0]) hull() {
250 translate([0,-longwing,ls_z]) 250 translate([0,-longwing,ls_z])
251 rotate([0,90,0]) 251 rotate([0,90,0])
252 cylinder(d=lever_thickness,h=fsw,$fn=fnd*lever_thickness); 252 cylinder(d=lever_thickness,h=fsw,$fn=fnd*lever_thickness);
253 hh=body_h-ls_z; 253 hh=body_h-ls_z;
254 translate([0,0,ls_z]) 254 translate([0,0,ls_z])
255 mirror([0,1,0]) cube(size=[fsw,longwing+(st_split_w+st_split_w_tolerance)/2+st_thickshell,body_h-ls_z]); 255 mirror([0,1,0]) cube(size=[fsw,longwing+(st_split_w+st_split_w_tolerance)/2+st_thickshell,body_h-ls_z]);
256 hhh=ls_z; 256 hhh=ls_z;
257 translate([0,0,0]) 257 translate([0,0,0])
258 mirror([0,1,0]) cube(size=[fsw,longwing-hhh+lever_thickness/sqrt(2),hhh+lever_thickness/2]); 258 mirror([0,1,0]) cube(size=[fsw,longwing-hhh+lever_thickness/sqrt(2),hhh+lever_thickness/2]);
259 }//hull translate 259 }//hull translate
260 260
261 // pushfit bracket 261 // pushfit bracket
262 translate([0,0,filament_elevation]) 262 translate([0,0,filament_elevation])
263 rotate([0,0,45]) translate([pulley_d/2+filament_offset,0,0]) 263 rotate([0,0,45]) translate([pulley_d/2+filament_offset,0,0])
264 rotate([-90,0,0]) 264 rotate([-90,0,0])
265 translate([0,0,pf_offset-gearbox_d/2/*TODO:*/]) { 265 translate([0,0,pf_offset-gearbox_d/2/*TODO:*/]) {
266 pfbl = pf_h(pf)+gearbox_d/2; //TODO: 266 pfbl = pf_h(pf)+gearbox_d/2; //TODO:
267 pfbd = pf_d(pf)+2*pf_shell; 267 pfbd = pf_d(pf)+2*pf_shell;
268 hull() { 268 hull() {
269 cylinder(d=pfbd,h=pfbl,$fn=pfbd*fnd); 269 cylinder(d=pfbd,h=pfbl,$fn=pfbd*fnd);
270 translate([-epsilon/2,0,0]) { 270 translate([-epsilon/2,0,0]) {
271 cube(size=[epsilon,filament_elevation,pfbl-filament_elevation+pfbd/2]); 271 cube(size=[epsilon,filament_elevation,pfbl-filament_elevation+pfbd/2]);
272 mirror([0,1,0]) 272 mirror([0,1,0])
273 cube(size=[epsilon,body_h-filament_elevation,pfbl-body_h+filament_elevation+pfbd/2]); 273 cube(size=[epsilon,body_h-filament_elevation,pfbl-body_h+filament_elevation+pfbd/2]);
274 }//translate 274 }//translate
275 }//hull 275 }//hull
276 }//translate rotate translate rotate translate 276 }//translate rotate translate rotate translate
277 }//union (first child of difference) 277 }//union (first child of difference)
278 278
279 // protrusion 279 // protrusion
280 translate([0,0,-1]) 280 translate([0,0,-1])
281 cylinder(d=protrusion_d+protrusion_tolerance_h,h=protrusion_h+protrusion_tolerance_v+1,$fn=fnd*(protrusion_d+protrusion_tolerance_h)); 281 cylinder(d=protrusion_d+protrusion_tolerance_h,h=protrusion_h+protrusion_tolerance_v+1,$fn=fnd*(protrusion_d+protrusion_tolerance_h));
282 // mount screw holes 282 // mount screw holes
283 for(zr=[0:90:359]) rotate([0,0,zr]) translate([mount_d/2,0,0]) { 283 for(zr=[0:90:359]) rotate([0,0,zr]) translate([mount_d/2,0,0]) {
284 translate([0,0,mount_screw_l-mount_depth-(bridges?layer_height:-epsilon)]) 284 translate([0,0,mount_screw_l-mount_depth-(bridges?layer_height:-epsilon)])
285 mirror([0,0,1]) 285 mirror([0,0,1])
286 cylinder(d=mount_screw_d+mount_screw_d_tolerance, 286 cylinder(d=mount_screw_d+mount_screw_d_tolerance,
287 h=mount_screw_l-mount_depth+1, 287 h=mount_screw_l-mount_depth+1,
288 $fn=fnd*(mount_screw_d+mount_screw_d_tolerance)); 288 $fn=fnd*(mount_screw_d+mount_screw_d_tolerance));
289 translate([0,0,mount_screw_l-mount_depth]) 289 translate([0,0,mount_screw_l-mount_depth])
290 cylinder(d=mount_screwhead_d,h=body_h+1,$fn=fnd*mount_screwhead_d); 290 cylinder(d=mount_screwhead_d,h=body_h+1,$fn=fnd*mount_screwhead_d);
291 }//for 291 }//for
292 // pushfit 292 // pushfit
293 translate([0,0,filament_elevation]) 293 translate([0,0,filament_elevation])
294 rotate([0,0,45]) translate([pulley_d/2+filament_offset,0,0]) 294 rotate([0,0,45]) translate([pulley_d/2+filament_offset,0,0])
295 rotate([-90,0,0]) 295 rotate([-90,0,0])
296 translate([0,0,pf_offset]) 296 translate([0,0,pf_offset])
297 rotate([0,0,180]) { 297 rotate([0,0,180]) {
298 pushfit(pf); 298 pushfit(pf);
299 mirror([0,0,1]) { 299 mirror([0,0,1]) {
300 fh = 1.5* (filament_guide_d-filament_path_d)/2; 300 fh = 1.5* (filament_guide_d-filament_path_d)/2;
301 fo = pf_offset -filament_path_d /*(idler_d+idler_clearance)/2*/-fh; 301 fo = pf_offset -filament_path_d /*(idler_d+idler_clearance)/2*/-fh;
302 translate([0,0,-1]) teardrop(d=filament_guide_d,h=fo/2,angle=225); 302 translate([0,0,-1]) teardrop(d=filament_guide_d,h=fo/2,angle=225);
303 translate([0,0,-1]) teardrop(d=filament_path_d,h=gearbox_d/2+1,angle=-225); 303 translate([0,0,-1]) teardrop(d=filament_path_d,h=gearbox_d/2+1,angle=-225);
304 translate([0,0,fo+epsilon]) 304 translate([0,0,fo+epsilon])
305 cylinder(d1=filament_path_d,d2=filament_guide_d,h=fh,$fn=fnd*filament_guide_d); 305 cylinder(d1=filament_path_d,d2=filament_guide_d,h=fh,$fn=fnd*filament_guide_d);
306 }//mirror 306 }//mirror
307 }//rotate translate rotate translate rotate translate 307 }//rotate translate rotate translate rotate translate
308 // pulley 308 // pulley
309 cylinder(d=pulley_d+pulley_small_d_clearance,h=body_h+1,$fn=fnd*(pulley_d+pulley_d_clearance)); 309 cylinder(d=pulley_d+pulley_small_d_clearance,h=body_h+1,$fn=fnd*(pulley_d+pulley_d_clearance));
310 cylinder(d=pulley_d+pulley_d_clearance,ls_z-max(idler_h,filament_guide_d)/2,$fn=fnd*(pulley_d+pulley_d_clearance)); 310 cylinder(d=pulley_d+pulley_d_clearance,ls_z-max(idler_h,filament_guide_d)/2,$fn=fnd*(pulley_d+pulley_d_clearance));
311 311
312 translate([0,0,ls_z-ls_h/2]) { 312 translate([0,0,ls_z-ls_h/2]) {
313 // idler travel 313 // idler travel
314 translate([mount_d/2,0,0]) 314 translate([mount_d/2,0,0])
315 rotate([0,0,45]) 315 rotate([0,0,45])
316 rotate_extrude(angle=90,$fn=fnr*(shortwing+(idler_d+idler_clearance)/2)) 316 rotate_extrude(angle=90,$fn=fnr*(shortwing+(idler_d+idler_clearance)/2))
317 square([shortwing+(idler_d+idler_clearance)/2,ls_h]); 317 square([shortwing+(idler_d+idler_clearance)/2,ls_h]);
318 // idler itself 318 // idler itself
319 place_idler() 319 place_idler()
320 cylinder(d=idler_d+idler_clearance,h=ls_h,$fn=fnd*(idler_d+idler_clearance)); 320 cylinder(d=idler_d+idler_clearance,h=ls_h,$fn=fnd*(idler_d+idler_clearance));
321 // lever space 321 // lever space
322 rotate([0,0,45]) 322 rotate([0,0,45])
323 rotate_extrude(angle=-135+max(atan(2*fsw/gearbox_d-1),atan(gearbox_d/mount_d-1))) 323 rotate_extrude(angle=-135+max(atan(2*fsw/gearbox_d-1),atan(gearbox_d/mount_d-1)))
324 square([gearbox_d/2+1,ls_h]); 324 square([gearbox_d/2+1,ls_h]);
325 } 325 }
326 326
327 // back side cutout 327 // back side cutout
328 // XXX: this is somewhat ugly and potentially bugged, 328 // XXX: this is somewhat ugly and potentially bugged,
329 // but I want to sleep. 329 // but I want to sleep.
330 a0_ = atan( 330 a0_ = atan(
331 (pf_offset+pf_h(pf)+gearbox_d/2) 331 (pf_offset+pf_h(pf)+gearbox_d/2)
332 / 332 /
333 ( 333 (
334 pulley_d/2+filament_offset- 334 pulley_d/2+filament_offset-
335 (pf_d(pf)+2*pf_shell)/2/cos(30) 335 (pf_d(pf)+2*pf_shell)/2/cos(30)
336 ) 336 )
337 ); 337 );
338 a0 = -135 + ( (a0_>0) ? a0_ : 180+a0_ ); 338 a0 = -135 + ( (a0_>0) ? a0_ : 180+a0_ );
339 a1 = atan((longwing-lever_thickness/2)/(gearbox_d/2)); 339 a1 = atan((longwing-lever_thickness/2)/(gearbox_d/2));
340 translate([0,0,ls_z]) difference() { 340 translate([0,0,ls_z]) difference() {
341 rotate([0,0,-180+a0]) 341 rotate([0,0,-180+a0])
342 rotate_extrude(angle=a1-a0) 342 rotate_extrude(angle=a1-a0)
343 translate([0,-ls_h/2]) 343 translate([0,-ls_h/2])
344 square([sqrt(pow(gearbox_d/2,2)+pow(longwing-lever_thickness/2,2))+1, 344 square([sqrt(pow(gearbox_d/2,2)+pow(longwing-lever_thickness/2,2))+1,
345 ls_h]); 345 ls_h]);
346 translate([-mount_d/2,0,0]) 346 translate([-mount_d/2,0,0])
347 cylinder(d=gearbox_d-mount_d,h=ls_h+2,center=true,$fn=fnd*(gearbox_d-mount_d)); 347 cylinder(d=gearbox_d-mount_d,h=ls_h+2,center=true,$fn=fnd*(gearbox_d-mount_d));
348 }//difference translate 348 }//difference translate
349 349
350 // spring tensioner 350 // spring tensioner
351 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0]) { 351 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0]) {
352 mirror([0,0,1]) { 352 mirror([0,0,1]) {
353 translate([0,0,st_thickshell]) 353 translate([0,0,st_thickshell])
354 hull() for(o=[0,spring_d]) translate([0,-o,0]) 354 hull() for(o=[0,spring_d]) translate([0,-o,0])
355 rotate([0,0,30]) 355 rotate([0,0,30])
356 cylinder(d=st_nut_d+st_nut_d_tolerance,h=st_nut_h+st_nut_h_tolerance,$fn=6); 356 cylinder(d=st_nut_d+st_nut_d_tolerance,h=st_nut_h+st_nut_h_tolerance,$fn=6);
357 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)); 357 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));
358 bigd = spring_d+spring_d_clearance; 358 bigd = spring_d+spring_d_clearance;
359 hf = (bigd-st_screw_d-st_screw_d_tolerance)/2; 359 hf = (bigd-st_screw_d-st_screw_d_tolerance)/2;
360 translate([0,0,st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell-epsilon]) { 360 translate([0,0,st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell-epsilon]) {
361 cylinder(d1=st_screw_d+st_screw_d_tolerance,d2=bigd, 361 cylinder(d1=st_screw_d+st_screw_d_tolerance,d2=bigd,
362 h=hf+epsilon, $fn=fnd*bigd); 362 h=hf+epsilon, $fn=fnd*bigd);
363 translate([0,-(st_split_w+st_split_w_tolerance)/2,0]) hull() { 363 translate([0,-(st_split_w+st_split_w_tolerance)/2,0]) hull() {
364 cube(size=[body_h-ls_z-sp_ch-st_split_w_tolerance,st_split_w+st_split_w_tolerance,fsw+1]); 364 cube(size=[body_h-ls_z-sp_ch-st_split_w_tolerance,st_split_w+st_split_w_tolerance,fsw+1]);
365 translate([0,0,sp_ch+st_split_w_tolerance+1]) 365 translate([0,0,sp_ch+st_split_w_tolerance+1])
366 cube(size=[body_h-ls_z+1,st_split_w+st_split_w_tolerance,fsw+1]); 366 cube(size=[body_h-ls_z+1,st_split_w+st_split_w_tolerance,fsw+1]);
367 } 367 }
368 }//translate 368 }//translate
369 translate([0,0,st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell+hf-epsilon]) 369 translate([0,0,st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell+hf-epsilon])
370 cylinder(d=bigd,h=fsw+1,$fn=fnd*bigd); 370 cylinder(d=bigd,h=fsw+1,$fn=fnd*bigd);
371 }//mirror 371 }//mirror
372 }//translate 372 }//translate
373 373
374 // label 374 // label
375 body_label(); 375 body_label();
376 // scale
377 body_scale();
376 378
377 }//difference 379 }//difference
378 380
379 }//body module 381 }//body module
382 module body_scale() {
383 scale_thickness = 2*layer_height;
384 nscales = 5;
385 x1 = -gearbox_d/2+fsw-st_h+st_w+st_bump*2-st_bump_tip/2;
386 x0 = -gearbox_d/2+st_thickshell+st_nut_h+st_nut_h_tolerance+st_thinshell+st_split_w+st_split_w_tolerance+st_bump_tip/2;
387 w0 = st_split_w+st_split_w_tolerance+2*(extrusion_width+2*extrusion_width);
388 w1 = 2*(longwing-gearbox_d/2-extrusion_width);
389 translate([0,-longwing,body_h-scale_thickness])
390 difference() {
391 for(x=[x0:(x1-x0)/(nscales-1):x1]) let(w=w0+(w1-w0)*(x-x0)/(x1-x0))
392 translate([x-st_bump_tip/2,-w/2,0])
393 cube(size=[st_bump_tip,w,scale_thickness+epsilon]);
394 let(w=st_split_w+st_split_w_tolerance+extrusion_width)
395 translate([-gearbox_d/2,-w/2,-1])
396 cube(size=[fsw,w,scale_thickness+2]);
397 }
398 }
380 module body_label() { 399 module body_label() {
381 if(body_label) { 400 if(body_label) {
382 label=body_label; 401 label=body_label;
383 label_thickness=body_label_thickness; 402 label_thickness=body_label_thickness;
384 label_len = len(label); 403 label_len = len(label);
385 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]; 404 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];
386 translate([0,0,body_h-label_thickness]) 405 translate([0,0,body_h-label_thickness])
387 linear_extrude(height=label_thickness+epsilon,convexity=64) 406 linear_extrude(height=label_thickness+epsilon,convexity=64)
388 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]) 407 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])
389 mirror([left?0:1,0]) 408 mirror([left?0:1,0])
390 text(text=label,size=labelspace.x/label_len,halign="center",valign="center",font="Arial Black"); 409 text(text=label,size=labelspace.x/label_len,halign="center",valign="center",font="Arial Black");
391 }else sphere(d=epsilon); // to avoid makefile breakage 410 }else sphere(d=epsilon); // to avoid makefile breakage
392 } 411 }
393 412
394 st_bump = 4*extrusion_width; 413 st_bump = 4*extrusion_width;
395 st_bump_tip = 2*extrusion_width; 414 st_bump_tip = 2*extrusion_width;
415 st_smalld = st_screw_d+st_screw_d_tolerance+min_xy_shell;
416 st_bigd = spring_d+spring_d_clearance/2;
417 st_hf = (st_bigd-st_smalld)/2;
418 st_h = max(st_hf*3,fsw-st_screw_l+st_hf);
419 st_w = sp_ch;
396 module springpad() { 420 module springpad() {
397 smalld=st_screw_d+st_screw_d_tolerance+min_xy_shell; 421 smalld=st_smalld;
398 bigd = spring_d+spring_d_clearance/2; 422 bigd = st_bigd;
399 hf = (bigd-smalld)/2; 423 hf = st_hf;
400 h = max(hf*3,fsw-st_screw_l+hf); 424 h = st_h;
401 translate([-gearbox_d/2+fsw-h,-longwing,filament_elevation]) 425 translate([-gearbox_d/2+fsw-h,-longwing,filament_elevation])
402 rotate([0,90,0]) difference() { 426 rotate([0,90,0]) difference() {
403 union() { 427 union() {
404 cylinder(d1=smalld,d2=bigd,h=hf,$fn=fnd*bigd); 428 cylinder(d1=smalld,d2=bigd,h=hf,$fn=fnd*bigd);
405 translate([0,0,hf-epsilon]) 429 translate([0,0,hf-epsilon])
406 cylinder(d=bigd,h=h-hf,$fn=fnd*bigd); 430 cylinder(d=bigd,h=h-hf,$fn=fnd*bigd);
407 translate([0,0,h]) 431 translate([0,0,h])
408 sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4); 432 sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4);
409 l = body_h-ls_z; 433 l = body_h-ls_z;
410 w = sp_ch; 434 w = st_w;
411 translate([0,-st_split_w/2,0]) mirror([1,0,0]) { 435 translate([0,-st_split_w/2,0]) mirror([1,0,0]) {
412 hull() { 436 hull() {
413 translate([0,0,w+st_bump]) 437 translate([0,0,w+st_bump])
414 cube(size=[l+st_bump,st_split_w,w]); 438 cube(size=[l+st_bump,st_split_w,w]);
415 cube(size=[l-w,st_split_w,2*w]); 439 cube(size=[l-w,st_split_w,2*w]);
416 } 440 }
417 translate([l,0,w+st_bump]) hull() { 441 translate([l,0,w+st_bump]) hull() {
418 cube(size=[st_split_w,st_split_w,st_bump]); 442 cube(size=[st_split_w,st_split_w,st_bump]);
419 translate([0,-st_bump+st_bump_tip,st_bump]) mirror([0,0,1]) 443 translate([0,-st_bump+st_bump_tip,st_bump]) mirror([0,0,1])
420 cube(size=[st_split_w,st_split_w+2*(st_bump-st_bump_tip),st_bump_tip]); 444 cube(size=[st_split_w,st_split_w+2*(st_bump-st_bump_tip),st_bump_tip]);
421 } 445 }
422 } 446 }
423 } 447 }
424 translate([0,0,-epsilon]) 448 translate([0,0,-epsilon])
425 cylinder(d=st_screw_d+st_screw_d_tolerance, 449 cylinder(d=st_screw_d+st_screw_d_tolerance,
426 h=min(st_screw_l,fsw-hf)-fsw+h+2*epsilon,$fn=fnd*(st_screw_d+st_screw_d_tolerance)); 450 h=min(st_screw_l,fsw-hf)-fsw+h+2*epsilon,$fn=fnd*(st_screw_d+st_screw_d_tolerance));
427 } 451 }
428 } 452 }
429 453
430 module knob() { 454 module knob() {
431 ch = knob_indent_d/2; 455 ch = knob_indent_d/2;
432 knob_bore_l = body_h-protrusion_h-pulley_elevation-pulley_h-knob_v_clearance; 456 knob_bore_l = body_h-protrusion_h-pulley_elevation-pulley_h-knob_v_clearance;
433 translate([0,0,body_h+epsilon]) { 457 translate([0,0,body_h+epsilon]) {
434 mirror([0,0,1]) translate([0,0,-epsilon]) { 458 mirror([0,0,1]) translate([0,0,-epsilon]) {
435 difference() { 459 difference() {
436 cylinder(d=pulley_d,h=knob_bore_l,$fn=fnd*pulley_d); 460 cylinder(d=pulley_d,h=knob_bore_l,$fn=fnd*pulley_d);
437 translate([0,0,-1]) difference() { 461 translate([0,0,-1]) difference() {
438 cylinder(d=bore_d+knob_bore_d_tolerance,h=knob_bore_l+2); 462 cylinder(d=bore_d+knob_bore_d_tolerance,h=knob_bore_l+2);
439 translate([-bore_d/2-1,bore_dd-bore_d/2+knob_bore_d_tolerance/2,-1]) 463 translate([-bore_d/2-1,bore_dd-bore_d/2+knob_bore_d_tolerance/2,-1])
440 cube([bore_d+2,bore_d/2,knob_bore_l+4]); 464 cube([bore_d+2,bore_d/2,knob_bore_l+4]);
441 } 465 }
442 } 466 }
443 } 467 }
444 difference() { 468 difference() {
445 hull() { 469 hull() {
446 cylinder(d=gearbox_d-2*ch,h=knob_h,$fn=fnd*gearbox_d); 470 cylinder(d=gearbox_d-2*ch,h=knob_h,$fn=fnd*gearbox_d);
447 translate([0,0,ch]) 471 translate([0,0,ch])
448 cylinder(d=gearbox_d,h=knob_h-2*ch,$fn=fnd*gearbox_d); 472 cylinder(d=gearbox_d,h=knob_h-2*ch,$fn=fnd*gearbox_d);
449 } 473 }
450 for(a=[0:360/knob_indents:359]) rotate([0,0,a]) 474 for(a=[0:360/knob_indents:359]) rotate([0,0,a])
451 translate([0,gearbox_d/2,-1]) 475 translate([0,gearbox_d/2,-1])
452 cylinder(d=knob_indent_d,h=knob_h+2,$fn=fnd*knob_indent_d); 476 cylinder(d=knob_indent_d,h=knob_h+2,$fn=fnd*knob_indent_d);
453 translate([0,0,-body_h-epsilon]) knob_label(); 477 translate([0,0,-body_h-epsilon]) knob_label();
454 } 478 }
455 } 479 }
456 }//knob module 480 }//knob module
457 module knob_label() { 481 module knob_label() {
458 if(knob_label) { 482 if(knob_label) {
459 ll = len(knob_label); 483 ll = len(knob_label);
460 lsl = gearbox_d-knob_indent_d; 484 lsl = gearbox_d-knob_indent_d;
461 ts = knob_label_size?knob_label_size:min(lsl/ll,gearbox_d/4); 485 ts = knob_label_size?knob_label_size:min(lsl/ll,gearbox_d/4);
462 translate([0,0,body_h+epsilon+knob_h-knob_label_thickness]) 486 translate([0,0,body_h+epsilon+knob_h-knob_label_thickness])
463 linear_extrude(height=knob_label_thickness+epsilon,convexity=64) 487 linear_extrude(height=knob_label_thickness+epsilon,convexity=64)
464 mirror([left?0:1,0]) 488 mirror([left?0:1,0])
465 text(text=knob_label,size=ts,halign="center",valign="center",font="Arial Black"); 489 text(text=knob_label,size=ts,halign="center",valign="center",font="Arial Black");
466 }else sphere(d=epsilon); // to avoid makefile breakage 490 }else sphere(d=epsilon); // to avoid makefile breakage
467 } 491 }
468 492
469 module debug() { 493 module debug() {
470 difference() { 494 difference() {
471 children(); 495 children();
472 if(debug) { 496 if(debug) {
473 // spring tensioner debug cutout 497 // spring tensioner debug cutout
474 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0]) 498 translate([-gearbox_d/2,-longwing,ls_z]) rotate([0,-90,0])
475 translate([0,-lever_thickness/2-1,-gearbox_d-1]) 499 translate([0,-lever_thickness/2-1,-gearbox_d-1])
476 cube(size=[body_h-ls_z+st_bump+1,lever_thickness/2+1,gearbox_d+2]); 500 cube(size=[body_h-ls_z+st_bump+1,lever_thickness/2+1,gearbox_d+2]);
477 // lever axis debug cutout 501 // lever axis debug cutout
478 translate([mount_d/2,0,-1]) 502 translate([mount_d/2,0,-1])
479 rotate([0,0,-45]) 503 rotate([0,0,-45])
480 cube(size=[gearbox_d-mount_d,gearbox_d-mount_d,body_h+knob_h+2]); 504 cube(size=[gearbox_d-mount_d,gearbox_d-mount_d,body_h+knob_h+2]);
481 // idler debug cutout 505 // idler debug cutout
482 translate([0,0,ls_z]) 506 translate([0,0,ls_z])
483 place_idler() 507 place_idler()
484 rotate([0,0,-45]) 508 rotate([0,0,-45])
485 translate([0,0,-lever_thickness/2-epsilon]) 509 translate([0,0,-lever_thickness/2-epsilon])
486 cube(size=[lsd*sqrt(2)/2+1,lsd*sqrt(2)/2+1, 510 cube(size=[lsd*sqrt(2)/2+1,lsd*sqrt(2)/2+1,
487 lever_thickness+2*epsilon]); 511 lever_thickness+2*epsilon]);
488 // pushfit debug cutout 512 // pushfit debug cutout
489 place_idler() 513 place_idler()
490 translate([-idler_d/2+filament_offset,0,ls_z]) 514 translate([-idler_d/2+filament_offset,0,ls_z])
491 cube(size=[gearbox_d/2,gearbox_d/2+pf_h(pf),body_h-ls_z+knob_h+1]); 515 cube(size=[gearbox_d/2,gearbox_d/2+pf_h(pf),body_h-ls_z+knob_h+1]);
492 }//if debug 516 }//if debug
493 }//difference 517 }//difference
494 } 518 }
495 519
496 mirrorleft() 520 mirrorleft()
497 debug() 521 debug()
498 if(what=="lever") color("green",0.7) lever(); 522 if(what=="lever") color("green",0.7) lever();
499 else if(what=="body") color("yellow",0.7) body(); 523 else if(what=="body") color("yellow",0.7) body();
500 else if(what=="body.label") color("brown",0.7) body_label(); 524 else if(what=="body.label") color("brown",0.7) body_label();
525 else if(what=="body.scale") color("brown",0.7) body_scale();
501 else if(what=="knob") color("red",0.7) knob(); 526 else if(what=="knob") color("red",0.7) knob();
502 else if(what=="knob.label") color("brown",0.7) knob_label(); 527 else if(what=="knob.label") color("brown",0.7) knob_label();
503 else if(what=="springpad") color("blue",0.7) springpad(); 528 else if(what=="springpad") color("blue",0.7) springpad();
504 else if(what=="both") { 529 else if(what=="both") {
505 color("green",0.7) lever(); 530 color("green",0.7) lever();
506 color("yellow",0.7) body(); 531 color("yellow",0.7) body();
507 color("brown",0.7) body_label(); 532 color("brown",0.7) body_label();
533 color("brown",0.7) body_scale();
508 }else{ 534 }else{
509 color("green",0.7) lever(); 535 color("green",0.7) lever();
510 color("yellow",0.7) body(); 536 color("yellow",0.7) body();
511 color("brown",0.7) body_label(); 537 color("brown",0.7) body_label();
538 color("brown",0.7) body_scale();
512 color("red",0.7) knob(); 539 color("red",0.7) knob();
513 color("brown",0.7) knob_label(); 540 color("brown",0.7) knob_label();
514 color("blue",0.7) springpad(); 541 color("blue",0.7) springpad();
515 } 542 }
516} 543}
517 544
518the_extruder(what="*",left=false,debug=true); 545the_extruder(what="*",left=false,debug=true);