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");
// Module: thread_adapter_NC()
// Module: bottle_adapter_neck_to_cap()
// Usage:
// thread_adapter_NC(wall, <texture>);
// bottle_adapter_neck_to_cap(wall, <texture>);
// Description:
// Creates a threaded neck to cap adapter
// Arguments:
@ -628,8 +628,8 @@ function generic_bottle_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.
// Examples:
// thread_adapter_NC();
module thread_adapter_NC(
// bottle_adapter_neck_to_cap();
module bottle_adapter_neck_to_cap(
wall,
texture = "none",
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,
tolerance, cap_neck_od, cap_neck_id, cap_thread_taper,
cap_thread_pitch, neck_d, neck_id, neck_thread_od,
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:
// thread_adapter_CC(wall, <texture>);
// bottle_adapter_cap_to_cap(wall, <texture>);
// Description:
// Creates a threaded cap to cap adapter.
// Arguments:
@ -738,8 +738,8 @@ function thread_adapter_NC(
// neck_id2 = Inner diameter of cutout in bottom cap.
// taper_lead_in = Length to leave straight before tapering on tube between caps if exists.
// Examples:
// thread_adapter_CC();
module thread_adapter_CC(
// bottle_adapter_cap_to_cap();
module bottle_adapter_cap_to_cap(
wall = 2,
texture = "none",
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,
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
) = no_function("thread_adapter_CC");
) = no_function("bottle_adapter_cap_to_cap");
// Module: thread_adapter_NN()
// Module: bottle_adapter_neck_to_neck()
// Usage:
// thread_adapter_NN();
// bottle_adapter_neck_to_neck();
// Description:
// Creates a threaded neck to neck adapter.
// Arguments:
@ -851,8 +851,8 @@ function thread_adapter_CC(
// 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.
// Examples:
// thread_adapter_NN();
module thread_adapter_NN(
// bottle_adapter_neck_to_neck();
module bottle_adapter_neck_to_neck(
d = 0,
neck_od1 = 25,
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,
support_od1, thread_pitch1, neck_od2, neck_id2,
thread_od2, height2, support_od2,
pitch2, taper_lead_in, wall
) = no_fuction("thread_adapter_NN");
) = no_fuction("bottle_adapter_neck_to_neck");

View file

@ -387,13 +387,24 @@ module show_anchors(s=10, std=true, custom=true) {
color("black")
noop($tags="anchor-arrow") {
xrot(two_d? 0 : 90) {
up(s/10) {
linear_extrude(height=0.01, convexity=12, center=true) {
text(text=anchor[0], size=s/4, halign="center", valign="center");
back(s/3) {
yrot_copies(n=2)
up(s/30) {
linear_extrude(height=0.01, convexity=12, center=true) {
text(text=anchor[0], size=s/4, halign="center", valign="center");
}
}
}
}
}
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);
}
}
}
}
}
}

View file

@ -1535,6 +1535,9 @@ function spheroid(r, style="aligned", d, circum=false, anchor=CENTER, spin=0, or
// Usage: Typical
// teardrop(h|l, r, <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
// 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
// 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`
// 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`
//
// 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
// teardrop(r=30, h=10, ang=30);
// Example: Crop Cap
// teardrop(r=30, h=10, ang=30, cap_h=40);
// Example: Close Crop
// teardrop(r=30, h=10, ang=30, cap_h=20);
// Example: Standard Connectors
// teardrop(r=30, h=10, ang=30) show_anchors();
module teardrop(h, r, ang=45, cap_h, d, l, anchor=CENTER, spin=0, orient=UP)
// Example: Psuedo-Conical
// teardrop(r1=20, r2=30, h=40, cap_h1=25, cap_h2=35);
// 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]);
tip_y = adj_ang_to_hyp(r, 90-ang);
cap_h = min(default(cap_h,tip_y), tip_y);
tip_y1 = adj_ang_to_hyp(r1, 90-ang);
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 = [
["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) {
if (l > 0) {
linear_extrude(height=l, center=true, slices=2) {
teardrop2d(r=r, ang=ang, cap_h=cap_h);
if (r1 == r2) {
linear_extrude(height=l, center=true, slices=2) {
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);
}
}
}
}
}
}