I expected the two shapes to be the same (the red shape, not the green)
$fn = 90;
ct = 18;
posn = [
[50, 0, 0],
[-50, 0, 0]
];
color("red")
intersection() {
translate([50, 0, 0])
cylinder(h = ct, d = 200);
translate([-50, 0, 0])
cylinder(h = ct, d = 200);
}
color("green")
intersection() {
for (i = [0:1])
translate(posn[i])
cylinder(h = ct/2, d = 200);
}
--
This email has been checked for viruses by AVG antivirus software.
www.avg.com
Haven't actually looked at the output, but at first glance I would expect:
(1) the 'red example to be the intersection of two translated cylinders, and
(2) the 'green' example to be an implicit union of the two translated cylinders, intersected with...nothing.
Having said that, I have absolutely no idea how OS handles an intersection with a null object, but I'd
sort of expect a null object as the result. Does that "lazy union" setting come into play here?
(Or just ignore me, it's been a low-caffeine day.)
-----Original Message-----
From: Jon Bondy via Discuss discuss@lists.openscad.org
Sent: Saturday, December 27, 2025 1:00 PM
To: OpenSCAD general discussion discuss@lists.openscad.org
Cc: Jon Bondy jon@jonbondy.com
Subject: [OpenSCAD] Loops inside intersection()
I expected the two shapes to be the same (the red shape, not the green)
$fn = 90;
ct = 18;
posn = [
[50, 0, 0],
[-50, 0, 0]
];
color("red")
intersection() {
translate([50, 0, 0])
cylinder(h = ct, d = 200);
translate([-50, 0, 0])
cylinder(h = ct, d = 200);
}
color("green")
intersection() {
for (i = [0:1])
translate(posn[i])
cylinder(h = ct/2, d = 200);
}
--
This email has been checked for viruses by AVG antivirus software.
www.avg.com
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Ah. Implicit union.
Perhaps.
Let's let others chime in.
On 12/27/2025 4:16 PM, Lee DeRaud via Discuss wrote:
Haven't actually looked at the output, but at first glance I would expect:
(1) the 'red example to be the intersection of two translated cylinders, and
(2) the 'green' example to be an implicit union of the two translated cylinders, intersected with...nothing.
Having said that, I have absolutely no idea how OS handles an intersection with a null object, but I'd
sort of expect a null object as the result. Does that "lazy union" setting come into play here?
(Or just ignore me, it's been a low-caffeine day.)
-----Original Message-----
From: Jon Bondy via Discuss discuss@lists.openscad.org
Sent: Saturday, December 27, 2025 1:00 PM
To: OpenSCAD general discussion discuss@lists.openscad.org
Cc: Jon Bondy jon@jonbondy.com
Subject: [OpenSCAD] Loops inside intersection()
I expected the two shapes to be the same (the red shape, not the green)
$fn = 90;
ct = 18;
posn = [
[50, 0, 0],
[-50, 0, 0]
];
color("red")
intersection() {
translate([50, 0, 0])
cylinder(h = ct, d = 200);
translate([-50, 0, 0])
cylinder(h = ct, d = 200);
}
color("green")
intersection() {
for (i = [0:1])
translate(posn[i])
cylinder(h = ct/2, d = 200);
}
--
This email has been checked for viruses by AVG antivirus software.
www.avg.com
Use intersection_for instead of for
On Sat, 27 Dec 2025, 21:23 Jon Bondy via Discuss, <
discuss@lists.openscad.org> wrote:
Ah. Implicit union.
Perhaps.
Let's let others chime in.
On 12/27/2025 4:16 PM, Lee DeRaud via Discuss wrote:
Haven't actually looked at the output, but at first glance I would
expect:
(1) the 'red example to be the intersection of two translated cylinders,
and
(2) the 'green' example to be an implicit union of the two translated
cylinders, intersected with...nothing.
Having said that, I have absolutely no idea how OS handles an
intersection with a null object, but I'd
sort of expect a null object as the result. Does that "lazy union"
setting come into play here?
(Or just ignore me, it's been a low-caffeine day.)
-----Original Message-----
From: Jon Bondy via Discuss discuss@lists.openscad.org
Sent: Saturday, December 27, 2025 1:00 PM
To: OpenSCAD general discussion discuss@lists.openscad.org
Cc: Jon Bondy jon@jonbondy.com
Subject: [OpenSCAD] Loops inside intersection()
I expected the two shapes to be the same (the red shape, not the green)
$fn = 90;
ct = 18;
posn = [
[50, 0, 0],
[-50, 0, 0]
];
color("red")
intersection() {
translate([50, 0, 0])
cylinder(h = ct, d = 200);
translate([-50, 0, 0])
cylinder(h = ct, d = 200);
}
color("green")
intersection() {
for (i = [0:1])
translate(posn[i])
cylinder(h = ct/2, d = 200);
}
--
This email has been checked for viruses by AVG antivirus software.
www.avg.com
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Ah. Thanks. Shows how often I use intersection()!!!
On 12/27/2025 4:47 PM, nop head wrote:
Use intersection_for instead of for
On Sat, 27 Dec 2025, 21:23 Jon Bondy via Discuss, <discuss@lists.openscad.orgmailto:discuss@lists.openscad.org> wrote:
Ah. Implicit union.
Perhaps.
Let's let others chime in.
On 12/27/2025 4:16 PM, Lee DeRaud via Discuss wrote:
Haven't actually looked at the output, but at first glance I would expect:
(1) the 'red example to be the intersection of two translated cylinders, and
(2) the 'green' example to be an implicit union of the two translated cylinders, intersected with...nothing.
Having said that, I have absolutely no idea how OS handles an intersection with a null object, but I'd
sort of expect a null object as the result. Does that "lazy union" setting come into play here?
(Or just ignore me, it's been a low-caffeine day.)
-----Original Message-----
From: Jon Bondy via Discuss <discuss@lists.openscad.orgmailto:discuss@lists.openscad.org>
Sent: Saturday, December 27, 2025 1:00 PM
To: OpenSCAD general discussion <discuss@lists.openscad.orgmailto:discuss@lists.openscad.org>
Cc: Jon Bondy <jon@jonbondy.commailto:jon@jonbondy.com>
Subject: [OpenSCAD] Loops inside intersection()
I expected the two shapes to be the same (the red shape, not the green)
$fn = 90;
ct = 18;
posn = [
[50, 0, 0],
[-50, 0, 0]
];
color("red")
intersection() {
translate([50, 0, 0])
cylinder(h = ct, d = 200);
translate([-50, 0, 0])
cylinder(h = ct, d = 200);
}
color("green")
intersection() {
for (i = [0:1])
translate(posn[i])
cylinder(h = ct/2, d = 200);
}
--
This email has been checked for viruses by AVG antivirus software.
www.avg.comhttps://urldefense.proofpoint.com/v2/url?u=http-3A__www.avg.com&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=AsrE-c7ZR7B2Kyr3qgfvvppkCEBVsNmwEMndcrRSuOI&m=7HuqWkntY80kKdDwlV8iEKcPLFqQltxgzyquJgkxck26PKEQz5elZ-6a53FPj-4l&s=C_gQaorxgnbzsW3m22GiOM4DefMt5Ul9Ho3jcbwsOqY&e=
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.orgmailto:discuss-leave@lists.openscad.org
On 12/27/2025 1:16 PM, Lee DeRaud via Discuss wrote:
Haven't actually looked at the output, but at first glance I would expect:
(1) the 'red example to be the intersection of two translated cylinders, and
(2) the 'green' example to be an implicit union of the two translated cylinders, intersected with...nothing.
Correct, mostly. for(), like most modules, implicitly unions its
children and, like all modules, implicitly unions all of the shapes that
it produces.
Repeat after me: a module invocation always yields exactly one shape.
(Exception: There are a very few that yield zero shapes.)
Having said that, I have absolutely no idea how OS handles an intersection with a null object, but I'd
sort of expect a null object as the result. Does that "lazy union" setting come into play here?
There is no spoon. https://www.youtube.com/watch?v=XO0pcWxcROI Or,
rather, there is no null object in this picture.
Once we get to the intersection, it's equivalent to:
intersection() {
cube();
}
Intersection is defined to yield the volume that is in common between
all of its children. "all" is well-defined for a single child. For a
single child C, like the cube above, and like the for() in the original
question, the shape that is in common between all of its children is... C.
Intersection with no children gets ... philosophical. There's a decent
argument that it should yield the entire universe, since when you then
intersect that with the first child, you get that first child. But in
practice it yields an empty object.
There is no https://www.youtube.com/watch?v=XO0pcWxcROI spoon.
Getting meta, no video of no spoon "Video unavailable The uploader has not made this video available in your country" :-)
From: Jordan Brown via Discuss [mailto:discuss@lists.openscad.org]