summaryrefslogtreecommitdiffabout
path: root/delta.jscad
authorMichael Krelin <hacker@klever.net>2016-01-06 23:46:44 (UTC)
committer Michael Krelin <hacker@klever.net>2016-01-06 23:46:44 (UTC)
commit740c971a9ebf663765e91eb84e2251d303ea4ceb (patch) (unidiff)
tree8ff1127eaaf754b37d74a13a19fc8f7f7090f301 /delta.jscad
parent4cb92354224641376d311adc7589ebb4bdc5639d (diff)
downloadredelta-740c971a9ebf663765e91eb84e2251d303ea4ceb.zip
redelta-740c971a9ebf663765e91eb84e2251d303ea4ceb.tar.gz
redelta-740c971a9ebf663765e91eb84e2251d303ea4ceb.tar.bz2
part selection machinery
Diffstat (limited to 'delta.jscad') (more/less context) (ignore whitespace changes)
-rw-r--r--delta.jscad12
1 files changed, 11 insertions, 1 deletions
diff --git a/delta.jscad b/delta.jscad
index b3bb3d3..5d40e26 100644
--- a/delta.jscad
+++ b/delta.jscad
@@ -569,66 +569,76 @@ function duet() {
569 holes.push(CSG.cylinder({start:[_x,_y,-1],end:[_x,_y,C.pcb_size.z+1],radius:3/2})); 569 holes.push(CSG.cylinder({start:[_x,_y,-1],end:[_x,_y,C.pcb_size.z+1],radius:3/2}));
570 pholes['c_'+w] = new CSG.Connector([_x,_y,0],[0,0,1],[1,0,0]); 570 pholes['c_'+w] = new CSG.Connector([_x,_y,0],[0,0,1],[1,0,0]);
571 } 571 }
572 rv = CSG.cube({ 572 rv = CSG.cube({
573 corner1: [-C.pcb_size.x/2, -C.pcb_size.y/2, 0], 573 corner1: [-C.pcb_size.x/2, -C.pcb_size.y/2, 0],
574 corner2: [ C.pcb_size.x/2, C.pcb_size.y/2, C.pcb_size.z] 574 corner2: [ C.pcb_size.x/2, C.pcb_size.y/2, C.pcb_size.z]
575 }).subtract(holes).setColor(CONFIG.color.pcb).union( 575 }).subtract(holes).setColor(CONFIG.color.pcb).union(
576 CSG.cube({ 576 CSG.cube({
577 corner1: [-C.pcb_size.x/2,-C.hole_spacing.y/2+3,C.pcb_size.z], 577 corner1: [-C.pcb_size.x/2,-C.hole_spacing.y/2+3,C.pcb_size.z],
578 corner2: [ C.pcb_size.x/2, C.hole_spacing.y/2-3,C.h] 578 corner2: [ C.pcb_size.x/2, C.hole_spacing.y/2-3,C.h]
579 }).setColor(CONFIG.color.bulk) 579 }).setColor(CONFIG.color.bulk)
580 ); 580 );
581 rv.properties.holes = pholes; 581 rv.properties.holes = pholes;
582 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); 582 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
583 rv.properties.vitamin = true; 583 rv.properties.vitamin = true;
584 return rv; 584 return rv;
585} 585}
586 586
587function refaxes(o) { 587function refaxes(o) {
588 if(!o) o = {}; 588 if(!o) o = {};
589 var l = o.l||20, g = o.g||0.7; 589 var l = o.l||20, g = o.g||0.7;
590 return union([ 590 return union([
591 CSG.cylinder({start:[0,0,0],end:[l,0,0]}).setColor([1,0,0,g]), 591 CSG.cylinder({start:[0,0,0],end:[l,0,0]}).setColor([1,0,0,g]),
592 CSG.cylinder({start:[0,0,0],end:[0,l,0]}).setColor([0,1,0,g]), 592 CSG.cylinder({start:[0,0,0],end:[0,l,0]}).setColor([0,1,0,g]),
593 CSG.cylinder({start:[0,0,0],end:[0,0,l]}).setColor([0,0,1,g]) 593 CSG.cylinder({start:[0,0,0],end:[0,0,l]}).setColor([0,0,1,g])
594 ]); 594 ]);
595} 595}
596 596
597function P(x) { 597function P(x) {
598 return x.connectTo(x.properties.P,new CSG.Connector([0,0,0],[0,0,1],[1,0,0]), false, 0); 598 return x.connectTo(x.properties.P,new CSG.Connector([0,0,0],[0,0,1],[1,0,0]), false, 0);
599} 599}
600 600
601var PARTS = {
602 wip: function(params) {
603 return union(base_extrusions(),column_extrusions(),duet());
604 }
605};
606
601function main(params) { 607function main(params) {
602 return refaxes().union(P(base_extrusions())); 608 var part = params.part && PARTS[params.part];
609 if(!part) return refaxes();
610 var rv = P(part(params));
611 if(true) rv = rv.union(refaxes());
612 return rv;
603} 613}
604 614
605function _main(params) { 615function _main(params) {
606 var e = EFFECTOR.effector(); 616 var e = EFFECTOR.effector();
607 var hs = E3DV6.heatsink(); 617 var hs = E3DV6.heatsink();
608 hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0); 618 hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0);
609 var ms = microswitch(); 619 var ms = microswitch();
610 var hd = EFFECTOR.hinged({ 620 var hd = EFFECTOR.hinged({
611 microswitch:ms,effector:e 621 microswitch:ms,effector:e
612 }); 622 });
613 ms = ms.connectTo( 623 ms = ms.connectTo(
614 ms.properties.screw_connector[0], 624 ms.properties.screw_connector[0],
615 hd.properties.microswitch_screw_connector[0], 625 hd.properties.microswitch_screw_connector[0],
616 false, 0); 626 false, 0);
617 var hdhd = EFFECTOR.split_hinged(hd); 627 var hdhd = EFFECTOR.split_hinged(hd);
618 var fh = EFFECTOR.fanholder(); 628 var fh = EFFECTOR.fanholder();
619 return union({ 629 return union({
620 platform: e, 630 platform: e,
621 hinged: hdhd[1], 631 hinged: hdhd[1],
622 clamp: hdhd[0], 632 clamp: hdhd[0],
623 fanholder: fh, 633 fanholder: fh,
624 alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh] 634 alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh]
625 }[params.part||'alltogethernow']) 635 }[params.part||'alltogethernow'])
626 var rv = union( 636 var rv = union(
627 e, 637 e,
628 hs, 638 hs,
629 columns(), 639 columns(),
630 ///hd, 640 ///hd,
631 hdhd[0], hdhd[1], 641 hdhd[0], hdhd[1],
632 ms); 642 ms);
633 return rv; 643 return rv;
634} 644}