Renamed align to anchor.

This commit is contained in:
Revar Desmera
2019-04-22 20:55:03 -07:00
parent 597d74fcc8
commit 5a16152416
29 changed files with 684 additions and 698 deletions

View File

@@ -62,8 +62,8 @@ function _trpzd_thread_pt(thread, threads, start, starts, astep, asteps, part, p
// bevel = if true, bevel the thread ends. Default: true
// starts = The number of lead starts. Default = 1
// orient = Orientation of the rod. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
// align = Alignment of the rod. Use the constants from `constants.scad`. Default: `CENTER`.
// center = If given, overrides `align`. A true value sets `align=CENTER`, false sets `align=UP`.
// anchor = Alignment of the rod. Use the constants from `constants.scad`. Default: `CENTER`.
// center = If given, overrides `anchor`. A true value sets `anchor=CENTER`, false sets `anchor=UP`.
// Examples:
// trapezoidal_threaded_rod(d=10, l=100, pitch=2, thread_angle=15, $fn=32);
// trapezoidal_threaded_rod(d=3/8*25.4, l=20, pitch=1/8*25.4, thread_angle=29, $fn=32);
@@ -73,7 +73,7 @@ function _trpzd_thread_pt(thread, threads, start, starts, astep, asteps, part, p
// trapezoidal_threaded_rod(d=10, l=40, pitch=3, thread_angle=15, left_handed=true, starts=3, $fn=36);
// trapezoidal_threaded_rod(d=25, l=100, pitch=10, thread_depth=8/3, thread_angle=50, starts=4, center=false, $fa=2, $fs=2);
// trapezoidal_threaded_rod(d=50, l=75, pitch=8, thread_angle=30, starts=3, bevel=true);
// trapezoidal_threaded_rod(l=25, d=10, pitch=2, thread_angle=15, starts=3, $fa=1, $fs=1, orient=ORIENT_X, align=UP);
// trapezoidal_threaded_rod(l=25, d=10, pitch=2, thread_angle=15, starts=3, $fa=1, $fs=1, orient=ORIENT_X, anchor=UP);
module trapezoidal_threaded_rod(
d=10,
l=100,
@@ -84,7 +84,7 @@ module trapezoidal_threaded_rod(
bevel=false,
starts=1,
orient=ORIENT_Z,
align=CENTER,
anchor=CENTER,
center=undef
) {
astep = 360 / quantup(segs(d/2), starts);
@@ -218,7 +218,7 @@ module trapezoidal_threaded_rod(
) otri
]
);
orient_and_align([d,d,l], orient, align, center, chain=true) {
orient_and_anchor([d,d,l], orient, anchor, center, chain=true) {
difference() {
polyhedron(points=poly_points, faces=poly_faces, convexity=threads*starts*2);
zspread(l+4*pitch*starts) cube([d+1, d+1, 4*pitch*starts], center=true);
@@ -250,9 +250,9 @@ module trapezoidal_threaded_rod(
// slop = printer slop calibration to allow for tight fitting of parts. default=0.2
// bevel = if true, bevel the thread ends. Default: true
// orient = Orientation of the nut. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
// align = Alignment of the nut. Use the constants from `constants.scad`. Default: `CENTER`.
// anchor = Alignment of the nut. Use the constants from `constants.scad`. Default: `CENTER`.
// Examples:
// trapezoidal_threaded_nut(od=16, id=8, h=8, pitch=2, slop=0.2, align=UP);
// trapezoidal_threaded_nut(od=16, id=8, h=8, pitch=2, slop=0.2, anchor=UP);
// trapezoidal_threaded_nut(od=17.4, id=10, h=10, pitch=2, slop=0.2, left_handed=true);
// trapezoidal_threaded_nut(od=17.4, id=10, h=10, pitch=2, thread_angle=15, starts=3, $fa=1, $fs=1);
module trapezoidal_threaded_nut(
@@ -267,10 +267,10 @@ module trapezoidal_threaded_nut(
bevel=true,
slop=PRINTER_SLOP,
orient=ORIENT_Z,
align=CENTER
anchor=CENTER
) {
depth = min((thread_depth==undef? pitch/2 : thread_depth), pitch/2/tan(thread_angle));
orient_and_align([od/cos(30),od,h], orient, align, chain=true) {
orient_and_anchor([od/cos(30),od,h], orient, anchor, chain=true) {
difference() {
cylinder(d=od/cos(30), h=h, center=true, $fn=6);
zspread(slop, n=slop>0?2:1) {
@@ -310,10 +310,10 @@ module trapezoidal_threaded_nut(
// left_handed = if true, create left-handed threads. Default = false
// bevel = if true, bevel the thread ends. Default: false
// orient = Orientation of the rod. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
// align = Alignment of the rod. Use the constants from `constants.scad`. Default: `CENTER`.
// anchor = Alignment of the rod. Use the constants from `constants.scad`. Default: `CENTER`.
// Examples:
// threaded_rod(d=10, l=30, pitch=1.25, left_handed=true, $fa=1, $fs=1);
module threaded_rod(d=10, l=100, pitch=2, left_handed=false, bevel=false, orient=ORIENT_Z, align=CENTER) {
module threaded_rod(d=10, l=100, pitch=2, left_handed=false, bevel=false, orient=ORIENT_Z, anchor=CENTER) {
trapezoidal_threaded_rod(
d=d, l=l, pitch=pitch,
thread_depth=pitch*3*sqrt(3)/8,
@@ -321,7 +321,7 @@ module threaded_rod(d=10, l=100, pitch=2, left_handed=false, bevel=false, orient
left_handed=left_handed,
bevel=bevel,
orient=orient,
align=align
anchor=anchor
) children();
}
@@ -340,14 +340,14 @@ module threaded_rod(d=10, l=100, pitch=2, left_handed=false, bevel=false, orient
// bevel = if true, bevel the thread ends. Default: false
// slop = printer slop calibration to allow for tight fitting of parts. default=0.2
// orient = Orientation of the nut. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
// align = Alignment of the nut. Use the constants from `constants.scad`. Default: `CENTER`.
// anchor = Alignment of the nut. Use the constants from `constants.scad`. Default: `CENTER`.
// Examples:
// threaded_nut(od=16, id=8, h=8, pitch=1.25, left_handed=true, slop=0.2, $fa=1, $fs=1);
module threaded_nut(
od=16, id=10, h=10,
pitch=2, left_handed=false,
bevel=false, slop=0.2,
orient=ORIENT_Z, align=CENTER
orient=ORIENT_Z, anchor=CENTER
) {
trapezoidal_threaded_nut(
od=od, id=id, h=h,
@@ -355,7 +355,7 @@ module threaded_nut(
thread_depth=pitch*3*sqrt(3)/8,
left_handed=left_handed,
bevel=bevel, slop=slop,
orient=orient, align=align
orient=orient, anchor=anchor
) children();
}
@@ -374,7 +374,7 @@ module threaded_nut(
// bevel = if true, bevel the thread ends. Default: false
// starts = The number of lead starts. Default = 1
// orient = Orientation of the rod. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
// align = Alignment of the rod. Use the constants from `constants.scad`. Default: `CENTER`.
// anchor = Alignment of the rod. Use the constants from `constants.scad`. Default: `CENTER`.
// Examples:
// metric_trapezoidal_threaded_rod(d=10, l=30, pitch=2, left_handed=true, $fa=1, $fs=1);
module metric_trapezoidal_threaded_rod(
@@ -383,7 +383,7 @@ module metric_trapezoidal_threaded_rod(
starts=1,
bevel=false,
orient=ORIENT_Z,
align=CENTER
anchor=CENTER
) {
trapezoidal_threaded_rod(
d=d, l=l,
@@ -393,7 +393,7 @@ module metric_trapezoidal_threaded_rod(
starts=starts,
bevel=bevel,
orient=orient,
align=align
anchor=anchor
) children();
}
@@ -413,7 +413,7 @@ module metric_trapezoidal_threaded_rod(
// starts = The number of lead starts. Default = 1
// slop = printer slop calibration to allow for tight fitting of parts. default=0.2
// orient = Orientation of the nut. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
// align = Alignment of the nut. Use the constants from `constants.scad`. Default: `CENTER`.
// anchor = Alignment of the nut. Use the constants from `constants.scad`. Default: `CENTER`.
// Examples:
// metric_trapezoidal_threaded_nut(od=16, id=10, h=10, pitch=2, left_handed=true, bevel=true, $fa=1, $fs=1);
module metric_trapezoidal_threaded_nut(
@@ -424,7 +424,7 @@ module metric_trapezoidal_threaded_nut(
bevel=false,
slop=PRINTER_SLOP,
orient=ORIENT_Z,
align=CENTER
anchor=CENTER
) {
trapezoidal_threaded_nut(
od=od, id=id, h=h,
@@ -434,7 +434,7 @@ module metric_trapezoidal_threaded_nut(
bevel=bevel,
slop=slop,
orient=orient,
align=align
anchor=anchor
) children();
}
@@ -455,7 +455,7 @@ module metric_trapezoidal_threaded_nut(
// left_handed = if true, create left-handed threads. Default = false
// bevel = if true, bevel the thread ends. Default: false
// orient = Orientation of the rod. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
// align = Alignment of the rod. Use the constants from `constants.scad`. Default: `CENTER`.
// anchor = Alignment of the rod. Use the constants from `constants.scad`. Default: `CENTER`.
// Examples:
// acme_threaded_rod(d=3/8*25.4, l=20, pitch=1/8*25.4, $fn=32);
// acme_threaded_rod(d=10, l=40, pitch=2, starts=3, $fa=1, $fs=1);
@@ -467,7 +467,7 @@ module acme_threaded_rod(
left_handed=false,
bevel=false,
orient=ORIENT_Z,
align=CENTER
anchor=CENTER
) {
trapezoidal_threaded_rod(
d=d, l=l, pitch=pitch,
@@ -477,7 +477,7 @@ module acme_threaded_rod(
left_handed=left_handed,
bevel=bevel,
orient=orient,
align=align
anchor=anchor
) children();
}
@@ -498,7 +498,7 @@ module acme_threaded_rod(
// bevel = if true, bevel the thread ends. Default: false
// slop = printer slop calibration to allow for tight fitting of parts. default=0.2
// orient = Orientation of the nut. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
// align = Alignment of the nut. Use the constants from `constants.scad`. Default: `CENTER`.
// anchor = Alignment of the nut. Use the constants from `constants.scad`. Default: `CENTER`.
// Examples:
// acme_threaded_nut(od=16, id=3/8*25.4, h=8, pitch=1/8*25.4, slop=0.2);
// acme_threaded_nut(od=16, id=10, h=10, pitch=2, starts=3, slop=0.2, $fa=1, $fs=1);
@@ -511,7 +511,7 @@ module acme_threaded_nut(
bevel=false,
slop=PRINTER_SLOP,
orient=ORIENT_Z,
align=CENTER
anchor=CENTER
) {
trapezoidal_threaded_nut(
od=od, id=id, h=h, pitch=pitch,
@@ -522,7 +522,7 @@ module acme_threaded_nut(
starts=starts,
slop=slop,
orient=orient,
align=align
anchor=anchor
) children();
}
@@ -541,7 +541,7 @@ module acme_threaded_nut(
// bevel = if true, bevel the thread ends. Default: false
// starts = The number of lead starts. Default = 1
// orient = Orientation of the rod. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
// align = Alignment of the rod. Use the constants from `constants.scad`. Default: `CENTER`.
// anchor = Alignment of the rod. Use the constants from `constants.scad`. Default: `CENTER`.
// Examples:
// square_threaded_rod(d=10, l=30, pitch=2, starts=2, $fn=32);
module square_threaded_rod(
@@ -550,7 +550,7 @@ module square_threaded_rod(
bevel=false,
starts=1,
orient=ORIENT_Z,
align=CENTER
anchor=CENTER
) {
trapezoidal_threaded_rod(
d=d, l=l, pitch=pitch,
@@ -559,7 +559,7 @@ module square_threaded_rod(
bevel=bevel,
starts=starts,
orient=orient,
align=align
anchor=anchor
) children();
}
@@ -579,7 +579,7 @@ module square_threaded_rod(
// starts = The number of lead starts. Default = 1
// slop = printer slop calibration to allow for tight fitting of parts. default=0.2
// orient = Orientation of the nut. Use the `ORIENT_` constants from `constants.scad`. Default: `ORIENT_Z`.
// align = Alignment of the nut. Use the constants from `constants.scad`. Default: `CENTER`.
// anchor = Alignment of the nut. Use the constants from `constants.scad`. Default: `CENTER`.
// Examples:
// square_threaded_nut(od=16, id=10, h=10, pitch=2, starts=2, slop=0.15, $fn=32);
module square_threaded_nut(
@@ -590,7 +590,7 @@ module square_threaded_nut(
starts=1,
slop=PRINTER_SLOP,
orient=ORIENT_Z,
align=CENTER
anchor=CENTER
) {
trapezoidal_threaded_nut(
od=od, id=id, h=h, pitch=pitch,
@@ -600,7 +600,7 @@ module square_threaded_nut(
starts=starts,
slop=slop,
orient=orient,
align=align
anchor=anchor
) children();
}