rename anchorpt to named_anchor

This commit is contained in:
Adrian Mariano 2021-09-16 18:32:12 -04:00
parent 32d9a96bc4
commit fd0bcc0903
8 changed files with 116 additions and 116 deletions

View file

@ -1008,9 +1008,9 @@ module attachable(
// Function: anchorpt()
// Function: named_anchor()
// Usage:
// a = anchorpt(name, pos, [orient], [spin]);
// a = named_anchor(name, pos, [orient], [spin]);
// Topics: Attachments
// See Also: reorient(), attachable()
// Description:
@ -1021,7 +1021,7 @@ module attachable(
// pos = The [X,Y,Z] position of the anchor.
// orient = A vector pointing in the direction parts should project from the anchor position.
// spin = If needed, the angle to rotate the part around the direction vector.
function anchorpt(name, pos=[0,0,0], orient=UP, spin=0) = [name, pos, orient, spin];
function named_anchor(name, pos=[0,0,0], orient=UP, spin=0) = [name, pos, orient, spin];
// Function: reorient()

View file

@ -67,8 +67,8 @@ module pco1810_neck(wall=2, anchor="support-ring", spin=0, orient=UP)
h = support_h+neck_h;
thread_h = (thread_od-threadbase_d)/2;
anchors = [
anchorpt("support-ring", [0,0,neck_h-h/2]),
anchorpt("tamper-ring", [0,0,h/2-tamper_base_h])
named_anchor("support-ring", [0,0,neck_h-h/2]),
named_anchor("tamper-ring", [0,0,h/2-tamper_base_h])
];
attachable(anchor,spin,orient, d1=neck_d, d2=lip_recess_d+2*lip_leadin_r, l=h, anchors=anchors) {
down(h/2) {
@ -173,7 +173,7 @@ module pco1810_cap(wall=2, texture="none", anchor=BOTTOM, spin=0, orient=UP)
w = cap_id + 2*wall;
h = tamper_ring_h + wall;
anchors = [
anchorpt("inside-top", [0,0,-(h/2-wall)])
named_anchor("inside-top", [0,0,-(h/2-wall)])
];
attachable(anchor,spin,orient, d=w, l=h, anchors=anchors) {
down(h/2) zrot(45) {
@ -260,8 +260,8 @@ module pco1881_neck(wall=2, anchor="support-ring", spin=0, orient=UP)
h = support_h+neck_h;
thread_h = (thread_od-threadbase_d)/2;
anchors = [
anchorpt("support-ring", [0,0,neck_h-h/2]),
anchorpt("tamper-ring", [0,0,h/2-tamper_base_h])
named_anchor("support-ring", [0,0,neck_h-h/2]),
named_anchor("tamper-ring", [0,0,h/2-tamper_base_h])
];
attachable(anchor,spin,orient, d1=neck_d, d2=lip_recess_d+2*lip_leadin_r, l=h, anchors=anchors) {
down(h/2) {
@ -357,7 +357,7 @@ module pco1881_cap(wall=2, texture="none", anchor=BOTTOM, spin=0, orient=UP)
w = 28.58 + 2*wall;
h = 11.2 + wall;
anchors = [
anchorpt("inside-top", [0,0,-(h/2-wall)])
named_anchor("inside-top", [0,0,-(h/2-wall)])
];
attachable(anchor,spin,orient, d=w, l=h, anchors=anchors) {
down(h/2) zrot(45) {
@ -448,7 +448,7 @@ module generic_bottle_neck(
$fn = segs(33 / 2);
thread_h = (thread_od - threadbase_d) / 2;
anchors = [
anchorpt("support-ring", [0, 0, 0 - h / 2])
named_anchor("support-ring", [0, 0, 0 - h / 2])
];
attachable(anchor, spin, orient, d1 = neck_d, d2 = 0, l = h, anchors = anchors) {
down(h / 2) {
@ -563,7 +563,7 @@ module generic_bottle_cap(
heightMagMult = (height > 11.2) ? height / 11.2 : 1;
anchors = [
anchorpt("inside-top", [0, 0, -(h / 2 - wall)])
named_anchor("inside-top", [0, 0, -(h / 2 - wall)])
];
attachable(anchor, spin, orient, d = w, l = h, anchors = anchors) {
down(h / 2) {

View file

@ -579,12 +579,12 @@ function rack2d(
xd = d * sin(pressure_angle),
l = teeth * pitch,
anchors = [
anchorpt("adendum", [ 0, a,0], BACK),
anchorpt("adendum-left", [-l/2, a,0], LEFT),
anchorpt("adendum-right", [ l/2, a,0], RIGHT),
anchorpt("dedendum", [ 0,-d,0], BACK),
anchorpt("dedendum-left", [-l/2,-d,0], LEFT),
anchorpt("dedendum-right", [ l/2,-d,0], RIGHT),
named_anchor("adendum", [ 0, a,0], BACK),
named_anchor("adendum-left", [-l/2, a,0], LEFT),
named_anchor("adendum-right", [ l/2, a,0], RIGHT),
named_anchor("dedendum", [ 0,-d,0], BACK),
named_anchor("dedendum-left", [-l/2,-d,0], LEFT),
named_anchor("dedendum-right", [ l/2,-d,0], RIGHT),
],
path = [
[-(teeth-1)/2 * pitch + -1/2 * pitch, a-height],
@ -619,12 +619,12 @@ module rack2d(
d = dedendum(pitch, clearance);
l = teeth * pitch;
anchors = [
anchorpt("adendum", [ 0, a,0], BACK),
anchorpt("adendum-left", [-l/2, a,0], LEFT),
anchorpt("adendum-right", [ l/2, a,0], RIGHT),
anchorpt("dedendum", [ 0,-d,0], BACK),
anchorpt("dedendum-left", [-l/2,-d,0], LEFT),
anchorpt("dedendum-right", [ l/2,-d,0], RIGHT),
named_anchor("adendum", [ 0, a,0], BACK),
named_anchor("adendum-left", [-l/2, a,0], LEFT),
named_anchor("adendum-right", [ l/2, a,0], RIGHT),
named_anchor("dedendum", [ 0,-d,0], BACK),
named_anchor("dedendum-left", [-l/2,-d,0], LEFT),
named_anchor("dedendum-right", [ l/2,-d,0], RIGHT),
];
path = rack2d(
pitch = pitch,
@ -994,9 +994,9 @@ function bevel_gear(
lvnf = left_handed? vnf1 : xflip(p=vnf1),
vnf = down(cpz, p=lvnf),
anchors = [
anchorpt("pitchbase", [0,0,pitchoff-thickness/2]),
anchorpt("flattop", [0,0,thickness/2]),
anchorpt("apex", [0,0,hyp_ang_to_opp(ocone_rad,90-pitch_angle)+pitchoff-thickness/2])
named_anchor("pitchbase", [0,0,pitchoff-thickness/2]),
named_anchor("flattop", [0,0,thickness/2]),
named_anchor("apex", [0,0,hyp_ang_to_opp(ocone_rad,90-pitch_angle)+pitchoff-thickness/2])
]
) reorient(anchor,spin,orient, vnf=vnf, extent=true, anchors=anchors, p=vnf);
@ -1048,9 +1048,9 @@ module bevel_gear(
axis_zs = [for (p=vnf[0]) if(norm(point2d(p)) < EPSILON) p.z];
thickness = max(axis_zs) - min(axis_zs);
anchors = [
anchorpt("pitchbase", [0,0,pitchoff-thickness/2]),
anchorpt("flattop", [0,0,thickness/2]),
anchorpt("apex", [0,0,adj_ang_to_opp(pr,90-pitch_angle)+pitchoff-thickness/2])
named_anchor("pitchbase", [0,0,pitchoff-thickness/2]),
named_anchor("flattop", [0,0,thickness/2]),
named_anchor("apex", [0,0,adj_ang_to_opp(pr,90-pitch_angle)+pitchoff-thickness/2])
];
attachable(anchor,spin,orient, r1=pr, r2=ipr, h=thickness, anchors=anchors) {
difference() {
@ -1137,16 +1137,16 @@ module rack(
d = dedendum(pitch, clearance);
l = teeth * pitch;
anchors = [
anchorpt("adendum", [0,0,a], BACK),
anchorpt("adendum-left", [-l/2,0,a], LEFT),
anchorpt("adendum-right", [ l/2,0,a], RIGHT),
anchorpt("adendum-front", [0,-thickness/2,a], DOWN),
anchorpt("adendum-back", [0, thickness/2,a], UP),
anchorpt("dedendum", [0,0,-d], BACK),
anchorpt("dedendum-left", [-l/2,0,-d], LEFT),
anchorpt("dedendum-right", [ l/2,0,-d], RIGHT),
anchorpt("dedendum-front", [0,-thickness/2,-d], DOWN),
anchorpt("dedendum-back", [0, thickness/2,-d], UP),
named_anchor("adendum", [0,0,a], BACK),
named_anchor("adendum-left", [-l/2,0,a], LEFT),
named_anchor("adendum-right", [ l/2,0,a], RIGHT),
named_anchor("adendum-front", [0,-thickness/2,a], DOWN),
named_anchor("adendum-back", [0, thickness/2,a], UP),
named_anchor("dedendum", [0,0,-d], BACK),
named_anchor("dedendum-left", [-l/2,0,-d], LEFT),
named_anchor("dedendum-right", [ l/2,0,-d], RIGHT),
named_anchor("dedendum-front", [0,-thickness/2,-d], DOWN),
named_anchor("dedendum-back", [0, thickness/2,-d], UP),
];
attachable(anchor,spin,orient, size=[l, thickness, 2*abs(a-height)], anchors=anchors) {
skew(sxy=tan(helical)) xrot(90) {
@ -1186,16 +1186,16 @@ function rack(
d = dedendum(pitch, clearance),
l = teeth * pitch,
anchors = [
anchorpt("adendum", [0,0,a], BACK),
anchorpt("adendum-left", [-l/2,0,a], LEFT),
anchorpt("adendum-right", [ l/2,0,a], RIGHT),
anchorpt("adendum-front", [0,-thickness/2,a], DOWN),
anchorpt("adendum-back", [0, thickness/2,a], UP),
anchorpt("dedendum", [0,0,-d], BACK),
anchorpt("dedendum-left", [-l/2,0,-d], LEFT),
anchorpt("dedendum-right", [ l/2,0,-d], RIGHT),
anchorpt("dedendum-front", [0,-thickness/2,-d], DOWN),
anchorpt("dedendum-back", [0, thickness/2,-d], UP),
named_anchor("adendum", [0,0,a], BACK),
named_anchor("adendum-left", [-l/2,0,a], LEFT),
named_anchor("adendum-right", [ l/2,0,a], RIGHT),
named_anchor("adendum-front", [0,-thickness/2,a], DOWN),
named_anchor("adendum-back", [0, thickness/2,a], UP),
named_anchor("dedendum", [0,0,-d], BACK),
named_anchor("dedendum-left", [-l/2,0,-d], LEFT),
named_anchor("dedendum-right", [ l/2,0,-d], RIGHT),
named_anchor("dedendum-front", [0,-thickness/2,-d], DOWN),
named_anchor("dedendum-back", [0, thickness/2,-d], UP),
],
path = rack2d(
pitch = pitch,

View file

@ -86,9 +86,9 @@ module linear_bearing_housing(d=15, l=24, tab=7, gap=5, wall=3, tabwall=5, screw
tabh = tab/2+od/2*sqrt(2)-ogap/2;
h = od+tab/2;
anchors = [
anchorpt("axis", [0,0,-tab/2/2]),
anchorpt("screw", [0,2-ogap/2,tabh-tab/2/2],FWD),
anchorpt("nut", [0,ogap/2-2,tabh-tab/2/2],FWD)
named_anchor("axis", [0,0,-tab/2/2]),
named_anchor("screw", [0,2-ogap/2,tabh-tab/2/2],FWD),
named_anchor("nut", [0,ogap/2-2,tabh-tab/2/2],FWD)
];
attachable(anchor,spin,orient, size=[l, od, h], anchors=anchors) {
down(tab/2/2)

View file

@ -395,8 +395,8 @@ module generic_screw(
) {
sides = max(12, segs(screwsize/2));
anchors = [
anchorpt("countersunk", [0,0,(headlen+screwlen)/2-0.01]),
anchorpt("base", [0,0,-headlen/2+screwlen/2])
named_anchor("countersunk", [0,0,(headlen+screwlen)/2-0.01]),
named_anchor("base", [0,0,-headlen/2+screwlen/2])
];
attachable(anchor,spin,orient, d=screwsize, l=headlen+screwlen, anchors=anchors) {
down(headlen/2-screwlen/2) {
@ -517,9 +517,9 @@ module metric_bolt(
);
anchors = [
anchorpt("countersunk", [0,0,base+sunklen]),
anchorpt("base", [0,0,base]),
anchorpt("shank", [0,0,base-shank])
named_anchor("countersunk", [0,0,base+sunklen]),
named_anchor("base", [0,0,base]),
named_anchor("shank", [0,0,base-shank])
];
//color("silver")

View file

@ -122,14 +122,14 @@ module nema11_stepper(h=24, shaft=5, shaft_len=20, anchor=TOP, spin=0, orient=UP
screw_depth = nema_motor_screw_depth(size);
anchors = [
anchorpt("shaft-top", [0,0,h/2+shaft_len]),
anchorpt("shaft-middle", [0,0,h/2+plinth_height+(shaft_len-plinth_height)/2]),
anchorpt("shaft-bottom", [0,0,h/2+plinth_height+0.1]),
anchorpt("plinth-top", [0,0,h/2+plinth_height]),
anchorpt("screw1", [+screw_spacing/2, +screw_spacing/2, h/2]),
anchorpt("screw2", [-screw_spacing/2, +screw_spacing/2, h/2]),
anchorpt("screw3", [-screw_spacing/2, -screw_spacing/2, h/2]),
anchorpt("screw4", [+screw_spacing/2, -screw_spacing/2, h/2]),
named_anchor("shaft-top", [0,0,h/2+shaft_len]),
named_anchor("shaft-middle", [0,0,h/2+plinth_height+(shaft_len-plinth_height)/2]),
named_anchor("shaft-bottom", [0,0,h/2+plinth_height+0.1]),
named_anchor("plinth-top", [0,0,h/2+plinth_height]),
named_anchor("screw1", [+screw_spacing/2, +screw_spacing/2, h/2]),
named_anchor("screw2", [-screw_spacing/2, +screw_spacing/2, h/2]),
named_anchor("screw3", [-screw_spacing/2, -screw_spacing/2, h/2]),
named_anchor("screw4", [+screw_spacing/2, -screw_spacing/2, h/2]),
];
attachable(anchor,spin,orient, size=[motor_width, motor_width, h], anchors=anchors) {
up(h/2)
@ -187,14 +187,14 @@ module nema14_stepper(h=24, shaft=5, shaft_len=24, anchor=TOP, spin=0, orient=UP
screw_depth = nema_motor_screw_depth(size);
anchors = [
anchorpt("shaft-top", [0,0,h/2+shaft_len]),
anchorpt("shaft-middle", [0,0,h/2+plinth_height+(shaft_len-plinth_height)/2]),
anchorpt("shaft-bottom", [0,0,h/2+plinth_height+0.1]),
anchorpt("plinth-top", [0,0,h/2+plinth_height]),
anchorpt("screw1", [+screw_spacing/2, +screw_spacing/2, h/2]),
anchorpt("screw2", [-screw_spacing/2, +screw_spacing/2, h/2]),
anchorpt("screw3", [-screw_spacing/2, -screw_spacing/2, h/2]),
anchorpt("screw4", [+screw_spacing/2, -screw_spacing/2, h/2]),
named_anchor("shaft-top", [0,0,h/2+shaft_len]),
named_anchor("shaft-middle", [0,0,h/2+plinth_height+(shaft_len-plinth_height)/2]),
named_anchor("shaft-bottom", [0,0,h/2+plinth_height+0.1]),
named_anchor("plinth-top", [0,0,h/2+plinth_height]),
named_anchor("screw1", [+screw_spacing/2, +screw_spacing/2, h/2]),
named_anchor("screw2", [-screw_spacing/2, +screw_spacing/2, h/2]),
named_anchor("screw3", [-screw_spacing/2, -screw_spacing/2, h/2]),
named_anchor("screw4", [+screw_spacing/2, -screw_spacing/2, h/2]),
];
attachable(anchor,spin,orient, size=[motor_width, motor_width, h], anchors=anchors) {
up(h/2)
@ -252,14 +252,14 @@ module nema17_stepper(h=34, shaft=5, shaft_len=20, anchor=TOP, spin=0, orient=UP
screw_depth = nema_motor_screw_depth(size);
anchors = [
anchorpt("shaft-top", [0,0,h/2+shaft_len]),
anchorpt("shaft-middle", [0,0,h/2+plinth_height+(shaft_len-plinth_height)/2]),
anchorpt("shaft-bottom", [0,0,h/2+plinth_height+0.1]),
anchorpt("plinth-top", [0,0,h/2+plinth_height]),
anchorpt("screw1", [+screw_spacing/2, +screw_spacing/2, h/2]),
anchorpt("screw2", [-screw_spacing/2, +screw_spacing/2, h/2]),
anchorpt("screw3", [-screw_spacing/2, -screw_spacing/2, h/2]),
anchorpt("screw4", [+screw_spacing/2, -screw_spacing/2, h/2]),
named_anchor("shaft-top", [0,0,h/2+shaft_len]),
named_anchor("shaft-middle", [0,0,h/2+plinth_height+(shaft_len-plinth_height)/2]),
named_anchor("shaft-bottom", [0,0,h/2+plinth_height+0.1]),
named_anchor("plinth-top", [0,0,h/2+plinth_height]),
named_anchor("screw1", [+screw_spacing/2, +screw_spacing/2, h/2]),
named_anchor("screw2", [-screw_spacing/2, +screw_spacing/2, h/2]),
named_anchor("screw3", [-screw_spacing/2, -screw_spacing/2, h/2]),
named_anchor("screw4", [+screw_spacing/2, -screw_spacing/2, h/2]),
];
attachable(anchor,spin,orient, size=[motor_width, motor_width, h], anchors=anchors) {
up(h/2)
@ -337,14 +337,14 @@ module nema23_stepper(h=50, shaft=6.35, shaft_len=25, anchor=TOP, spin=0, orient
screw_inset = motor_width - screw_spacing + 1;
anchors = [
anchorpt("shaft-top", [0,0,h/2+shaft_len]),
anchorpt("shaft-middle", [0,0,h/2+plinth_height+(shaft_len-plinth_height)/2]),
anchorpt("shaft-bottom", [0,0,h/2+plinth_height+0.1]),
anchorpt("plinth-top", [0,0,h/2+plinth_height]),
anchorpt("screw1", [+screw_spacing/2, +screw_spacing/2, h/2]),
anchorpt("screw2", [-screw_spacing/2, +screw_spacing/2, h/2]),
anchorpt("screw3", [-screw_spacing/2, -screw_spacing/2, h/2]),
anchorpt("screw4", [+screw_spacing/2, -screw_spacing/2, h/2]),
named_anchor("shaft-top", [0,0,h/2+shaft_len]),
named_anchor("shaft-middle", [0,0,h/2+plinth_height+(shaft_len-plinth_height)/2]),
named_anchor("shaft-bottom", [0,0,h/2+plinth_height+0.1]),
named_anchor("plinth-top", [0,0,h/2+plinth_height]),
named_anchor("screw1", [+screw_spacing/2, +screw_spacing/2, h/2]),
named_anchor("screw2", [-screw_spacing/2, +screw_spacing/2, h/2]),
named_anchor("screw3", [-screw_spacing/2, -screw_spacing/2, h/2]),
named_anchor("screw4", [+screw_spacing/2, -screw_spacing/2, h/2]),
];
attachable(anchor,spin,orient, size=[motor_width, motor_width, h], anchors=anchors) {
up(h/2)
@ -404,14 +404,14 @@ module nema34_stepper(h=75, shaft=12.7, shaft_len=32, anchor=TOP, spin=0, orient
screw_inset = motor_width - screw_spacing + 1;
anchors = [
anchorpt("shaft-top", [0,0,h/2+shaft_len]),
anchorpt("shaft-middle", [0,0,h/2+plinth_height+(shaft_len-plinth_height)/2]),
anchorpt("shaft-bottom", [0,0,h/2+plinth_height+0.1]),
anchorpt("plinth-top", [0,0,h/2+plinth_height]),
anchorpt("screw1", [+screw_spacing/2, +screw_spacing/2, h/2]),
anchorpt("screw2", [-screw_spacing/2, +screw_spacing/2, h/2]),
anchorpt("screw3", [-screw_spacing/2, -screw_spacing/2, h/2]),
anchorpt("screw4", [+screw_spacing/2, -screw_spacing/2, h/2]),
named_anchor("shaft-top", [0,0,h/2+shaft_len]),
named_anchor("shaft-middle", [0,0,h/2+plinth_height+(shaft_len-plinth_height)/2]),
named_anchor("shaft-bottom", [0,0,h/2+plinth_height+0.1]),
named_anchor("plinth-top", [0,0,h/2+plinth_height]),
named_anchor("screw1", [+screw_spacing/2, +screw_spacing/2, h/2]),
named_anchor("screw2", [-screw_spacing/2, +screw_spacing/2, h/2]),
named_anchor("screw3", [-screw_spacing/2, -screw_spacing/2, h/2]),
named_anchor("screw4", [+screw_spacing/2, -screw_spacing/2, h/2]),
];
attachable(anchor,spin,orient, size=[motor_width, motor_width, h], anchors=anchors) {
up(h/2)
@ -472,10 +472,10 @@ module nema_mount_holes(size=17, depth=5, l=5, anchor=CENTER, spin=0, orient=UP)
screw_size = nema_motor_screw_size(size)+$slop;
anchors = [
anchorpt("screw1", [+screw_spacing/2, +screw_spacing/2, depth/2]),
anchorpt("screw2", [-screw_spacing/2, +screw_spacing/2, depth/2]),
anchorpt("screw3", [-screw_spacing/2, -screw_spacing/2, depth/2]),
anchorpt("screw4", [+screw_spacing/2, -screw_spacing/2, depth/2]),
named_anchor("screw1", [+screw_spacing/2, +screw_spacing/2, depth/2]),
named_anchor("screw2", [-screw_spacing/2, +screw_spacing/2, depth/2]),
named_anchor("screw3", [-screw_spacing/2, -screw_spacing/2, depth/2]),
named_anchor("screw4", [+screw_spacing/2, -screw_spacing/2, depth/2]),
];
screwfn = quantup(max(8,segs(screw_size/2)),4);
plinthfn = quantup(max(8,segs(plinth_diam/2)),4);

View file

@ -279,8 +279,8 @@ function regular_ngon(n=6, r, d, or, od, ir, id, side, rounding=0, realign=false
tipp = apply(mat, polar_to_xy(r-inset+rounding,a1)),
pos = (p1+p2)/2
) each [
anchorpt(str("tip",i), tipp, unit(tipp,BACK), 0),
anchorpt(str("side",i), pos, unit(pos,BACK), 0),
named_anchor(str("tip",i), tipp, unit(tipp,BACK), 0),
named_anchor(str("side",i), pos, unit(pos,BACK), 0),
]
]
) reorient(anchor,spin, two_d=true, path=path, extent=false, p=path, anchors=anchors);
@ -308,8 +308,8 @@ module regular_ngon(n=6, r, d, or, od, ir, id, side, rounding=0, realign=false,
tipp = apply(mat, polar_to_xy(r-inset+rounding,a1)),
pos = (p1+p2)/2
) each [
anchorpt(str("tip",i), tipp, unit(tipp,BACK), 0),
anchorpt(str("side",i), pos, unit(pos,BACK), 0),
named_anchor(str("tip",i), tipp, unit(tipp,BACK), 0),
named_anchor(str("side",i), pos, unit(pos,BACK), 0),
]
];
path = regular_ngon(n=n, r=r, rounding=rounding, _mat=mat, _anchs=anchors);
@ -694,9 +694,9 @@ function star(n, r, ir, d, or, od, id, step, realign=false, align_tip, align_pit
p3 = apply(mat, polar_to_xy(r,a3)),
pos = (p1+p3)/2
) each [
anchorpt(str("tip",i), p1, unit(p1,BACK), 0),
anchorpt(str("pit",i), p2, unit(p2,BACK), 0),
anchorpt(str("midpt",i), pos, unit(pos,BACK), 0),
named_anchor(str("tip",i), p1, unit(p1,BACK), 0),
named_anchor(str("pit",i), p2, unit(p2,BACK), 0),
named_anchor(str("midpt",i), pos, unit(pos,BACK), 0),
]
]
) reorient(anchor,spin, two_d=true, path=path, p=path, anchors=anchors);
@ -724,9 +724,9 @@ module star(n, r, ir, d, or, od, id, step, realign=false, align_tip, align_pit,
p3 = apply(mat, polar_to_xy(r,a3)),
pos = (p1+p3)/2
) each [
anchorpt(str("tip",i), p1, unit(p1,BACK), 0),
anchorpt(str("pit",i), p2, unit(p2,BACK), 0),
anchorpt(str("midpt",i), pos, unit(pos,BACK), 0),
named_anchor(str("tip",i), p1, unit(p1,BACK), 0),
named_anchor(str("pit",i), p2, unit(p2,BACK), 0),
named_anchor(str("midpt",i), pos, unit(pos,BACK), 0),
]
];
path = star(n=n, r=r, ir=ir, realign=realign, _mat=mat, _anchs=anchors);
@ -1007,7 +1007,7 @@ module reuleaux_polygon(N=3, r, d, anchor=CENTER, spin=0) {
for (i = [0:1:N-1]) let(
ca = 360 - i * 360/N,
cp = polar_to_xy(r, ca)
) anchorpt(str("tip",i), cp, unit(cp,BACK), 0),
) named_anchor(str("tip",i), cp, unit(cp,BACK), 0),
];
attachable(anchor,spin, two_d=true, path=path, anchors=anchors) {
polygon(path);
@ -1034,7 +1034,7 @@ function reuleaux_polygon(N=3, r, d, anchor=CENTER, spin=0) =
for (i = [0:1:N-1]) let(
ca = 360 - i * 360/N,
cp = polar_to_xy(r, ca)
) anchorpt(str("tip",i), cp, unit(cp,BACK), 0),
) named_anchor(str("tip",i), cp, unit(cp,BACK), 0),
]
) reorient(anchor,spin, two_d=true, path=path, anchors=anchors, p=path);

View file

@ -1614,9 +1614,9 @@ module teardrop(h, r, ang=45, cap_h, r1, r2, d, d1, d2, cap_h1, cap_h2, l, ancho
cap_h2 = min(first_defined([cap_h2, cap_h, tip_y2]), tip_y2);
capvec = unit([0, cap_h1-cap_h2, l]);
anchors = [
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),
named_anchor("cap", [0,0,(cap_h1+cap_h2)/2], capvec),
named_anchor("cap_fwd", [0,-l/2,cap_h1], unit((capvec+FWD)/2)),
named_anchor("cap_back", [0,+l/2,cap_h2], unit((capvec+BACK)/2), 180),
];
attachable(anchor,spin,orient, r1=r1, r2=r2, l=l, axis=BACK, anchors=anchors) {
rot(from=UP,to=FWD) {