My code snippet
difference() {
a = 10;
for(i=[0,120,240]) linear_extrude(60) rotate(i) polygon(100 * [[0,0],
[cos(a), sin(a)], [cos(a), -sin(a)]]);
cylinder(r=42, h = 60);
}
does not do what I want, but adding a union() before the for() command
fixes it:
difference() {
a = 10;
union() for(i=[0,120,240]) linear_extrude(60) rotate(i) polygon(100 *
[[0,0], [cos(a), sin(a)], [cos(a), -sin(a)]]);
cylinder(r=42, h = 60);
}
As part of the explanation of intersection_for(), the wiki documentation
states "Besides creating separate instances for each pass, the standard
for() also groups all these instances creating an implicit union" but
that clearly isn't so for my example. Is there a way I can predict when
it will happen?
Cheers,
Steve
for() normally creates an implicit union. (As does almost everything.)
Perhaps you have "lazy union" enabled. Don't do that. Edit /
Preferences / Features.
union() for(i=[0,120,240]) linear_extrude(60) rotate(i) polygon(100
Hint:
You might notice preview artifacts at the top and bottom.
These are because the previewer can't decide whether there's anything
left after the difference. Make the negative object extend at least a
little past the thing you're subtracting it from. In this case, an easy
scheme is to multiply the height of the negative object by three, and
center it. That will ensure that it projects on both sides of the
positive object, no matter whether it's aligned with one side, the
other, or the center.
cylinder(r=42, h = 60*3, center=true);
On 2025-03-06 9:30 a.m., Jordan Brown wrote:
for() normally creates an implicit union. (As does almost everything.)
Perhaps you have "lazy union" enabled. Don't do that. Edit /
Preferences / Features.
That fixed it. Thank you.
Steve
What version are you running? I'm currently on v2021.01, and I cannot find
any "features" tab in the preferences pop-up.
Also, is there some way to remove those pesky miniscule thin flotsam from
the difference operations?
EBo --
On Thu, Mar 6, 2025 at 12:33 PM Steve Lelievre via Discuss <
discuss@lists.openscad.org> wrote:
On 2025-03-06 9:30 a.m., Jordan Brown wrote:
for() normally creates an implicit union. (As does almost everything.)
Perhaps you have "lazy union" enabled. Don't do that. Edit /
Preferences / Features.
That fixed it. Thank you.
Steve
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On 2025-03-06 7:50 p.m., John David wrote:
What version are you running? I'm currently on v2021.01, and I cannot
find any "features" tab in the preferences pop-up.
It's in the development builds.
Also, is there some way to remove those pesky miniscule thin flotsam
from the difference operations?
As Jordan mentioned, you can make the item being differenced away
slightly too big so that it breaks through the surface.
I usually render rather than preview, so I usually don't see those
artifacts anyway.
Steve
EBo --
On Thu, Mar 6, 2025 at 12:33 PM Steve Lelievre via Discuss
discuss@lists.openscad.org wrote:
On 2025-03-06 9:30 a.m., Jordan Brown wrote:
for() normally creates an implicit union. (As does almost
everything.)
Perhaps you have "lazy union" enabled. Don't do that. Edit /
Preferences / Features.
That fixed it. Thank you.
Steve
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On 3/6/2025 7:50 PM, John David wrote:
What version are you running? I'm currently on v2021.01, and I cannot
find any "features" tab in the preferences pop-up.
I don't think there are any experimental features built into 2021.01.
Also, is there some way to remove those pesky miniscule thin flotsam
from the difference operations?
I see that Steve has already explained, but here's the FAQ reference:
Several of the other FAQs in that section are common display issues;
it's worth glancing through them.