author | Michael Krelin <hacker@klever.net> | 2016-01-06 23:45:43 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2016-01-06 23:45:43 (UTC) |
commit | 70e08848566d909a76fa3f611d35570c57f8e048 (patch) (unidiff) | |
tree | 721d2ab3c42a5bf515286963b316ad7cdcd13048 | |
parent | f669f3d2881597cc0d86e4b55332b541883c8205 (diff) | |
download | redelta-70e08848566d909a76fa3f611d35570c57f8e048.zip redelta-70e08848566d909a76fa3f611d35570c57f8e048.tar.gz redelta-70e08848566d909a76fa3f611d35570c57f8e048.tar.bz2 |
move parameters around
-rw-r--r-- | delta.jscad | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/delta.jscad b/delta.jscad index ef0d4ec..9941125 100644 --- a/delta.jscad +++ b/delta.jscad | |||
@@ -412,119 +412,96 @@ var EFFECTOR = { | |||
412 | )).rotateY(90).translate([-fh.w/2,0,0]) | 412 | )).rotateY(90).translate([-fh.w/2,0,0]) |
413 | ).subtract( CSG.cylinder({ | 413 | ).subtract( CSG.cylinder({ |
414 | start: [-fh.w,-fh.r,-od/2], | 414 | start: [-fh.w,-fh.r,-od/2], |
415 | end: [fh.w,-fh.r,-od/2], | 415 | end: [fh.w,-fh.r,-od/2], |
416 | radius: fh.screw.d/2 | 416 | radius: fh.screw.d/2 |
417 | })).subtract( CSG.cylinder({ | 417 | })).subtract( CSG.cylinder({ |
418 | start: [0,-this.rmount,1], | 418 | start: [0,-this.rmount,1], |
419 | end: [0,-this.rmount,-fh.w-1], | 419 | end: [0,-this.rmount,-fh.w-1], |
420 | radius: fh.screw.d/2 | 420 | radius: fh.screw.d/2 |
421 | })).setColor([0.3,0.8,0.3,0.9]).rotateZ(-120); | 421 | })).setColor([0.3,0.8,0.3,0.9]).rotateZ(-120); |
422 | } | 422 | } |
423 | }; | 423 | }; |
424 | 424 | ||
425 | function columns() { | 425 | function columns() { |
426 | var rv = [0,1,2].map(function(x) { | 426 | var rv = [0,1,2].map(function(x) { |
427 | return union(vector_char(0,0,String.fromCharCode('A'.charCodeAt(0)+x)).segments.map(function(x) { | 427 | return union(vector_char(0,0,String.fromCharCode('A'.charCodeAt(0)+x)).segments.map(function(x) { |
428 | return rectangular_extrude(x,{w:2,h:1}); | 428 | return rectangular_extrude(x,{w:2,h:1}); |
429 | })).center().rotateX(90).translate([0,50,0]).rotateZ(x*120+120); | 429 | })).center().rotateX(90).translate([0,50,0]).rotateZ(x*120+120); |
430 | }); | 430 | }); |
431 | return union(rv); | 431 | return union(rv); |
432 | } | 432 | } |
433 | 433 | ||
434 | function microswitch() { | 434 | function microswitch() { |
435 | var screw_connector = new CSG.Properties(); | 435 | var screw_connector = new CSG.Properties(); |
436 | var rv = CSG.cube({ center:[0,0,2.5],radius: [19.8/2,6/2,10/2] }).union( | 436 | var rv = CSG.cube({ center:[0,0,2.5],radius: [19.8/2,6/2,10/2] }).union( |
437 | CSG.cube({ center: [2.5,0.5,6], radius: [2/2,3.5/2,5/2] }) | 437 | CSG.cube({ center: [2.5,0.5,6], radius: [2/2,3.5/2,5/2] }) |
438 | ).union( | 438 | ).union( |
439 | [-8,-1,8].map(function(x) { | 439 | [-8,-1,8].map(function(x) { |
440 | return CSG.cube({ center:[x,0,0], radius: [0.6/2,3.2/2,13/2] }) | 440 | return CSG.cube({ center:[x,0,0], radius: [0.6/2,3.2/2,13/2] }) |
441 | }) | 441 | }) |
442 | ).subtract( | 442 | ).subtract( |
443 | [-9.5/2,9.5/2].map(function(x,i) { | 443 | [-9.5/2,9.5/2].map(function(x,i) { |
444 | screw_connector[i] = new CSG.Connector([x,6/2,0],[0,-1,0],[0,0,1]); | 444 | screw_connector[i] = new CSG.Connector([x,6/2,0],[0,-1,0],[0,0,1]); |
445 | return CSG.cylinder({ | 445 | return CSG.cylinder({ |
446 | start: [x,-4,0], end: [x,4,0], | 446 | start: [x,-4,0], end: [x,4,0], |
447 | radius: 2/2 | 447 | radius: 2/2 |
448 | }) | 448 | }) |
449 | }) | 449 | }) |
450 | ); | 450 | ); |
451 | rv.properties.switch_connector = new CSG.Connector([2.5,0.5,6+5/2],[0,0,1],[0,-1,0]); | 451 | rv.properties.switch_connector = new CSG.Connector([2.5,0.5,6+5/2],[0,0,1],[0,-1,0]); |
452 | rv.properties.screw_connector = screw_connector; | 452 | rv.properties.screw_connector = screw_connector; |
453 | rv.properties.microswitch = new CSG.Properties(); | 453 | rv.properties.microswitch = new CSG.Properties(); |
454 | rv.properties.microswitch.size = new CSG.Vector3D( | 454 | rv.properties.microswitch.size = new CSG.Vector3D( |
455 | 19.8,6,10 | 455 | 19.8,6,10 |
456 | ); | 456 | ); |
457 | return rv; | 457 | return rv; |
458 | } | 458 | } |
459 | 459 | ||
460 | function getParameterDefinitions() { | ||
461 | return [{ | ||
462 | name: 'part', | ||
463 | type: 'choice', | ||
464 | values: [ | ||
465 | 'platform', | ||
466 | 'hinged', | ||
467 | 'clamp', | ||
468 | 'fanholder', | ||
469 | 'alltogethernow' | ||
470 | ], | ||
471 | captions: [ | ||
472 | 'Effector platform', | ||
473 | 'Hinged part', | ||
474 | 'Clamp', | ||
475 | 'Fan holder', | ||
476 | 'All together now!' | ||
477 | ], | ||
478 | caption: 'Part', | ||
479 | initial: 'alltogethernow' | ||
480 | }]; | ||
481 | } | ||
482 | |||
483 | var FOURWINDS = [0,90,180,270]; | 460 | var FOURWINDS = [0,90,180,270]; |
484 | 461 | ||
485 | var E2020 = { | 462 | var E2020 = { |
486 | outer: 20, thickness: 1.8, | 463 | outer: 20, thickness: 1.8, |
487 | roundius: 1, centerhole: 5, | 464 | roundius: 1, centerhole: 5, |
488 | slot_width: 6, | 465 | slot_width: 6, |
489 | T: { width: 10, thickness: 1.5, depth: 6.5 }, | 466 | T: { width: 10, thickness: 1.5, depth: 6.5 }, |
490 | 467 | ||
491 | extrusion: function(o) { | 468 | extrusion: function(o) { |
492 | if(!o) o = {}; | 469 | if(!o) o = {}; |
493 | var e = o.extrusion || this; | 470 | var e = o.extrusion || this; |
494 | var l = o.l||5; | 471 | var l = o.l||5; |
495 | var iy = e.outer/2-e.T.depth; | 472 | var iy = e.outer/2-e.T.depth; |
496 | var ix = e.T.width/2-(e.outer/2-iy-e.thickness-e.T.thickness); | 473 | var ix = e.T.width/2-(e.outer/2-iy-e.thickness-e.T.thickness); |
497 | var rv = CAG.roundedRectangle({ | 474 | var rv = CAG.roundedRectangle({ |
498 | corner1: [-e.outer/2,-e.outer/2], corner2: [e.outer/2,e.outer/2], | 475 | corner1: [-e.outer/2,-e.outer/2], corner2: [e.outer/2,e.outer/2], |
499 | roundradius: e.roundius | 476 | roundradius: e.roundius |
500 | }).subtract( | 477 | }).subtract( |
501 | FOURWINDS.map(function(w) { | 478 | FOURWINDS.map(function(w) { |
502 | return CAG.fromPoints([ | 479 | return CAG.fromPoints([ |
503 | [ e.slot_width/2,e.outer/2+1], | 480 | [ e.slot_width/2,e.outer/2+1], |
504 | [ e.slot_width/2,e.outer/2-e.thickness], | 481 | [ e.slot_width/2,e.outer/2-e.thickness], |
505 | [ e.T.width/2,e.outer/2-e.thickness], | 482 | [ e.T.width/2,e.outer/2-e.thickness], |
506 | [ e.T.width/2,e.outer/2-e.thickness-e.T.thickness], | 483 | [ e.T.width/2,e.outer/2-e.thickness-e.T.thickness], |
507 | [ ix, iy ], | 484 | [ ix, iy ], |
508 | [ -ix, iy ], | 485 | [ -ix, iy ], |
509 | [ -e.T.width/2,e.outer/2-e.thickness-e.T.thickness], | 486 | [ -e.T.width/2,e.outer/2-e.thickness-e.T.thickness], |
510 | [ -e.T.width/2,e.outer/2-e.thickness], | 487 | [ -e.T.width/2,e.outer/2-e.thickness], |
511 | [ -e.slot_width/2,e.outer/2-e.thickness], | 488 | [ -e.slot_width/2,e.outer/2-e.thickness], |
512 | [ -e.slot_width/2,e.outer/2+1], | 489 | [ -e.slot_width/2,e.outer/2+1], |
513 | ]).rotateZ(w); | 490 | ]).rotateZ(w); |
514 | }) | 491 | }) |
515 | ).subtract(CAG.circle({ | 492 | ).subtract(CAG.circle({ |
516 | center: [0,0], radius: e.centerhole/2 | 493 | center: [0,0], radius: e.centerhole/2 |
517 | })).extrude({offset:[0,0,l]}); | 494 | })).extrude({offset:[0,0,l]}); |
518 | rv.properties.c_top=rv.properties.c_left | 495 | rv.properties.c_top=rv.properties.c_left |
519 | = new CSG.Connector([0,0,l],[0,0,-1],[1,0,0]); | 496 | = new CSG.Connector([0,0,l],[0,0,-1],[1,0,0]); |
520 | rv.properties.c_bottom=rv.properties.c_right | 497 | rv.properties.c_bottom=rv.properties.c_right |
521 | = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 498 | = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
522 | rv.properties.c_midway = new CSG.Connector([0,0,l/2],[0,0,1],[1,0,0]); | 499 | rv.properties.c_midway = new CSG.Connector([0,0,l/2],[0,0,1],[1,0,0]); |
523 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 500 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
524 | rv.properties.vitamin = true; | 501 | rv.properties.vitamin = true; |
525 | return rv; | 502 | return rv; |
526 | }, | 503 | }, |
527 | 504 | ||
528 | cap: function extrusion_cap(o) { | 505 | cap: function extrusion_cap(o) { |
529 | if(!o) o = {}; | 506 | if(!o) o = {}; |
530 | var e = o.extrusion || this; | 507 | var e = o.extrusion || this; |
@@ -575,50 +552,75 @@ function base_extrusions() { | |||
575 | function refaxes(o) { | 552 | function refaxes(o) { |
576 | if(!o) o = {}; | 553 | if(!o) o = {}; |
577 | var l = o.l||20, g = o.g||0.7; | 554 | var l = o.l||20, g = o.g||0.7; |
578 | return union([ | 555 | return union([ |
579 | CSG.cylinder({start:[0,0,0],end:[l,0,0]}).setColor([1,0,0,g]), | 556 | CSG.cylinder({start:[0,0,0],end:[l,0,0]}).setColor([1,0,0,g]), |
580 | CSG.cylinder({start:[0,0,0],end:[0,l,0]}).setColor([0,1,0,g]), | 557 | CSG.cylinder({start:[0,0,0],end:[0,l,0]}).setColor([0,1,0,g]), |
581 | CSG.cylinder({start:[0,0,0],end:[0,0,l]}).setColor([0,0,1,g]) | 558 | CSG.cylinder({start:[0,0,0],end:[0,0,l]}).setColor([0,0,1,g]) |
582 | ]); | 559 | ]); |
583 | } | 560 | } |
584 | 561 | ||
585 | function P(x) { | 562 | function P(x) { |
586 | return x.connectTo(x.properties.P,new CSG.Connector([0,0,0],[0,0,1],[1,0,0]), false, 0); | 563 | return x.connectTo(x.properties.P,new CSG.Connector([0,0,0],[0,0,1],[1,0,0]), false, 0); |
587 | } | 564 | } |
588 | 565 | ||
589 | function main(params) { | 566 | function main(params) { |
590 | return refaxes().union(P(base_extrusions())); | 567 | return refaxes().union(P(base_extrusions())); |
591 | } | 568 | } |
592 | 569 | ||
593 | function _main(params) { | 570 | function _main(params) { |
594 | var e = EFFECTOR.effector(); | 571 | var e = EFFECTOR.effector(); |
595 | var hs = E3DV6.heatsink(); | 572 | var hs = E3DV6.heatsink(); |
596 | hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0); | 573 | hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0); |
597 | var ms = microswitch(); | 574 | var ms = microswitch(); |
598 | var hd = EFFECTOR.hinged({ | 575 | var hd = EFFECTOR.hinged({ |
599 | microswitch:ms,effector:e | 576 | microswitch:ms,effector:e |
600 | }); | 577 | }); |
601 | ms = ms.connectTo( | 578 | ms = ms.connectTo( |
602 | ms.properties.screw_connector[0], | 579 | ms.properties.screw_connector[0], |
603 | hd.properties.microswitch_screw_connector[0], | 580 | hd.properties.microswitch_screw_connector[0], |
604 | false, 0); | 581 | false, 0); |
605 | var hdhd = EFFECTOR.split_hinged(hd); | 582 | var hdhd = EFFECTOR.split_hinged(hd); |
606 | var fh = EFFECTOR.fanholder(); | 583 | var fh = EFFECTOR.fanholder(); |
607 | return union({ | 584 | return union({ |
608 | platform: e, | 585 | platform: e, |
609 | hinged: hdhd[1], | 586 | hinged: hdhd[1], |
610 | clamp: hdhd[0], | 587 | clamp: hdhd[0], |
611 | fanholder: fh, | 588 | fanholder: fh, |
612 | alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh] | 589 | alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh] |
613 | }[params.part||'alltogethernow']) | 590 | }[params.part||'alltogethernow']) |
614 | var rv = union( | 591 | var rv = union( |
615 | e, | 592 | e, |
616 | hs, | 593 | hs, |
617 | columns(), | 594 | columns(), |
618 | ///hd, | 595 | ///hd, |
619 | hdhd[0], hdhd[1], | 596 | hdhd[0], hdhd[1], |
620 | ms); | 597 | ms); |
621 | return rv; | 598 | return rv; |
622 | } | 599 | } |
623 | /* vim:set ft=javascript ai: */ | ||
624 | 600 | ||
601 | function getParameterDefinitions() { | ||
602 | return [{ | ||
603 | name: 'part', | ||
604 | type: 'choice', | ||
605 | values: [ | ||
606 | 'platform', | ||
607 | 'hinged', | ||
608 | 'clamp', | ||
609 | 'fanholder', | ||
610 | 'alltogethernow', | ||
611 | 'wip' | ||
612 | ], | ||
613 | captions: [ | ||
614 | 'Effector platform', | ||
615 | 'Hinged part', | ||
616 | 'Clamp', | ||
617 | 'Fan holder', | ||
618 | 'All together now!', | ||
619 | 'Work in progress' | ||
620 | ], | ||
621 | caption: 'Part', | ||
622 | initial: 'wip' | ||
623 | }]; | ||
624 | } | ||
625 | |||
626 | /* vim:set ft=javascript ai: */ | ||