summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2016-01-06 21:38:22 (UTC)
committer Michael Krelin <hacker@klever.net>2016-01-06 21:38:22 (UTC)
commitbfc4a5d491d06a2300915abd3eb356c5656611ee (patch) (unidiff)
treec7abe2f15a291cdacb3fc88c398bba0b429e55b4
parent1822646c471df79f4a97ae6cae7d328917503b47 (diff)
downloadredelta-bfc4a5d491d06a2300915abd3eb356c5656611ee.zip
redelta-bfc4a5d491d06a2300915abd3eb356c5656611ee.tar.gz
redelta-bfc4a5d491d06a2300915abd3eb356c5656611ee.tar.bz2
four winds
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--delta.jscad1
1 files changed, 1 insertions, 0 deletions
diff --git a/delta.jscad b/delta.jscad
index 489e20d..7c6f35f 100644
--- a/delta.jscad
+++ b/delta.jscad
@@ -356,128 +356,129 @@ var EFFECTOR = {
356 }); 356 });
357 return rv.setColor([0.3,0.8,0.3,0.9]); 357 return rv.setColor([0.3,0.8,0.3,0.9]);
358 }, 358 },
359 split_hinged: function effector_split_hinged(hinged) { 359 split_hinged: function effector_split_hinged(hinged) {
360 var e = CONFIG.effector; 360 var e = CONFIG.effector;
361 var b = hinged.getBounds(); 361 var b = hinged.getBounds();
362 var ymax = Math.max(Math.abs(b[0].y),Math.abs(b[1].y)); 362 var ymax = Math.max(Math.abs(b[0].y),Math.abs(b[1].y));
363 var zmax = Math.max(b[0].z,b[1].z); 363 var zmax = Math.max(b[0].z,b[1].z);
364 return [-1,1].map(function(s) { 364 return [-1,1].map(function(s) {
365 return hinged.intersect(CSG.cube({ 365 return hinged.intersect(CSG.cube({
366 corner1: [Math.min(b[0].x,b[1].x)-1,s*e.clamp.split/2,-zmax-1], 366 corner1: [Math.min(b[0].x,b[1].x)-1,s*e.clamp.split/2,-zmax-1],
367 corner2: [Math.max(b[0].x,b[1].x)+1,s*(ymax+1),zmax+1] 367 corner2: [Math.max(b[0].x,b[1].x)+1,s*(ymax+1),zmax+1]
368 })); 368 }));
369 }); 369 });
370 }, 370 },
371 fanholder: function effector_fanholder() { 371 fanholder: function effector_fanholder() {
372 var fh = CONFIG.effector.fanholder; 372 var fh = CONFIG.effector.fanholder;
373 var od = fh.screw.d+2*fh.screw.m; 373 var od = fh.screw.d+2*fh.screw.m;
374 return linear_extrude({height:fh.w},hull( 374 return linear_extrude({height:fh.w},hull(
375 CAG.circle({center:[0,-this.rmount],radius:od/2}), 375 CAG.circle({center:[0,-this.rmount],radius:od/2}),
376 CAG.circle({center:[0,-fh.r+od/2+fh.w/2],radius:fh.w/2}) 376 CAG.circle({center:[0,-fh.r+od/2+fh.w/2],radius:fh.w/2})
377 )).translate([0,0,-fh.w]).union( 377 )).translate([0,0,-fh.w]).union(
378 linear_extrude({height:fh.w},hull( 378 linear_extrude({height:fh.w},hull(
379 CAG.circle({center:[fh.w/2,-this.rmount-od/2-fh.w/2],radius:fh.w/2}), 379 CAG.circle({center:[fh.w/2,-this.rmount-od/2-fh.w/2],radius:fh.w/2}),
380 CAG.circle({center:[od/2,-fh.r],radius:od/2}) 380 CAG.circle({center:[od/2,-fh.r],radius:od/2})
381 )).rotateY(90).translate([-fh.w/2,0,0]) 381 )).rotateY(90).translate([-fh.w/2,0,0])
382 ).subtract( CSG.cylinder({ 382 ).subtract( CSG.cylinder({
383 start: [-fh.w,-fh.r,-od/2], 383 start: [-fh.w,-fh.r,-od/2],
384 end: [fh.w,-fh.r,-od/2], 384 end: [fh.w,-fh.r,-od/2],
385 radius: fh.screw.d/2 385 radius: fh.screw.d/2
386 })).subtract( CSG.cylinder({ 386 })).subtract( CSG.cylinder({
387 start: [0,-this.rmount,1], 387 start: [0,-this.rmount,1],
388 end: [0,-this.rmount,-fh.w-1], 388 end: [0,-this.rmount,-fh.w-1],
389 radius: fh.screw.d/2 389 radius: fh.screw.d/2
390 })).setColor([0.3,0.8,0.3,0.9]).rotateZ(-120); 390 })).setColor([0.3,0.8,0.3,0.9]).rotateZ(-120);
391 } 391 }
392}; 392};
393 393
394function columns() { 394function columns() {
395 var rv = [0,1,2].map(function(x) { 395 var rv = [0,1,2].map(function(x) {
396 return union(vector_char(0,0,String.fromCharCode('A'.charCodeAt(0)+x)).segments.map(function(x) { 396 return union(vector_char(0,0,String.fromCharCode('A'.charCodeAt(0)+x)).segments.map(function(x) {
397 return rectangular_extrude(x,{w:2,h:1}); 397 return rectangular_extrude(x,{w:2,h:1});
398 })).center().rotateX(90).translate([0,50,0]).rotateZ(x*120+120); 398 })).center().rotateX(90).translate([0,50,0]).rotateZ(x*120+120);
399 }); 399 });
400 return union(rv); 400 return union(rv);
401} 401}
402 402
403function microswitch() { 403function microswitch() {
404 var screw_connector = new CSG.Properties(); 404 var screw_connector = new CSG.Properties();
405 var rv = CSG.cube({ center:[0,0,2.5],radius: [19.8/2,6/2,10/2] }).union( 405 var rv = CSG.cube({ center:[0,0,2.5],radius: [19.8/2,6/2,10/2] }).union(
406 CSG.cube({ center: [2.5,0.5,6], radius: [2/2,3.5/2,5/2] }) 406 CSG.cube({ center: [2.5,0.5,6], radius: [2/2,3.5/2,5/2] })
407 ).union( 407 ).union(
408 [-8,-1,8].map(function(x) { 408 [-8,-1,8].map(function(x) {
409 return CSG.cube({ center:[x,0,0], radius: [0.6/2,3.2/2,13/2] }) 409 return CSG.cube({ center:[x,0,0], radius: [0.6/2,3.2/2,13/2] })
410 }) 410 })
411 ).subtract( 411 ).subtract(
412 [-9.5/2,9.5/2].map(function(x,i) { 412 [-9.5/2,9.5/2].map(function(x,i) {
413 screw_connector[i] = new CSG.Connector([x,6/2,0],[0,-1,0],[0,0,1]); 413 screw_connector[i] = new CSG.Connector([x,6/2,0],[0,-1,0],[0,0,1]);
414 return CSG.cylinder({ 414 return CSG.cylinder({
415 start: [x,-4,0], end: [x,4,0], 415 start: [x,-4,0], end: [x,4,0],
416 radius: 2/2 416 radius: 2/2
417 }) 417 })
418 }) 418 })
419 ); 419 );
420 rv.properties.switch_connector = new CSG.Connector([2.5,0.5,6+5/2],[0,0,1],[0,-1,0]); 420 rv.properties.switch_connector = new CSG.Connector([2.5,0.5,6+5/2],[0,0,1],[0,-1,0]);
421 rv.properties.screw_connector = screw_connector; 421 rv.properties.screw_connector = screw_connector;
422 rv.properties.microswitch = new CSG.Properties(); 422 rv.properties.microswitch = new CSG.Properties();
423 rv.properties.microswitch.size = new CSG.Vector3D( 423 rv.properties.microswitch.size = new CSG.Vector3D(
424 19.8,6,10 424 19.8,6,10
425 ); 425 );
426 return rv; 426 return rv;
427} 427}
428 428
429function getParameterDefinitions() { 429function getParameterDefinitions() {
430 return [{ 430 return [{
431 name: 'part', 431 name: 'part',
432 type: 'choice', 432 type: 'choice',
433 values: [ 433 values: [
434 'platform', 434 'platform',
435 'hinged', 435 'hinged',
436 'clamp', 436 'clamp',
437 'fanholder', 437 'fanholder',
438 'alltogethernow' 438 'alltogethernow'
439 ], 439 ],
440 captions: [ 440 captions: [
441 'Effector platform', 441 'Effector platform',
442 'Hinged part', 442 'Hinged part',
443 'Clamp', 443 'Clamp',
444 'Fan holder', 444 'Fan holder',
445 'All together now!' 445 'All together now!'
446 ], 446 ],
447 caption: 'Part', 447 caption: 'Part',
448 initial: 'alltogethernow' 448 initial: 'alltogethernow'
449 }]; 449 }];
450} 450}
451 451
452var FOURWINDS = [0,90,180,270];
452function main(params) { 453function main(params) {
453 var e = EFFECTOR.effector(); 454 var e = EFFECTOR.effector();
454 var hs = E3DV6.heatsink(); 455 var hs = E3DV6.heatsink();
455 hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0); 456 hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0);
456 var ms = microswitch(); 457 var ms = microswitch();
457 var hd = EFFECTOR.hinged({ 458 var hd = EFFECTOR.hinged({
458 microswitch:ms,effector:e 459 microswitch:ms,effector:e
459 }); 460 });
460 ms = ms.connectTo( 461 ms = ms.connectTo(
461 ms.properties.screw_connector[0], 462 ms.properties.screw_connector[0],
462 hd.properties.microswitch_screw_connector[0], 463 hd.properties.microswitch_screw_connector[0],
463 false, 0); 464 false, 0);
464 var hdhd = EFFECTOR.split_hinged(hd); 465 var hdhd = EFFECTOR.split_hinged(hd);
465 var fh = EFFECTOR.fanholder(); 466 var fh = EFFECTOR.fanholder();
466 return union({ 467 return union({
467 platform: e, 468 platform: e,
468 hinged: hdhd[1], 469 hinged: hdhd[1],
469 clamp: hdhd[0], 470 clamp: hdhd[0],
470 fanholder: fh, 471 fanholder: fh,
471 alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh] 472 alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh]
472 }[params.part||'alltogethernow']) 473 }[params.part||'alltogethernow'])
473 var rv = union( 474 var rv = union(
474 e, 475 e,
475 hs, 476 hs,
476 columns(), 477 columns(),
477 ///hd, 478 ///hd,
478 hdhd[0], hdhd[1], 479 hdhd[0], hdhd[1],
479 ms); 480 ms);
480 return rv; 481 return rv;
481} 482}
482/* vim:set ft=javascript ai: */ 483/* vim:set ft=javascript ai: */
483 484