Updated copyright years. Split math.scad up. Enabled attach for lots of shapes. Removed backwards compatability.

This commit is contained in:
Revar Desmera
2019-04-19 17:02:17 -07:00
parent 019aae4347
commit cc36235736
29 changed files with 1995 additions and 1743 deletions

View File

@@ -11,7 +11,7 @@
/*
BSD 2-Clause License
Copyright (c) 2017, Revar Desmera
Copyright (c) 2017-2019, Revar Desmera
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -63,20 +63,23 @@ module half_joiner_clear(h=20, w=10, a=30, clearance=0, overlap=0.01, orient=ORI
guide_size = w/3;
guide_width = 2*(dmnd_height/2-guide_size)*tan(a);
orient_and_align([w, guide_width, h], orient, align, orig_orient=ORIENT_Y) {
yspread(overlap, n=overlap>0? 2 : 1) {
difference() {
// Diamonds.
scale([w+clearance, dmnd_width/2, dmnd_height/2]) {
xrot(45) cube(size=[1,sqrt(2),sqrt(2)], center=true);
}
// Blunt point of tab.
yspread(guide_width+4) {
cube(size=[(w+clearance)*1.05, 4, h*0.99], center=true);
orient_and_align([w, guide_width, h], orient, align, orig_orient=ORIENT_Y, chain=true) {
union() {
yspread(overlap, n=overlap>0? 2 : 1) {
difference() {
// Diamonds.
scale([w+clearance, dmnd_width/2, dmnd_height/2]) {
xrot(45) cube(size=[1,sqrt(2),sqrt(2)], center=true);
}
// Blunt point of tab.
yspread(guide_width+4) {
cube(size=[(w+clearance)*1.05, 4, h*0.99], center=true);
}
}
}
if (overlap>0) cube([w+clearance, overlap+0.001, h], center=true);
}
if (overlap>0) cube([w+clearance, overlap+0.001, h], center=true);
children();
}
}
@@ -113,7 +116,7 @@ module half_joiner(h=20, w=10, l=10, a=30, screwsize=undef, guides=true, slop=PR
}
}
render(convexity=12)
orient_and_align([w, 2*l, h], orient, align, orig_orient=ORIENT_Y) {
orient_and_align([w, 2*l, h], orient, align, orig_orient=ORIENT_Y, chain=true) {
difference() {
union() {
// Make base.
@@ -159,6 +162,7 @@ module half_joiner(h=20, w=10, l=10, a=30, screwsize=undef, guides=true, slop=PR
yrot(90) cylinder(r=screwsize*1.1/2, h=w+1, center=true, $fn=12);
}
}
children();
}
}
//half_joiner(screwsize=3, orient=ORIENT_Z, align=UP);
@@ -196,7 +200,7 @@ module half_joiner2(h=20, w=10, l=10, a=30, screwsize=undef, guides=true, orient
}
render(convexity=12)
orient_and_align([w, 2*l, h], orient, align, orig_orient=ORIENT_Y) {
orient_and_align([w, 2*l, h], orient, align, orig_orient=ORIENT_Y, chain=true) {
difference() {
union () {
fwd(l/2) cube(size=[w, l, h], center=true);
@@ -211,6 +215,7 @@ module half_joiner2(h=20, w=10, l=10, a=30, screwsize=undef, guides=true, orient
xcyl(r=screwsize*1.1/2, l=w+1, $fn=12);
}
}
children();
}
}
@@ -241,9 +246,12 @@ module joiner_clear(h=40, w=10, a=30, clearance=0, overlap=0.01, orient=ORIENT_Y
guide_size = w/3;
guide_width = 2*(dmnd_height/2-guide_size)*tan(a);
orient_and_align([w, guide_width, h], orient, align, orig_orient=ORIENT_Y) {
up(h/4) half_joiner_clear(h=h/2.0-0.01, w=w, a=a, overlap=overlap, clearance=clearance);
down(h/4) half_joiner_clear(h=h/2.0-0.01, w=w, a=a, overlap=overlap, clearance=-0.01);
orient_and_align([w, guide_width, h], orient, align, orig_orient=ORIENT_Y, chain=true) {
union() {
up(h/4) half_joiner_clear(h=h/2.0-0.01, w=w, a=a, overlap=overlap, clearance=clearance);
down(h/4) half_joiner_clear(h=h/2.0-0.01, w=w, a=a, overlap=overlap, clearance=-0.01);
}
children();
}
}
@@ -275,9 +283,12 @@ module joiner(h=40, w=10, l=10, a=30, screwsize=undef, guides=true, slop=PRINTER
joiner_clear(h=h, w=w, a=a, clearance=0.1, orient=orient, align=align);
}
}
orient_and_align([w, 2*l, h], orient, align, orig_orient=ORIENT_Y) {
up(h/4) half_joiner(h=h/2, w=w, l=l, a=a, screwsize=screwsize, guides=guides, slop=slop);
down(h/4) half_joiner2(h=h/2, w=w, l=l, a=a, screwsize=screwsize, guides=guides);
orient_and_align([w, 2*l, h], orient, align, orig_orient=ORIENT_Y, chain=true) {
union() {
up(h/4) half_joiner(h=h/2, w=w, l=l, a=a, screwsize=screwsize, guides=guides, slop=slop);
down(h/4) half_joiner2(h=h/2, w=w, l=l, a=a, screwsize=screwsize, guides=guides);
}
children();
}
}
@@ -311,10 +322,11 @@ module joiner_pair_clear(spacing=100, h=40, w=10, a=30, n=2, clearance=0, overla
guide_size = w/3;
guide_width = 2*(dmnd_height/2-guide_size)*tan(a);
orient_and_align([spacing+w, guide_width, h], orient, align, orig_orient=ORIENT_Y) {
orient_and_align([spacing+w, guide_width, h], orient, align, orig_orient=ORIENT_Y, chain=true) {
xspread(spacing, n=n) {
joiner_clear(h=h, w=w, a=a, clearance=clearance, overlap=overlap);
}
children();
}
}
@@ -352,7 +364,7 @@ module joiner_pair(spacing=100, h=40, w=10, l=10, a=30, n=2, alternate=true, scr
joiner_pair_clear(spacing=spacing, h=h, w=w, a=a, clearance=0.1, orient=orient, align=align);
}
}
orient_and_align([spacing+w, 2*l, h], orient, align, orig_orient=ORIENT_Y) {
orient_and_align([spacing+w, 2*l, h], orient, align, orig_orient=ORIENT_Y, chain=true) {
left((n-1)*spacing/2) {
for (i=[0:n-1]) {
right(i*spacing) {
@@ -362,6 +374,7 @@ module joiner_pair(spacing=100, h=40, w=10, l=10, a=30, n=2, alternate=true, scr
}
}
}
children();
}
}
@@ -393,12 +406,13 @@ module joiner_quad_clear(xspacing=undef, yspacing=undef, spacing1=undef, spacing
{
spacing1 = first_defined([spacing1, xspacing, 100]);
spacing2 = first_defined([spacing2, yspacing, 50]);
orient_and_align([w+spacing1, spacing2, h], orient, align, orig_orient=ORIENT_Y) {
orient_and_align([w+spacing1, spacing2, h], orient, align, orig_orient=ORIENT_Y, chain=true) {
zrot_copies(n=2) {
back(spacing2/2) {
joiner_pair_clear(spacing=spacing1, n=n, h=h, w=w, a=a, clearance=clearance, overlap=overlap);
}
}
children();
}
}
@@ -438,12 +452,13 @@ module joiner_quad(spacing1=undef, spacing2=undef, xspacing=undef, yspacing=unde
joiner_quad_clear(spacing1=spacing1, spacing2=spacing2, h=h, w=w, a=a, clearance=0.1, orient=orient, align=align);
}
}
orient_and_align([w+spacing1, spacing2, h], orient, align, orig_orient=ORIENT_Y) {
orient_and_align([w+spacing1, spacing2, h], orient, align, orig_orient=ORIENT_Y, chain=true) {
zrot_copies(n=2) {
back(spacing2/2) {
joiner_pair(spacing=spacing1, n=n, h=h, w=w, l=l, a=a, screwsize=screwsize, guides=guides, slop=slop);
}
}
children();
}
}