discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Seemingly simple object apparently isn't

M
Manuel
Thu, Nov 30, 2017 10:21 AM

The attached file is a kind of stopper with a hole in it I recently
constructed. To me, this seemed rather simple. However, my admittedly aging
laptop (~2GHz Core 2 Duo, 8GB RAM) struggles to render it. It's been at it
for over 2 hours now and the last try last night crashed after an unknown
amount of time.

So, here's a couple of questions:

  • Can anybody who understands more about OpenSCAD's internal workings than I
    do explain why this seemingly simple form makes OpenSCAD struggle so much?

  • Is there any better/more efficient way to create that same shape?

  • If anybody tries this out and finds their machine copes better, would you
    share the STL with me? I'd really like to print that thing... ;)

Thanks in advance for any help and insights!

Cheers,

Manuel

test.scad http://forum.openscad.org/file/t2095/test.scad

--
Sent from: http://forum.openscad.org/

The attached file is a kind of stopper with a hole in it I recently constructed. To me, this seemed rather simple. However, my admittedly aging laptop (~2GHz Core 2 Duo, 8GB RAM) struggles to render it. It's been at it for over 2 hours now and the last try last night crashed after an unknown amount of time. So, here's a couple of questions: - Can anybody who understands more about OpenSCAD's internal workings than I do explain why this seemingly simple form makes OpenSCAD struggle so much? - Is there any better/more efficient way to create that same shape? - If anybody tries this out and finds their machine copes better, would you share the STL with me? I'd really like to print that thing... ;) Thanks in advance for any help and insights! Cheers, Manuel test.scad <http://forum.openscad.org/file/t2095/test.scad> -- Sent from: http://forum.openscad.org/
TP
Torsten Paul
Thu, Nov 30, 2017 10:40 AM

Using $fa = .1 and $fs = .1 is generating a HUGE amount of vertices.

Maybe try with

$fa = 5;    # minimum angle = 5°
$fs = 0.5;  # minimum segment length = 0.5

ciao,
Torsten.

Using $fa = .1 and $fs = .1 is generating a *HUGE* amount of vertices. Maybe try with $fa = 5; # minimum angle = 5° $fs = 0.5; # minimum segment length = 0.5 ciao, Torsten.
M
Manuel
Thu, Nov 30, 2017 11:02 AM

tp3 wrote

$fa = 5;    # minimum angle = 5°
$fs = 0.5;  # minimum segment length = 0.5

Thank you. That does of course help, but it also results in a rather ugly
model with a very visible flattened area on the top rather than the nice
dome shape I was aiming for.

--
Sent from: http://forum.openscad.org/

tp3 wrote > $fa = 5; # minimum angle = 5° > $fs = 0.5; # minimum segment length = 0.5 Thank you. That does of course help, but it also results in a rather ugly model with a very visible flattened area on the top rather than the nice dome shape I was aiming for. -- Sent from: http://forum.openscad.org/
MK
Marius Kintel
Thu, Nov 30, 2017 12:44 PM

On Nov 30, 2017, at 6:02 AM, Manuel manuel@reiter.pm wrote:

Thank you. That does of course help, but it also results in a rather ugly
model with a very visible flattened area on the top rather than the nice
dome shape I was aiming for.

OpenSCAD trades exactness and robustness for speed. We also started out on the scale needed for personal 3D printing, so in some cases, smooth curves may be time-consuming to achieve.
There are other software which do the trade-off the other way around; speed first, exactness/robustness second, see e.g. http://openjscad.org.

-Marius

> On Nov 30, 2017, at 6:02 AM, Manuel <manuel@reiter.pm> wrote: > > Thank you. That does of course help, but it also results in a rather ugly > model with a very visible flattened area on the top rather than the nice > dome shape I was aiming for. > OpenSCAD trades exactness and robustness for speed. We also started out on the scale needed for personal 3D printing, so in some cases, smooth curves may be time-consuming to achieve. There are other software which do the trade-off the other way around; speed first, exactness/robustness second, see e.g. http://openjscad.org. -Marius
T
TLC123
Thu, Nov 30, 2017 4:55 PM

I would do this as an rotate_extrude .
2D sub system is very fast.

$fa =  0.1;
$fs =  0.5;

r_globus = 130;
r_loch = 11.35;
ueberlapp = 2;
r_zapfen = 2.8;

z=3;

d_deckel = .2;
h_d_deckel = d_deckel*0.5;

h_2=sqrt(pow(r_globus,2)-pow(r_loch+ueberlapp,2));

module hohlkugel(radius,dicke)
{
difference()
{
circle(radius);
circle(radius-dicke);
}
}

module kugelschale(r_kugel,d_kugel,r_scheibe)
{
intersection()
{
hohlkugel(r_kugel,d_kugel);
polygon([[0,0],[r_scheibe,r_kugel],[-r_scheibe,r_kugel]]);
}
}

module test()
{
intersection()
{
union() {
translate([ 0,-z])
difference()
{
square([r_loch,r_globus]);
square( [r_zapfen2,2r_globus],center=true);
}

}
translate([ 0,-h_2]) circle(r=r_globus);

}
intersection()
{ difference()
{
translate([  0,-h_2])
kugelschale(r_globus,d_deckel,(r_loch+ueberlapp)r_globus/h_2);
square( [r_zapfen
2,2*r_globus],center=true);

}      translate([ 0,-z])square([r_globus,r_globus]);
}}

rotate_extrude() offset(-h_d_deckel)offset(h_d_deckel) test();

--
Sent from: http://forum.openscad.org/

I would do this as an rotate_extrude . 2D sub system is very fast. $fa = 0.1; $fs = 0.5; r_globus = 130; r_loch = 11.35; ueberlapp = 2; r_zapfen = 2.8; z=3; d_deckel = .2; h_d_deckel = d_deckel*0.5; h_2=sqrt(pow(r_globus,2)-pow(r_loch+ueberlapp,2)); module hohlkugel(radius,dicke) { difference() { circle(radius); circle(radius-dicke); } } module kugelschale(r_kugel,d_kugel,r_scheibe) { intersection() { hohlkugel(r_kugel,d_kugel); polygon([[0,0],[r_scheibe,r_kugel],[-r_scheibe,r_kugel]]); } } module test() { intersection() { union() { translate([ 0,-z]) difference() { square([r_loch,r_globus]); square( [r_zapfen*2,2*r_globus],center=true); } } translate([ 0,-h_2]) circle(r=r_globus); } intersection() { difference() { translate([ 0,-h_2]) kugelschale(r_globus,d_deckel,(r_loch+ueberlapp)*r_globus/h_2); square( [r_zapfen*2,2*r_globus],center=true); } translate([ 0,-z])square([r_globus,r_globus]); }} rotate_extrude() offset(-h_d_deckel)offset(h_d_deckel) test(); -- Sent from: http://forum.openscad.org/
M
Manuel
Fri, Dec 1, 2017 2:48 PM

kintel wrote

OpenSCAD trades exactness and robustness for speed.

Thank you. I can understand this approach.

FWIW, I tried to render my original file from the command line on a 128GB
RAM machine - it crashed with a failed malloc. Well, I'll know what to
expect and not be surprised in the future.

--
Sent from: http://forum.openscad.org/

kintel wrote > OpenSCAD trades exactness and robustness for speed. Thank you. I can understand this approach. FWIW, I tried to render my original file from the command line on a 128GB RAM machine - it crashed with a failed malloc. Well, I'll know what to expect and not be surprised in the future. -- Sent from: http://forum.openscad.org/
M
Manuel
Fri, Dec 1, 2017 2:50 PM

TLC123 wrote

I would do this as an rotate_extrude .

Wow, perfect, thank you! Works like a charm and is lightning fast even with
both $fa and $fs at .1. Good to know that trick for the future.

--
Sent from: http://forum.openscad.org/

TLC123 wrote > I would do this as an rotate_extrude . Wow, perfect, thank you! Works like a charm and is lightning fast even with both $fa and $fs at .1. Good to know that trick for the future. -- Sent from: http://forum.openscad.org/
TP
Torsten Paul
Fri, Dec 1, 2017 10:39 PM

On 01.12.2017 15:50, Manuel wrote:

TLC123 wrote

I would do this as an rotate_extrude .

Wow, perfect, thank you! Works like a charm and is lightning fast
even with both $fa and $fs at .1. Good to know that trick for the
future.

Yes, good point, generating vertices by extrusion is pretty fast.

You need to make sure there's no additional (3D) CSG operation with
that object. As soon as you simply put another cube(); in there, it
will blow up again.

ciao,
Torsten.

On 01.12.2017 15:50, Manuel wrote: > TLC123 wrote >> I would do this as an rotate_extrude . > > Wow, perfect, thank you! Works like a charm and is lightning fast > even with both $fa and $fs at .1. Good to know that trick for the > future. > Yes, good point, generating vertices by extrusion is pretty fast. You need to make sure there's no additional (3D) CSG operation with that object. As soon as you simply put another cube(); in there, it will blow up again. ciao, Torsten.