Files
lovejoy/lovejoy.scad

72 lines
1.8 KiB
OpenSCAD
Raw Permalink Normal View History

use <PolyGear/PolyGear.scad>
use <PolyGear/PolyGearBasics.scad>
use <PolyGear/shortcuts.scad>
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;
if (die) {
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);
}
}
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,or=or,h=h,die=die);
}
}
}
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
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,ph+jh/2])
color(cc) spider(ir=2, or=r, die=true, h=jh);
// Center Cuts
if ($children > 1) translate([0,0,-.01]) children(1);
}
}
color("pink")
lovejoy(r=4, ph=5, jh=3, align=false) {
union();
cylinder(h=8,d=4);
}