parameter tweak

This commit is contained in:
Adrian Mariano 2021-01-06 21:31:40 -05:00
parent 30d960bf6d
commit 286eadd84b

View file

@ -419,7 +419,7 @@ module joiner_quad(spacing1=undef, spacing2=undef, xspacing=undef, yspacing=unde
// Module: dovetail()
//
// Usage:
// dovetail(gender, l|length, w|width, slide, [slope|angle], [taper|back_width], [chamfer], [r|radius], [round], [$slop])
// dovetail(gender, w|width, h|height, slide, [slope|angle], [taper|back_width], [chamfer], [r|radius], [round], [$slop])
//
// Description:
// Produces a possibly tapered dovetail joint shape to attach to or subtract from two parts you wish to join together.
@ -433,9 +433,9 @@ module joiner_quad(spacing1=undef, spacing2=undef, xspacing=undef, yspacing=unde
//
// Arguments:
// gender = A string, "male" or "female", to specify the gender of the dovetail.
// l / length = Length of the dovetail (the amount it projects from its base)
// w / width = Width (at the wider, top end) of the dovetail before tapering
// slide = Distance the dovetail slides when you assemble it
// h / height = Height of the dovetail (the amount it projects from its base)
// slide = Distance the dovetail slides when you assemble it (length of sliding dovetails, thickness of regular dovetails)
// ---
// slope = slope of the dovetail. Standard woodworking slopes are 4, 6, or 8. Default: 6.
// angle = angle (in degrees) of the dovetail. Specify only one of slope and angle.
@ -446,65 +446,65 @@ module joiner_quad(spacing1=undef, spacing2=undef, xspacing=undef, yspacing=unde
// round = true to round both corners of the dovetail and give it a puzzle piece look. Default: false.
// extra = amount of extra length and base extension added to dovetails for unions and differences. Default: 0.01
// Example: Ordinary straight dovetail, male version (sticking up) and female version (below the xy plane)
// dovetail("male", length=8, width=15, slide=30);
// right(20) dovetail("female", length=8, width=15, slide=30);
// dovetail("male", width=15, height=8, slide=30);
// right(20) dovetail("female", width=15, height=8, slide=30);
// Example: Adding a 6 degree taper (Such a big taper is usually not necessary, but easier to see for the example.)
// dovetail("male", l=8, w=15, slide=30, taper=6);
// right(20) dovetail("female", 8, 15, 30, taper=6); // Same as above
// dovetail("male", w=15, h=8, slide=30, taper=6);
// right(20) dovetail("female", 15, 8, 30, taper=6); // Same as above
// Example: A block that can link to itself
// diff("remove")
// cuboid([50,30,10]){
// attach(BACK) dovetail("male", slide=10, width=15, length=8);
// attach(FRONT) dovetail("female", slide=10, width=15, length=8,$tags="remove");
// attach(BACK) dovetail("male", slide=10, width=15, height=8);
// attach(FRONT) dovetail("female", slide=10, width=15, height=8,$tags="remove");
// }
// Example: Setting the dovetail angle. This is too extreme to be useful.
// diff("remove")
// cuboid([50,30,10]){
// attach(BACK) dovetail("male", slide=10, width=15, length=8, angle=30);
// attach(FRONT) dovetail("female", slide=10, width=15, length=8, angle=30,$tags="remove");
// attach(BACK) dovetail("male", slide=10, width=15, height=8, angle=30);
// attach(FRONT) dovetail("female", slide=10, width=15, height=8, angle=30,$tags="remove");
// }
// Example: Adding a chamfer helps printed parts fit together without problems at the corners
// diff("remove")
// cuboid([50,30,10]){
// attach(BACK) dovetail("male", slide=10, width=15, length=8, chamfer=1);
// attach(FRONT) dovetail("female", slide=10, width=15, length=8,chamfer=1,$tags="remove");
// attach(BACK) dovetail("male", slide=10, width=15, height=8, chamfer=1);
// attach(FRONT) dovetail("female", slide=10, width=15, height=8,chamfer=1,$tags="remove");
// }
// Example: Rounding the outside corners is another option
// diff("remove")
// cuboid([50,30,10]) {
// attach(BACK) dovetail("male", slide=10, width=15, length=8, radius=1, $fn=32);
// attach(FRONT, overlap=-0.1) dovetail("female", slide=10, width=15, length=8, radius=1, $tags="remove", $fn=32);
// attach(BACK) dovetail("male", slide=10, width=15, height=8, radius=1, $fn=32);
// attach(FRONT, overlap=-0.1) dovetail("female", slide=10, width=15, height=8, radius=1, $tags="remove", $fn=32);
// }
// Example: Or you can make a fully rounded joint
// $fn=32;
// diff("remove")
// cuboid([50,30,10]){
// attach(BACK) dovetail("male", slide=10, width=15, length=8, radius=1.5, round=true);
// attach(FRONT,overlap=-0.1) dovetail("female", slide=10, width=15, length=8, radius=1.5, round=true, $tags="remove");
// attach(BACK) dovetail("male", slide=10, width=15, height=8, radius=1.5, round=true);
// attach(FRONT,overlap=-0.1) dovetail("female", slide=10, width=15, height=8, radius=1.5, round=true, $tags="remove");
// }
// Example: With a long joint like this, a taper makes the joint easy to assemble. It will go together easily and wedge tightly if you get the tolerances right. Specifying the taper with `back_width` may be easier than using a taper angle. Note that "length" refers to the amount the joint projects from its base, which is a little counter-intuitive when the joint has a very long slide like these sliding dovetails.
// Example: With a long joint like this, a taper makes the joint easy to assemble. It will go together easily and wedge tightly if you get the tolerances right. Specifying the taper with `back_width` may be easier than using a taper angle.
// cuboid([50,30,10])
// attach(TOP) dovetail("male", slide=50, width=18, length=4, back_width=15, spin=90);
// attach(TOP) dovetail("male", slide=50, width=18, height=4, back_width=15, spin=90);
// fwd(35)
// diff("remove")
// cuboid([50,30,10])
// attach(TOP) dovetail("female", slide=50, width=18, length=4, back_width=15, spin=90,$tags="remove");
// attach(TOP) dovetail("female", slide=50, width=18, height=4, back_width=15, spin=90,$tags="remove");
// Example: A series of dovtails forming a tail board, with the inside of the joint up. A standard wood joint would have a zero taper.
// cuboid([50,30,10])
// attach(BACK) xcopies(10,5) dovetail("male", slide=10, width=7, taper=4, length=4);
// attach(BACK) xcopies(10,5) dovetail("male", slide=10, width=7, taper=4, height=4);
// Example: Mating pin board for a half-blind right angle joint, where the joint only shows on the side but not the front. Note that the anchor method and use of `spin` ensures that the joint works even with a taper.
// diff("remove")
// cuboid([50,30,10])
// position(TOP+BACK) xcopies(10,5) dovetail("female", slide=10, width=7, taper=4, length=4, $tags="remove",anchor=BOTTOM+FRONT,spin=180);
module dovetail(gender, length, width, slide, l, w, angle, slope, taper, back_width, chamfer, extra=0.01, r, radius, round=false, anchor=BOTTOM, spin=0, orient)
// position(TOP+BACK) xcopies(10,5) dovetail("female", slide=10, width=7, taper=4, height=4, $tags="remove",anchor=BOTTOM+FRONT,spin=180);
module dovetail(gender, width, height, slide, h, w, angle, slope, taper, back_width, chamfer, extra=0.01, r, radius, round=false, anchor=BOTTOM, spin=0, orient)
{
radius = get_radius(r1=radius,r2=r);
lcount = num_defined([l,length]);
hcount = num_defined([h,height]);
wcount = num_defined([w,width]);
assert(is_def(slide), "Must define slide");
assert(lcount==1, "Must define exactly one of l and length");
assert(hcount==1, "Must define exactly one of h and height");
assert(wcount==1, "Must define exactly one of w and width");
l = first_defined([l,length]);
h = first_defined([h,height]);
w = first_defined([w,width]);
orient = is_def(orient) ? orient :
gender == "female" ? DOWN : UP;
@ -518,7 +518,7 @@ module dovetail(gender, length, width, slide, l, w, angle, slope, taper, back_wi
is_def(angle) ? 1/tan(angle) : 6;
extra_slop = gender == "female" ? 2*$slop : 0;
width = w + extra_slop;
length = l + extra_slop;
height = h + extra_slop;
back_width = u_add(back_width, extra_slop);
front_offset = is_def(taper) ? -extra * tan(taper) :
@ -535,10 +535,10 @@ module dovetail(gender, length, width, slide, l, w, angle, slope, taper, back_wi
move(
[0,-slide/2-extra,0],
p=[
[0 , 0, length],
[width/2-front_offset , 0, length],
[width/2 - length/slope - front_offset, 0, 0 ],
[width/2 - front_offset + length, 0, 0]
[0 , 0, height],
[width/2-front_offset , 0, height],
[width/2 - height/slope - front_offset, 0, 0 ],
[width/2 - front_offset + height, 0, 0]
]
),
method=type, cut = fullsize, closed=false
@ -550,8 +550,8 @@ module dovetail(gender, length, width, slide, l, w, angle, slope, taper, back_wi
adjustment = $overlap * (gender == "male" ? -1 : 1); // Adjustment for default overlap in attach()
attachable(anchor,spin,orient, size=[width+2*offset, slide, length]) {
down(length/2+adjustment) {
attachable(anchor,spin,orient, size=[width+2*offset, slide, height]) {
down(height/2+adjustment) {
skin(
[
reverse(concat(smallend_points, xflip(p=reverse(smallend_points)))),