From cf3a550fb0ae4dca4ae34ed8a2e1b91e89757f09 Mon Sep 17 00:00:00 2001 From: Stephen Carpenter Date: Tue, 22 Nov 2022 10:55:05 -0500 Subject: [PATCH] Major tweak: changed orientation Coupler is now generated jaws up and aligned with jaw bottom on 0. Added align option, default to true. Set to false for the whole part to sit on the xy plane. --- lovejoy.scad | 70 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/lovejoy.scad b/lovejoy.scad index 30fb809..a04b23c 100644 --- a/lovejoy.scad +++ b/lovejoy.scad @@ -2,17 +2,27 @@ use use use +render_fn = 180; +render_fa = .5; +render_fs = .2; + +$fn= ($preview) ? 30 : render_fn; +$fa= ($preview) ? $fa : render_fa; +$fs= ($preview) ? $fs : render_fs; module spider_section(ir=6,or=13, l=6, lt=1, h, die=false) { + //a = 360/l; a = 360/l; - cx=or-ir+.2; - for (r=[0,a]) - rotate([0,0,r]) - translate([ir+cx/2-.2,0,0]) cube([cx, die ? lt+.2 : lt, h], center=true); + cx=or-ir; if (die) { - RiS(R=or, r=0, h=h, w1=0, w2=60); - Ri(R=ir+.4, r=0, h=h); + RiS(R=or+.01, r=0, h=h+.01, w1=0, w2=60); + Ri(R=ir+.2, r=0, h=h+.01); + spider_section(ir=ir,or=or,l=l,lt=lt+.2,h=h+.01,die=false); } else { + for (r= [0,a]) + rotate([0,0,r]) + translate([ir+lt/2,0,0]) + cube([or-ir+lt, lt, h], center=true); Ri(R=ir, r=ir-lt, h=h); } } @@ -21,35 +31,41 @@ module spider(ir=6, sd=9, or=13, l=6, lt=1, h=3, die=false) { difference() { union() { for (i=[0 : 1 : l-1]) - if (i % 2) rotate([0,0,i*360/l]) spider_section(ir=ir,h=h,die=die); + if (i % 2) rotate([0,0,i*360/l]) spider_section(ir=ir,or=or,h=h,die=die); } } } -module lovejoy(ph=5, jh=3) { - ir = ($children < 1) ? 4.2 : 0; - difference() { +module lovejoy( + ph=5, // Plate Height + r=13, // Diameter + jh=3, // Jaw Height + align = true, + bc=undef, // base color + cc=undef // cut color +) { + //ir = ($children < 1) ? 4.2 : 0; + dz = align ? -ph : 0; + translate([0,0,dz]) difference() { // Body - translate([0,0,-(jh+ph)/2]) Ri(R=13-.1,r=ir,h=ph+jh); + assert($children<3, "Lovejoy only supports up to 2 children."); + union() { + // Base Plate. + color(bc) + cylinder(r=r, h=ph+jh); //Ri(R=d,r=ir,h=ph+jh); + // Child 0 adds to base + if ($children > 0) children(0); + } // Cuts - translate([0,0,-jh/2+.01]) spider(ir=6, die=true, h=jh+.1); + translate([0,0,ph+jh/2]) + color(cc) spider(ir=2, or=r, die=true, h=jh); // Center Cuts - if ($children > 0) - children(); + if ($children > 1) translate([0,0,-.01]) children(1); } } -if (! $preview) { - $fs= .1; - $fn= 60; -} color("pink") - lovejoy() translate([0,0,-6]) cylinder(r=2, h=12, $fn=4, center=true); -color("green") - translate([0,0,0]) spider(ir=6, die=false, h=3); -color("blue") - rotate([180,0,0]) { - lovejoy(); -} - -//translate([tan(60),0,-2]) color("yellow") cube([.1,1,5]); + lovejoy(r=4, ph=5, jh=3, align=false) { + union(); + cylinder(h=8,d=4); + }