You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Attaches children to a parent object at an anchor point or points, oriented in the anchor direction.
742
742
// This module differs from {{position()}} and {{align()}} in that it rotates the children to
743
743
// the anchor direction, which generally means it places the children on the surface of a parent.
744
744
// There are two modes of operation, single argument and double argument.
745
745
// .
746
746
// The double argument version is usually easier to use, and it is more powerful because it supports
747
-
// alignment. You provide an anchor on the parent `from` and an anchor on the child `to`.
748
-
// This connects the `to` anchor on the child to the `from` anchor on the parent.
747
+
// alignment. You provide an anchor on the parent `parent` and an anchor on the child `child`.
748
+
// This connects the `child` anchor on the child to the `parent` anchor on the parent.
749
749
// They are connected to the parent by pointing their anchor arrows at each other. The most basic case
750
750
// is `attach(TOP,BOT)` which puts the bottom of the child onto the top of the parent. If you
751
751
// do `attach(RIGHT,BOT)` this puts the bottom of the child onto the right anchor of the parent.
@@ -767,7 +767,7 @@ function _make_anchor_legal(anchor,geom) =
767
767
// ignored with the **double argument** version of `attach()`. As noted above, you can give `spin=` to the
768
768
// child but using the `spin=` parameter to `attach()` is more likely to be useful.
769
769
// .
770
-
// For the single parameter version of `attach()` you give only the `from` anchor. The `align` direction
770
+
// For the single parameter version of `attach()` you give only the `parent` anchor. The `align` direction
771
771
// is not permitted. In this case the child is placed at the specified parent anchor point
772
772
// and rotated to the anchor direction. For example, `attach(TOP) cuboid(2);` will place a small
773
773
// cube **with its center** located at the TOP anchor of the parent, so just half the cube will project
@@ -786,10 +786,10 @@ function _make_anchor_legal(anchor,geom) =
786
786
// For a step-by-step explanation of
787
787
// attachments, see the [Attachments Tutorial](Tutorial-Attachments).
788
788
// Arguments:
789
-
//from = The parent anchor point to attach to or a list of parent anchor points.
790
-
//to = Optional name of the child anchor point. If given, orients the child to connect this anchor point to the parent anchor.
789
+
//parent = The parent anchor point to attach to or a list of parent anchor points.
790
+
//child = Optional child anchor point. If given, orients the child to connect this anchor point to the parent anchor.
791
791
// ---
792
-
// align = If `to` is given you can specify alignment to shift the child to an edge or corner of the parent.
792
+
// align = If `child` is given you can specify alignment to shift the child to an edge or corner of the parent.
793
793
// overlap = Amount to sink child into the parent. Equivalent to `down(X)` after the attach. This defaults to the value in `$overlap`, which is `0` by default.
794
794
// spin = Amount to rotate the parent around the axis of the parent anchor.
795
795
// Side Effects:
@@ -803,45 +803,57 @@ function _make_anchor_legal(anchor,geom) =
assert(num_defined([to,child])<2, "Cannot combine deprecated 'to' argument with 'child' parameter")
810
+
assert(num_defined([from,parent])<2, "Cannot combine deprecated 'from' argument with 'parent' parameter");
811
+
if (is_def(to))
812
+
echo("The 'to' option to attach() is deprecated and will be removed in the future. Use 'child' instead.");
813
+
if (is_def(from))
814
+
echo("The 'from' option to attach(0 is deprecated and will be removed in the future. Use 'parent' instead");
809
815
if (norot)
810
816
echo("The 'norot' option to attach() is deprecated and will be removed in the future. Use position() instead.");
817
+
req_children($children);
818
+
811
819
dummy=assert($parent_geom != undef, "No object to attach to!")
812
820
assert(is_undef(align) || (is_vector(align) && (len(align)==2|| len(align)==3)), "align must be a 2-vector or 3-vector")
813
-
assert(is_undef(to) || is_string(to) || (is_vector(to) && (len(to)==2|| len(to)==3)), "to must be a named anchor (a string) or a 2-vector or 3-vector")
814
-
assert(is_undef(align) ||!is_string(to), "to is a named anchor. Named anchors are not supported with align=");
821
+
assert(is_undef(child) || is_string(child) || (is_vector(child) && (len(child)==2|| len(child)==3)), "child must be a named anchor (a string) or a 2-vector or 3-vector")
822
+
assert(is_undef(align) ||!is_string(child), "child is a named anchor. Named anchors are not supported with align=");
0 commit comments