summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--delta.jscad1
1 files changed, 1 insertions, 0 deletions
diff --git a/delta.jscad b/delta.jscad
index 2e6365c..9c13528 100644
--- a/delta.jscad
+++ b/delta.jscad
@@ -603,64 +603,65 @@ function duet() {
603 rv.properties.vitamin = true; 603 rv.properties.vitamin = true;
604 return rv; 604 return rv;
605} 605}
606 606
607function foot() { 607function foot() {
608 var F = CONFIG.foot; 608 var F = CONFIG.foot;
609 var br = F.bolt.hd/2+F.margin; 609 var br = F.bolt.hd/2+F.margin;
610 var bh = F.zscalefactor*Math.sqrt(Math.pow(F.d/2,2)-Math.pow(br,2)); 610 var bh = F.zscalefactor*Math.sqrt(Math.pow(F.d/2,2)-Math.pow(br,2));
611 var th = F.h-bh; 611 var th = F.h-bh;
612 var r = 2*F.d; 612 var r = 2*F.d;
613 var rv = CSG.sphere({ // botom contorted sphere 613 var rv = CSG.sphere({ // botom contorted sphere
614 center: [0,0,0], radius: F.d/2, resolution: r 614 center: [0,0,0], radius: F.d/2, resolution: r
615 }).scale([1,1,F.zscalefactor]).translate([0,0,bh]).union(CSG.cylinder({ // top hat 615 }).scale([1,1,F.zscalefactor]).translate([0,0,bh]).union(CSG.cylinder({ // top hat
616 start: [0,0,bh], end: [0,0,F.h], radius: F.d/2, resolution: r 616 start: [0,0,bh], end: [0,0,F.h], radius: F.d/2, resolution: r
617 })).intersect(CSG.cylinder({ // cut off excess 617 })).intersect(CSG.cylinder({ // cut off excess
618 start: [0,0,0], end: [0,0,F.h], radius: F.d 618 start: [0,0,0], end: [0,0,F.h], radius: F.d
619 })).subtract([ 619 })).subtract([
620 CSG.cylinder({ // bolt hole 620 CSG.cylinder({ // bolt hole
621 start: [0,0,-1], end: [0,0,F.h+1], radius: F.bolt.d/2+PRINT.slide_tolerance 621 start: [0,0,-1], end: [0,0,F.h+1], radius: F.bolt.d/2+PRINT.slide_tolerance
622 }), CSG.cylinder({ // nut hole 622 }), CSG.cylinder({ // nut hole
623 start: [0,0,F.h-F.nut.h-PRINT.play_tolerance], 623 start: [0,0,F.h-F.nut.h-PRINT.play_tolerance],
624 end: [0,0,F.h], 624 end: [0,0,F.h],
625 radius: F.nut.d/2+PRINT.slide_tolerance, resolution: 6 625 radius: F.nut.d/2+PRINT.slide_tolerance, resolution: 6
626 }), CSG.cylinder({ // bolthead/washer hole 626 }), CSG.cylinder({ // bolthead/washer hole
627 start: [0,0,-1], end: [0,0,F.h-F.nut.h-PRINT.play_tolerance-F.shell], 627 start: [0,0,-1], end: [0,0,F.h-F.nut.h-PRINT.play_tolerance-F.shell],
628 radius: F.bolt.hd/2+PRINT.play_tolerance 628 radius: F.bolt.hd/2+PRINT.play_tolerance
629 }) 629 })
630 ]).union(CSG.cylinder({ // bridging patch 630 ]).union(CSG.cylinder({ // bridging patch
631 start: [0,0,F.h-F.nut.h-PRINT.play_tolerance-PRINT.layer_height], 631 start: [0,0,F.h-F.nut.h-PRINT.play_tolerance-PRINT.layer_height],
632 end: [0,0,F.h-F.nut.h-PRINT.play_tolerance], 632 end: [0,0,F.h-F.nut.h-PRINT.play_tolerance],
633 radius: F.nut.d/2 633 radius: F.nut.d/2
634 })); 634 }));
635 rv.properties.c_column = new CSG.Connector([0,0,F.h],[0,0,1],[1,0,0]);
635 rv.properties.P = new CSG.Connector([0,0,F.h],[0,0,-1],[1,0,0]); 636 rv.properties.P = new CSG.Connector([0,0,F.h],[0,0,-1],[1,0,0]);
636 return rv.setColor(CONFIG.color.parts); 637 return rv.setColor(CONFIG.color.parts);
637} 638}
638 639
639function refaxes(o) { 640function refaxes(o) {
640 if(!o) o = {}; 641 if(!o) o = {};
641 var l = o.l||20, g = o.g||0.7; 642 var l = o.l||20, g = o.g||0.7;
642 return union([ 643 return union([
643 CSG.roundedCylinder({start:[0,0,0],end:[l,0,0]}).setColor([1,0,0,g]), 644 CSG.roundedCylinder({start:[0,0,0],end:[l,0,0]}).setColor([1,0,0,g]),
644 CSG.roundedCylinder({start:[0,0,0],end:[0,l,0]}).setColor([0,1,0,g]), 645 CSG.roundedCylinder({start:[0,0,0],end:[0,l,0]}).setColor([0,1,0,g]),
645 CSG.roundedCylinder({start:[0,0,0],end:[0,0,l]}).setColor([0,0,1,g]) 646 CSG.roundedCylinder({start:[0,0,0],end:[0,0,l]}).setColor([0,0,1,g])
646 ]); 647 ]);
647} 648}
648 649
649function P(x) { 650function P(x) {
650 return x.connectTo(x.properties.P,new CSG.Connector([0,0,0],[0,0,1],[1,0,0]), false, 0); 651 return x.connectTo(x.properties.P,new CSG.Connector([0,0,0],[0,0,1],[1,0,0]), false, 0);
651} 652}
652 653
653var PARTS = { 654var PARTS = {
654 wip: function(params) { 655 wip: function(params) {
655 return foot(); 656 return foot();
656 return union(base_extrusions(),column_extrusions(),duet()); 657 return union(base_extrusions(),column_extrusions(),duet());
657 } 658 }
658}; 659};
659 660
660function main(params) { 661function main(params) {
661 var part = params.part && PARTS[params.part]; 662 var part = params.part && PARTS[params.part];
662 if(!part) return refaxes(); 663 if(!part) return refaxes();
663 var rv = P(part(params)); 664 var rv = P(part(params));
664 if(!params.print) rv = rv.union(refaxes()); 665 if(!params.print) rv = rv.union(refaxes());
665 return rv; 666 return rv;
666} 667}