From 0f39f10dba52fe7734160d99faafe9970eca3e82 Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Tue, 28 May 2024 19:12:27 -0400 Subject: [PATCH] fix attach() bug --- attachments.scad | 2 +- shapes3d.scad | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/attachments.scad b/attachments.scad index fe3cd9b..82b9066 100644 --- a/attachments.scad +++ b/attachments.scad @@ -916,7 +916,7 @@ module attach(parent, child, overlap, align, spin=0, norot, inset=0, shiftout=0, anchor_data = _find_anchor(anchor, $parent_geom); anchor_pos = anchor_data[1]; anchor_dir = factor*anchor_data[2]; - anchor_spin = !inside || anchor_data[3]==0 ? anchor_data[3] : 180+anchor_data[3]; + anchor_spin = !inside || anchor==TOP || anchor==BOT ? anchor_data[3] : 180+anchor_data[3]; $anchor=anchor; for(align_ind = idx(align_list)){ align = is_undef(align_list[align_ind]) ? undef diff --git a/shapes3d.scad b/shapes3d.scad index d45589a..f6ee63b 100644 --- a/shapes3d.scad +++ b/shapes3d.scad @@ -130,6 +130,10 @@ function cube(size=1, center, anchor, spin=0, orient=UP) = // orient = Vector to rotate top towards. See [orient](attachments.scad#subsection-orient). Default: `UP` // Example: Simple regular cube. // cuboid(40); +// Example: Cuboid with a corner at the origin +// cuboid(40, anchor=FRONT+LEFT+BOT); +// Example: Cuboid anchored on its right face +// cuboid(40, anchor=RIGHT); // Example: Cube with minimum cornerpoint given. // cuboid(20, p1=[10,0,0]); // Example: Rectangular cube, with given X, Y, and Z sizes.