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
// Several options can adjust how the child is positioned. You can specify `inset=` to inset the
613
613
// aligned object from its alignment location. If you set `inside=true` then the
614
614
// child appears inside the parent instead of on its surface so that you can use {{diff()}} to subract it.
615
-
// In this case the child recieved a default "remove" tag. The `shiftout=` option works with `inside=true` to
616
-
// shift the child out by the specified distance so that the child doesn't exactly align with the parent.
615
+
// In this case the child receives a default "remove" tag.
616
+
// .
617
+
// The overlap option and shiftout option both move the object away from its aligned position. They
618
+
// can be used to prevent coincident faces from creating issues in OpenSCAD by ensuring that the child
619
+
// fully overlaps the parent's face(s). The `overlap` parameter defaults to the value of `$overlap`, or
620
+
// 0 if `$overlap` is not set. It moves the child object in the direction of the `anchor` face when
621
+
// `inside=false` (sinking the child into the parent) and it moves the child in the opposite direction
622
+
// if `inside=true`, shifting the child outward away from the `anchor` face. The child will remain exactly flush
623
+
// with edges it was aligned to using `align`. The `overlap` parameter is best suited to externally aligned objects (`inside=false`)
624
+
// where the aligned edges should remain perfectly aligned. The `shiftout` parameter shifts the child outward relative to
625
+
// the `anchor` face and also any aligned edges. The direction of movement does not depend on the `inside` parameter.
626
+
// For an inside child this is equivalent to giving a positive overlap and negative inset value.
627
+
// For a child with `inside=false` it is equivalent to a negative overlap and negative inset. The `shiftout` parameter
628
+
// is well suited to internal objects where `inside=true` because it shifts to overlap all coincident faces, including
629
+
// faces at aligned edges.
617
630
// .
618
631
// In the description above, the anchor was said to define a "face". You can also use this module
619
632
// with an edge anchor, in which case a corner of the child is placed in contact with the specified
@@ -630,7 +643,7 @@ module orient(anchor, spin) {
630
643
// inside = if true, place object inside the parent instead of outside. Default: false
631
644
// inset = shift the child away from the alignment edge/corner by this amount. Default: 0
632
645
// shiftout = Shift an inside object outward so that it overlaps all the aligned faces. Default: 0
633
-
// overlap = Amount to sink the child into the parent. Defaults to `$overlap`, which is zero by default.
646
+
// overlap = Amount to sink the child into the parent (or raise child out of parent if `inside=true`). Defaults to `$overlap`, which is zero by default.
634
647
// Side Effects:
635
648
// `$anchor` set to the anchor value used for the child.
636
649
// `$align` set to the align value used for the child.
dummy1=assert($parent_geom != undef, "\nNo object to align to.")
711
-
assert(is_undef($attach_to), "\nCannot use align() as a child of attach().");
724
+
assert(is_undef($attach_to), "\nCannot use align() as a child of attach().")
725
+
assert(is_finite(overlap), str("\noverlap must be a finite number but is ",overlap));
726
+
if (_is_shown() && inside && overlap!=0&& (is_undef($align_msg) ||$align_msg))
727
+
echo("WARNING: overlap passed to align() with inside=true; handling has changed (May 2026): positive overlap moves child outward (change in sign). Set $align_msg=false to hide this message");
728
+
712
729
anchor = is_vector(anchor) ? [anchor] : anchor;
713
730
align = is_vector(align) ? [align] : align;
714
731
two_d = _attach_geom_2d($parent_geom);
@@ -795,40 +812,42 @@ function _make_anchor_legal(anchor,geom) =
795
812
// spinning the object around the Z axis would change the child orientation so that the anchors are no longer parallel.
796
813
// .
797
814
// As with {{align()}} you can use the `align=` parameter to align the child to an edge or corner of the
798
-
// face where that child is attached. For example, `attach(TOP,BOT,align=RIGHT)` would stand the child
799
-
// up on the top while aligning it with the right edge of the top face, and `attach(RIGHT,BOT,align=TOP)`, which
800
-
//stand the object on the right face while aligning with the top edge. If you apply spin using the
815
+
// face where that child is attached. For example, `attach(TOP,BOT,align=RIGHT)` stands the child
816
+
// up on the top while aligning it with the right edge of the top face, and `attach(RIGHT,BOT,align=TOP)`
817
+
//stands the object on the right face while aligning with the top edge. If you apply spin using the
801
818
// argument to `attach()`, then it is taken into account for the alignment. However, if you apply spin as
802
819
// a parameter to the child, it is **not** taken into account. The special spin value "align"
803
820
// spins the child so that the child's BACK direction is pointed toward the aligned edge on the parent.
804
821
// When you use `align=` you can also adjust the position using `inset=`, which shifts the child
805
-
// away from the edge or corner it is aligned to.
822
+
//inward away from the edge or corner it is aligned to. The `inset=` parameter is not permitted without `align=`.
806
823
// .
807
824
// The concept of alignment doesn't always make sense for objects without corners, such as spheres or cylinders.
808
825
// In same cases, the alignments using such children may look odd because the alignment computation tries to
809
826
// place a non-existent corner somewhere. Because attach() doesn't have in formation about the child when
810
827
// it runs, it cannot handle curved shapes differently from cubes, so this behavior cannot be changed.
811
828
// .
812
-
// If you give `inside=true` then the anchor arrows are lined up so they point the same direction and
813
-
// the child object is located inside the parent. In this case a default "remove" tag is applied to
814
-
// the children.
815
-
// .
816
829
// Because the attachment process forces an orientation and anchor point for the child, it overrides
817
830
// any such specifications you give to the child: **both `anchor=` and `orient=` given to the child are
818
831
// ignored** with the **double argument** version of `attach()`. As noted above, you can give `spin=` to the
819
832
// child but using the `spin=` parameter to `attach()` is more likely to be useful.
820
833
// .
821
-
// You can overlap attached children into the parent by giving the `$overlap` value,
822
-
// which is 0 by default, or by the `overlap=` argument. This is to prevent OpenSCAD
823
-
// from making non-manifold objects. You can define `$overlap=` as an argument in a parent
824
-
// module to set the default for all attachments to it. When you give `inside=true`, a positive overlap
825
-
// value shifts the child object outward.
834
+
// If you give `inside=true` then the anchor arrows are lined up so they point the same direction and
835
+
// the child object is located inside the parent. In this case a default "remove" tag is applied to
836
+
// the children.
826
837
// .
827
-
// If you specify an `inset=` value then the child is shifted away from any edges it is aligned to, toward the middle
828
-
// of the parent. The `shiftout=` parameter is intended to simplify differences with aligned objects
829
-
// placed inside the parent. It shifts the child outward along every direction where it is aligned with
830
-
// the parent. For an inside child this is equivalent to giving a positive overlap and negative inset value.
831
-
// For a child with `inside=false` it is equivalent to a negative overlap and negative inset.
838
+
// The overlap option and shiftout option both move the object away from its aligned position. They
839
+
// can be used to prevent coincident faces from creating issues in OpenSCAD by ensuring that the child
840
+
// fully overlaps the parent's face(s). The `overlap` parameter defaults to the value of `$overlap`, or
841
+
// 0 if `$overlap` is not set. It moves the child object in the direction of the `parent` face when
842
+
// `inside=false` (sinking the child into the parent) and it moves the child in the opposite direction
843
+
// if `inside=true`, shifting the child outward away from the `parent` face. The child will remain exactly flush
844
+
// with edges it was aligned to using `align=`. The `overlap` parameter is best suited to externally attached objects (`inside=false`)
845
+
// where the aligned edges should remain perfectly aligned. The `shiftout` parameter shifts the child outward relative to
846
+
// the `parent` face and also any aligned edges. The direction of movement does not depend on the `inside` parameter.
847
+
// For an inside child this is equivalent to giving a positive overlap and negative inset value.
848
+
// For a child with `inside=false` it is equivalent to a negative overlap and negative inset. The `shiftout` parameter
849
+
// is well suited to internal objects where `inside=true` because it shifts to overlap all coincident faces, including
850
+
// faces at aligned edges.
832
851
// .
833
852
// The single parameter version of `attach()` is rarely needed; to use it, you give only the `parent` anchor. The `align` direction
834
853
// is not permitted. In this case the child is placed at the specified parent anchor point
@@ -848,7 +867,7 @@ function _make_anchor_legal(anchor,geom) =
848
867
// ---
849
868
// align = If `child` is given you can specify alignment or list of alistnments to shift the child to an edge or corner of the parent.
850
869
// inset = Shift aligned children away from their alignment edge/corner by this amount. Default: 0
851
-
// 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.
870
+
// overlap = Amount to sink child into the parent (or raise child out of parent if `inside=true`). Equivalent to `down(X)` after the attach (or `up(X)` if `inside=true`). This defaults to the value in `$overlap`, which is `0` by default.
852
871
// inside = If `child` is given you can set `inside=true` to attach the child to the inside of the parent for diff() operations. Default: false
853
872
// shiftout = Shift an inside object outward so that it overlaps all the aligned faces. Default: 0
854
873
// spin = Angle to rotate the child around the axis of the parent anchor. Can set to "align" to align the child's BACK with the parent aligned edge. (Permitted only in 3D.)
// worm_diam = The pitch diameter of the worm gear to match to. Default: 30
3071
3070
// worm_starts = The number of lead starts on the worm gear to match to. Default: 1
3072
3071
// worm_arc = The arc of the worm to mate with, in degrees. Default: 45 degrees
3073
-
// crowning = The amount to oversize the virtual hobbing cutter used to make the teeth, to add a slight crowning to the teeth to make them fit the work easier. Default: 1
3072
+
// crowning = The amount to oversize the virtual hobbing cutter used to make the teeth, to add a slight crowning to the teeth to make them fit the work easier. Default: 0.1
3074
3073
// left_handed = If true, the gear returned will have a left-handed spiral. Default: false
3075
3074
// pressure_angle = Controls how straight or bulged the tooth sides are. In degrees. Default: 20
3076
3075
// backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle. Default: 0
@@ -4166,7 +4159,7 @@ function bevel_pitch_angle(teeth, mate_teeth, drive_angle=90) =
4166
4159
// ---
4167
4160
// worm_arc = The arc of the worm to mate with, in degrees. Default: 45 degrees
4168
4161
// pressure_angle = Pressure angle in degrees. Controls how straight or bulged the tooth sides are. Default: 20º
4169
-
// crowning = The amount to oversize the virtual hobbing cutter used to make the teeth, to add a slight crowning to the teeth to make them fit the work easier. Default: 1
4162
+
// crowning = The amount to oversize the virtual hobbing cutter used to make the teeth, to add a slight crowning to the teeth to make them fit the work easier. Default: 0.1
4170
4163
// clearance = Clearance gap at the bottom of the inter-tooth valleys. Default: module/4
4171
4164
// mod = The module of the gear (pitch diameter / teeth)
4172
4165
// diam_pitch = The diametral pitch, or number of teeth per inch of pitch diameter. The diametral pitch is a completely different thing than the pitch diameter.
0 commit comments