why does this innocent piece of code crash?
R1 = 25;
d = 10;
n = 10;
r = 8;
difference()
{
sphere(R1);
for(i=[0:n-1])
rotate([0, 0, i*360/n ]) translate([R1, 0, 0]) tri();
}
module tri()
{
rotate([0, 90, 0])
intersection_for(i=[0:120:359])
rotate(i) translate([d/3, 0, 0]) cylinder(r=d, h = r, center = true);
}
--
Sent from: http://forum.openscad.org/
On 18.07.19 00:35, Parkinbot wrote:
why does this innocent piece of code crash?
It does not crash for me, but gives warning.
WARNING: Normalized tree is growing past 2000000 elements. Aborting normalization.
I guess it crashes because it runs out of stack space
when calculating the CSG tree which is exploding due
to the intersections like mentioned there:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_the_preview_so_slow?
Adding a render() at the top of tri() makes it produce
instant result.
ciao,
Torsten.
No crash for me.
Initially it looked like a hang, but it came back eventually, with VEEERY
slow preview motion updates.
I have preference/Turn off rendering at = 100000000 so I didn't get the
warning.
When debugging I changed the loop to angle based
for(a=[0,36,362,363,364,365])
rotate([0, 0, a ])
As I added more 36*n's, preview performance went down quickly.
Admin - email* me if you need anything, or if I've done something stupid...
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
Sent from: http://forum.openscad.org/
It is not a real crash, but the session hangs.
I changed the code of tri(), and used a 2D intersection followed by a
linear_extrude. This gives an instant result.
--
Sent from: http://forum.openscad.org/