From 0f39f10dba52fe7734160d99faafe9970eca3e82 Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Tue, 28 May 2024 19:12:27 -0400 Subject: [PATCH 1/3] 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. From 4284b86ba96ed188904a7c77cd4e909a68740669 Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Tue, 28 May 2024 19:55:21 -0400 Subject: [PATCH 2/3] doc tweak --- attachments.scad | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/attachments.scad b/attachments.scad index 82b9066..f7d4311 100644 --- a/attachments.scad +++ b/attachments.scad @@ -779,7 +779,7 @@ function _make_anchor_legal(anchor,geom) = // . // If you give `inside=true` then the anchor arrows are lined up so they are pointing the same direction and // the child object will be located inside the parent. In this case a default "remove" tag is applied to -// the children. +// the children. // . // Because the attachment process forces an orientation and anchor point for the child, it overrides // any such specifications you give to the child: **both `anchor=` and `orient=` given to the child are @@ -797,10 +797,17 @@ function _make_anchor_legal(anchor,geom) = // These options will probably be necessary, in fact, to get the child correctly positioned. Note that // giving `spin=` to `attach()` in this case is the same as applying `zrot()` to the child. // . -// Attached children may be ovarlapped into the parent a bit, as given by the `$overlap` value +// You can overlap attached children into the parent by giving the `$overlap` value // which is 0 by default, or by the `overlap=` argument. This is to prevent OpenSCAD // from making non-manifold objects. You can define `$overlap=` as an argument in a parent -// module to set the default for all attachments to it. +// module to set the default for all attachments to it. When you give `inside=true`, a positive overlap +// value shifts the child object outward. +// . +// If you specify an `inset=` value then the child is shifted away from any edges it is aligned to, towards the middle +// of the parent. The `shiftout=` parameter is intended to simplify differences with aligned objects +// placed inside the parent. It will shift the child outward along every direction where it is aligned with +// the parent. For an inside child this is equivalent to giving a positive overlap and negative inset value. +// For a child with `inside=false` it is equivalent to a negative overlap and negative inset. // . // For a step-by-step explanation of // attachments, see the [Attachments Tutorial](Tutorial-Attachments). From c8d61f4d79363b35dd76b08e590d57abea70803e Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Wed, 29 May 2024 20:29:32 -0400 Subject: [PATCH 3/3] bezier doc tweaks --- beziers.scad | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/beziers.scad b/beziers.scad index 4921722..e09450e 100644 --- a/beziers.scad +++ b/beziers.scad @@ -1455,14 +1455,18 @@ function bezier_patch_normals(patch, u, v) = // Usage: // debug_bezier(bez, [size], [N=]); // Description: -// Renders 2D or 3D bezier paths and their associated control points. -// Useful for debugging bezier paths. +// Renders 2D or 3D bezier paths and their associated control points to help debug bezier paths. +// The endpoints of each bezier curve in the bezier path are marked with a blue circle and the intermediate control +// points with a red plus sign. For cubic (degree 3) bezier paths, the module displays the standard representation +// of the control points as "handles" at each endpoint. For other degrees the control points are drawn as +// a polygon. You can of course give a single bezier curve as input, but you must in that case explicitly specify +// the bezier degree when it is not a cubic bezier. // Arguments: // bez = the array of points in the bezier. // size = diameter of the lines drawn. // --- -// N = Mark the first and every Nth vertex after in a different color and shape. -// Example(2D): +// N = The degree of the bezier curves. Cubic beziers have N=3. Default: 3 +// Example(2D): Cubic bezier path // bez = [ // [-10, 0], [-15, -5], // [ -5, -10], [ 0, -10], [ 5, -10], @@ -1470,6 +1474,15 @@ function bezier_patch_normals(patch, u, v) = // [ 5, 10], [ 0, 10] // ]; // debug_bezier(bez, N=3, width=0.5); +// Example(2D): Quartic (degree 4) bezier path +// bez = [ +// [-10, 0], [-15, -5], +// [ -9, -10], [ 0, -12], [ 5, -10], +// [ 14, -5], [ 18, 0], [16, 5], +// [ 5, 10] +// ]; +// debug_bezier(bez, N=4, width=0.5); + module debug_bezier(bezpath, width=1, N=3) { no_children($children); check =