diff --git a/shapes3d.scad b/shapes3d.scad index 12b8cb48..50f4def5 100644 --- a/shapes3d.scad +++ b/shapes3d.scad @@ -1762,8 +1762,8 @@ function rect_tube( // "hypot" = Center of angled wedge face, perpendicular to that face. // "hypot_left" = Left side of angled wedge face, bisecting the angle between the left side and angled faces. // "hypot_right" = Right side of angled wedge face, bisecting the angle between the right side and angled faces. -// "top_edge" = Top edge anchor which, unlike the UP anchor, points in direction that bisects the edge, and provides `$edge_length` and `$edge_angle`. -// +// "top_edge" = Top edge anchor which, unlike the UP anchor, points in direction that bisects the edge, and provides `$edge_length` and `$edge_angle`. +// "bot_edge" = The bottom tip edge with an anchor direction that properly bisects the edge and the `$edge_length` and `$edge_angle` parameters set. // Example: Centered // wedge([20, 40, 15], center=true); // Example: *Non*-Centered @@ -1794,12 +1794,16 @@ module wedge(size=[1, 1, 1], center, anchor, spin=0, orient=UP) right_dir = unit(hypot_dir+RIGHT); hedge_spin=vector_angle(spindir,rot(from=UP,to=left_dir, p=BACK)); topedge_dir = [0, each unit(unit([size.z,size.y])+[-1,0])]; + botedge_dir = [0, each unit(unit([size.z,size.y])+[0,-1])]; anchors = [ named_anchor("hypot", CTR, hypot_dir, 180), named_anchor("hypot_left", [-size.x/2,0,0], left_dir,-hedge_spin), named_anchor("hypot_right", [size.x/2,0,0], right_dir,hedge_spin), named_anchor("top_edge", [0,-size.y/2,size.z/2], topedge_dir, _compute_spin(topedge_dir,RIGHT), - info=[["edge_angle",atan2(size.y,size.z)],["edge_length",size.x]]) + info=[["edge_angle",atan2(size.y,size.z)],["edge_length",size.x]]), + named_anchor("bot_edge", [0,size.y/2, -size.z/2], botedge_dir, _compute_spin(botedge_dir,RIGHT), + info=[["edge_angle",atan2(size.z,size.y)],["edge_length",size.x]]), + ]; attachable(anchor,spin,orient, size=size, anchors=anchors) { if (size.z > 0) { diff --git a/tutorials/Attachment-Basic-Positioning.md b/tutorials/Attachment-Basic-Positioning.md index d98f7829..460c5c6f 100644 --- a/tutorials/Attachment-Basic-Positioning.md +++ b/tutorials/Attachment-Basic-Positioning.md @@ -73,7 +73,8 @@ For cylindrical type attachables, the Z component of the anchor vector must be to the bottom rim, the middle side, or the top rim of the cylindrical or conical shape. The X and Y components can be any value, pointing towards the circular perimeter of the cone. These combined let you point at any place on the bottom or top rims, or at an arbitrary -side wall. +side wall. When the Z component is zero you can omit it and pass just +an [X,Y] vector. ```openscad-3D include @@ -92,6 +93,14 @@ include cylinder(r1=25, r2=15, h=60, anchor=cylindrical_to_xyz(1,30,1)); ``` +Here we anchor using a 2D XY vector where the Z value is assumed to be +zero: + +```openscad-3D +include +cylinder(r=25, h=6, anchor=[-1,-2]); +``` + --- For Spherical type attachables, you can pass a vector that points at any arbitrary place on