Skip to content

Commit 7d9af29

Browse files
Fix show_anchors() so labels and text align correctly
1 parent bc110a2 commit 7d9af29

1 file changed

Lines changed: 24 additions & 21 deletions

File tree

attachments.scad

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3871,34 +3871,37 @@ module show_anchors(s=10, std=true, custom=true) {
38713871
}
38723872
}
38733873
}
3874+
textsize = s/4;
38743875
if (custom) {
38753876
for (anchor=last($parent_geom)) {
3876-
attach(anchor[0],BOT) {
3877+
attach(anchor[0]) {
38773878
if(two_d) {
38783879
anchor_arrow2d(s, color="cyan");
38793880
} else {
38803881
anchor_arrow(s, color="cyan");
38813882
}
3882-
color("black")
3883+
3884+
color("white")
38833885
tag("anchor-arrow") {
3884-
xrot(two_d? 0 : 90) {
3885-
back(s/3) {
3886-
yrot_copies(n=2)
3887-
up(two_d? 0.51 : s/30) {
3888-
linear_extrude(height=0.01, convexity=12, center=true) {
3889-
text(text=anchor[0], size=s/4, halign="center", valign="center", font="Helvetica", $fn=36);
3890-
}
3891-
}
3892-
}
3893-
}
3886+
if(two_d)
3887+
back(s/2)
3888+
square([s/4.5*len(anchor[0]), s*.37], center=true);
3889+
else
3890+
up(s*.45)
3891+
xrot(90)
3892+
cube([s/4.5*len(anchor[0]), s*.37, 0.01], center=true);
38943893
}
3895-
color([1, 1, 1, 1])
3894+
color("black")
38963895
tag("anchor-arrow") {
3897-
xrot(two_d? 0 : 90) {
3898-
back(s/3) {
3899-
cube([s/4.5*len(anchor[0]), s/3, 0.01], center=true);
3900-
}
3901-
}
3896+
if(two_d)
3897+
back(s/2)
3898+
text(text=anchor[0], size=textsize, halign="center", valign="center", font="Helvetica", $fn=36);
3899+
else
3900+
up(s*.45)
3901+
xrot(90)
3902+
yrot_copies(n=2)
3903+
up(s/30)
3904+
text3d(text=anchor[0],h=.01, size=textsize, center=true, font="Helvetica", $fn=36);
39023905
}
39033906
}
39043907
}
@@ -3956,12 +3959,12 @@ module anchor_arrow(s=10, color=[0.333,0.333,1], flag=true, $tag="anchor-arrow",
39563959
// Description:
39573960
// Show an anchor orientation arrow.
39583961
// Arguments:
3959-
// s = Length of the arrows.
3962+
// s = Length of the arrows. Default: 10
39603963
// color = Color of the arrow.
39613964
// Example:
39623965
// anchor_arrow2d(s=20);
3963-
module anchor_arrow2d(s=15, color=[0.333,0.333,1], $tag="anchor-arrow") {
3964-
color(color) stroke([[0,0],[0,s]], width=s/10, endcap1="butt", endcap2="arrow2");
3966+
module anchor_arrow2d(s=10, color=[0.333,0.333,1], $tag="anchor-arrow") {
3967+
color(color) stroke([[0,0],[0,s]], width=s/15, endcap1="butt", endcap2="arrow2");
39653968
}
39663969

39673970

0 commit comments

Comments
 (0)