Merge pull request #577 from revarbat/revarbat_dev

Revarbat dev
This commit is contained in:
Revar Desmera 2021-06-19 22:04:36 -07:00 committed by GitHub
commit 684a9dce90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 84 additions and 32 deletions

View file

@ -603,9 +603,9 @@ function generic_bottle_cap(
) = no_function("generic_bottle_cap"); ) = no_function("generic_bottle_cap");
// Module: thread_adapter_NC() // Module: bottle_adapter_neck_to_cap()
// Usage: // Usage:
// thread_adapter_NC(wall, <texture>); // bottle_adapter_neck_to_cap(wall, <texture>);
// Description: // Description:
// Creates a threaded neck to cap adapter // Creates a threaded neck to cap adapter
// Arguments: // Arguments:
@ -628,8 +628,8 @@ function generic_bottle_cap(
// d = Distance between bottom of neck and top of cap // d = Distance between bottom of neck and top of cap
// taper_lead_in = Length to leave straight before tapering on tube between neck and cap if exists. // taper_lead_in = Length to leave straight before tapering on tube between neck and cap if exists.
// Examples: // Examples:
// thread_adapter_NC(); // bottle_adapter_neck_to_cap();
module thread_adapter_NC( module bottle_adapter_neck_to_cap(
wall, wall,
texture = "none", texture = "none",
cap_wall = 2, cap_wall = 2,
@ -708,17 +708,17 @@ module thread_adapter_NC(
} }
} }
function thread_adapter_NC( function bottle_adapter_neck_to_cap(
wall, texture, cap_wall, cap_h, cap_thread_od, wall, texture, cap_wall, cap_h, cap_thread_od,
tolerance, cap_neck_od, cap_neck_id, cap_thread_taper, tolerance, cap_neck_od, cap_neck_id, cap_thread_taper,
cap_thread_pitch, neck_d, neck_id, neck_thread_od, cap_thread_pitch, neck_d, neck_id, neck_thread_od,
neck_h, neck_thread_pitch, neck_support_od, d, taper_lead_in neck_h, neck_thread_pitch, neck_support_od, d, taper_lead_in
) = no_fuction("thread_adapter_NC"); ) = no_fuction("bottle_adapter_neck_to_cap");
// Module: thread_adapter_CC() // Module: bottle_adapter_cap_to_cap()
// Usage: // Usage:
// thread_adapter_CC(wall, <texture>); // bottle_adapter_cap_to_cap(wall, <texture>);
// Description: // Description:
// Creates a threaded cap to cap adapter. // Creates a threaded cap to cap adapter.
// Arguments: // Arguments:
@ -738,8 +738,8 @@ function thread_adapter_NC(
// neck_id2 = Inner diameter of cutout in bottom cap. // neck_id2 = Inner diameter of cutout in bottom cap.
// taper_lead_in = Length to leave straight before tapering on tube between caps if exists. // taper_lead_in = Length to leave straight before tapering on tube between caps if exists.
// Examples: // Examples:
// thread_adapter_CC(); // bottle_adapter_cap_to_cap();
module thread_adapter_CC( module bottle_adapter_cap_to_cap(
wall = 2, wall = 2,
texture = "none", texture = "none",
cap_h1 = 11.2, cap_h1 = 11.2,
@ -822,16 +822,16 @@ module thread_adapter_CC(
} }
} }
function thread_adapter_CC( function bottle_adapter_cap_to_cap(
wall, texture, cap_h1, cap_thread_od1, tolerance, wall, texture, cap_h1, cap_thread_od1, tolerance,
cap_neck_od1, cap_thread_pitch1, cap_h2, cap_thread_od2, cap_neck_od1, cap_thread_pitch1, cap_h2, cap_thread_od2,
cap_neck_od2, cap_thread_pitch2, d, neck_id1, neck_id2, taper_lead_in cap_neck_od2, cap_thread_pitch2, d, neck_id1, neck_id2, taper_lead_in
) = no_function("thread_adapter_CC"); ) = no_function("bottle_adapter_cap_to_cap");
// Module: thread_adapter_NN() // Module: bottle_adapter_neck_to_neck()
// Usage: // Usage:
// thread_adapter_NN(); // bottle_adapter_neck_to_neck();
// Description: // Description:
// Creates a threaded neck to neck adapter. // Creates a threaded neck to neck adapter.
// Arguments: // Arguments:
@ -851,8 +851,8 @@ function thread_adapter_CC(
// taper_lead_in = Length to leave straight before tapering on tube between necks if exists. // taper_lead_in = Length to leave straight before tapering on tube between necks if exists.
// wall = Thickness of tube wall between necks. Leave undefined to match outer diameters with the neckODs/supportODs. // wall = Thickness of tube wall between necks. Leave undefined to match outer diameters with the neckODs/supportODs.
// Examples: // Examples:
// thread_adapter_NN(); // bottle_adapter_neck_to_neck();
module thread_adapter_NN( module bottle_adapter_neck_to_neck(
d = 0, d = 0,
neck_od1 = 25, neck_od1 = 25,
neck_id1 = 21.4, neck_id1 = 21.4,
@ -939,12 +939,12 @@ module thread_adapter_NN(
} }
} }
function thread_adapter_NN( function bottle_adapter_neck_to_neck(
d, neck_od1, neck_id1, thread_od1, height1, d, neck_od1, neck_id1, thread_od1, height1,
support_od1, thread_pitch1, neck_od2, neck_id2, support_od1, thread_pitch1, neck_od2, neck_id2,
thread_od2, height2, support_od2, thread_od2, height2, support_od2,
pitch2, taper_lead_in, wall pitch2, taper_lead_in, wall
) = no_fuction("thread_adapter_NN"); ) = no_fuction("bottle_adapter_neck_to_neck");

View file

@ -387,7 +387,9 @@ module show_anchors(s=10, std=true, custom=true) {
color("black") color("black")
noop($tags="anchor-arrow") { noop($tags="anchor-arrow") {
xrot(two_d? 0 : 90) { xrot(two_d? 0 : 90) {
up(s/10) { back(s/3) {
yrot_copies(n=2)
up(s/30) {
linear_extrude(height=0.01, convexity=12, center=true) { linear_extrude(height=0.01, convexity=12, center=true) {
text(text=anchor[0], size=s/4, halign="center", valign="center"); text(text=anchor[0], size=s/4, halign="center", valign="center");
} }
@ -395,6 +397,15 @@ module show_anchors(s=10, std=true, custom=true) {
} }
} }
} }
color([1, 1, 1, 0.4])
noop($tags="anchor-arrow") {
xrot(two_d? 0 : 90) {
back(s/3) {
zcopies(s/21) cube([s/4.5*len(anchor[0]), s/3, 0.01], center=true);
}
}
}
}
} }
} }
children(); children();

View file

@ -1535,6 +1535,9 @@ function spheroid(r, style="aligned", d, circum=false, anchor=CENTER, spin=0, or
// Usage: Typical // Usage: Typical
// teardrop(h|l, r, <ang>, <cap_h>, ...); // teardrop(h|l, r, <ang>, <cap_h>, ...);
// teardrop(h|l, d=, <ang=>, <cap_h=>, ...); // teardrop(h|l, d=, <ang=>, <cap_h=>, ...);
// Usage: Psuedo-Conical
// teardrop(h|l, r1=, r2=, <ang=>, <cap_h1=>, <cap_h2=>, ...);
// teardrop(h|l, d1=, d2=, <ang=>, <cap_h1=>, <cap_h2=>, ...);
// Usage: Attaching Children // Usage: Attaching Children
// teardrop(h|l, r, ...) <attachments>; // teardrop(h|l, r, ...) <attachments>;
// //
@ -1544,33 +1547,71 @@ function spheroid(r, style="aligned", d, circum=false, anchor=CENTER, spin=0, or
// ang = Angle of hat walls from the Z axis. Default: 45 degrees // ang = Angle of hat walls from the Z axis. Default: 45 degrees
// cap_h = If given, height above center where the shape will be truncated. Default: `undef` (no truncation) // cap_h = If given, height above center where the shape will be truncated. Default: `undef` (no truncation)
// --- // ---
// d = Diameter of circular portion of bottom. (Use instead of r) // r1 = Radius of circular portion of the front end of the teardrop shape.
// r2 = Radius of circular portion of the back end of the teardrop shape.
// d = Diameter of circular portion of the teardrop shape.
// d1 = Diameter of circular portion of the front end of the teardrop shape.
// d2 = Diameter of circular portion of the back end of the teardrop shape.
// cap_h1 = If given, height above center where the shape will be truncated, on the front side. Default: `undef` (no truncation)
// cap_h2 = If given, height above center where the shape will be truncated, on the back side. Default: `undef` (no truncation)
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0`
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP`
// //
// Extra Anchors:
// cap = The center of the top of the cap, oriented with the cap face normal.
// cap_fwd = The front edge of the cap.
// cap_back = The back edge of the cap.
//
// Example: Typical Shape // Example: Typical Shape
// teardrop(r=30, h=10, ang=30); // teardrop(r=30, h=10, ang=30);
// Example: Crop Cap // Example: Crop Cap
// teardrop(r=30, h=10, ang=30, cap_h=40); // teardrop(r=30, h=10, ang=30, cap_h=40);
// Example: Close Crop // Example: Close Crop
// teardrop(r=30, h=10, ang=30, cap_h=20); // teardrop(r=30, h=10, ang=30, cap_h=20);
// Example: Standard Connectors // Example: Psuedo-Conical
// teardrop(r=30, h=10, ang=30) show_anchors(); // teardrop(r1=20, r2=30, h=40, cap_h1=25, cap_h2=35);
module teardrop(h, r, ang=45, cap_h, d, l, anchor=CENTER, spin=0, orient=UP) // Example: Standard Conical Connectors
// teardrop(d1=20, d2=30, h=20, cap_h1=11, cap_h2=16)
// show_anchors(custom=false);
// Example(Spin,VPD=275): Named Conical Connectors
// teardrop(d1=20, d2=30, h=20, cap_h1=11, cap_h2=16)
// show_anchors(std=false);
module teardrop(h, r, ang=45, cap_h, r1, r2, d, d1, d2, cap_h1, cap_h2, l, anchor=CENTER, spin=0, orient=UP)
{ {
r = get_radius(r=r, d=d, dflt=1); r1 = get_radius(r=r, r1=r1, d=d, d1=d1, dflt=1);
r2 = get_radius(r=r, r1=r2, d=d, d1=d2, dflt=1);
l = first_defined([l, h, 1]); l = first_defined([l, h, 1]);
tip_y = adj_ang_to_hyp(r, 90-ang); tip_y1 = adj_ang_to_hyp(r1, 90-ang);
cap_h = min(default(cap_h,tip_y), tip_y); tip_y2 = adj_ang_to_hyp(r2, 90-ang);
cap_h1 = min(first_defined([cap_h1, cap_h, tip_y1]), tip_y1);
cap_h2 = min(first_defined([cap_h2, cap_h, tip_y2]), tip_y2);
capvec = unit([0, cap_h1-cap_h2, l]);
anchors = [ anchors = [
["cap", [0,0,cap_h], UP, 0] anchorpt("cap", [0,0,(cap_h1+cap_h2)/2], capvec),
anchorpt("cap_fwd", [0,-l/2,cap_h1], unit((capvec+FWD)/2)),
anchorpt("cap_back", [0,+l/2,cap_h2], unit((capvec+BACK)/2), 180),
]; ];
attachable(anchor,spin,orient, r=r, l=l, axis=BACK, anchors=anchors) { attachable(anchor,spin,orient, r1=r1, r2=r2, l=l, axis=BACK, anchors=anchors) {
rot(from=UP,to=FWD) { rot(from=UP,to=FWD) {
if (l > 0) { if (l > 0) {
if (r1 == r2) {
linear_extrude(height=l, center=true, slices=2) { linear_extrude(height=l, center=true, slices=2) {
teardrop2d(r=r, ang=ang, cap_h=cap_h); teardrop2d(r=r1, ang=ang, cap_h=cap_h);
}
} else {
hull() {
up(l/2-0.001) {
linear_extrude(height=0.001, center=false) {
teardrop2d(r=r1, ang=ang, cap_h=cap_h1);
}
}
down(l/2) {
linear_extrude(height=0.001, center=false) {
teardrop2d(r=r2, ang=ang, cap_h=cap_h2);
}
}
}
} }
} }
} }