[OpenSCAD] Does PythonOCC work better than CGAL in Cadmium...?
Dan Zuras 3D
threedee at nonabelian.com
Sun Jun 12 09:56:51 CEST 2011
> From: Jayesh Salvi <jayeshsalvi at gmail.com>
> Date: Sun, 12 Jun 2011 12:05:39 +0530
> Subject: Re: Does PythonOCC work better than CGAL in Cadmium...?
> To: Dan Zuras 3D <threedee at nonabelian.com>
> Cc: openscad at rocklinux.org
> I am resending this email, without the attachment, because the
> attachment being >40k made it go to approval queue.
> This is what I've got.
> You can see the program here
Clear. Quick. Concise. I like it.
> Here is the solid that got generated:
You got it right. That's exactly the right picture.
> Here is the time it took:
> [ ~/git/cadmium ] : time python examples/example-008.py
> real 7m25.137s
> user 6m56.506s
> sys 0m6.776s
> This was running in ubuntu-server VM of VirtualBox with 1GB RAM and
> single core CPU. I was monitoring the process in top and saw the
> memory usage gradually increase. Near the end it maxed at 92%.
Good test procedure. I see you were careful.
> I suspect it will be much faster and lighter when we apply this
> algorithm to actual circle and square.
I'm not so sure. See below.
Well, that was quick.
Maybe I should learn this stuff after all. :-)
OK, let me look at things carefully.
Hmm, I see the cylinders in the code but not in the
png file. They are not really needed. Did you remove
them before the plot or are they not rendering for
This is also only up to level 8 in the recursion.
I went to level 13 with OpenSCAD (32 times bigger).
Did you really come near blowing out 1GB at level 8?
If that is so then, while your resource allocation may
be worse, we don't really know about your speed. You
may have been swapping near the end there.
If level 8 is your max, let me suggest you time all of
levels 5, 6, 7, & 8. If memory is not involved in the
timing of things they should go up by a factor of almost
exactly 2 each time. But if you are running into some
system limitation on the last one then it may be
substantially longer than twice the previous one.
So I don't know yet if this is good or bad.
I am impressed with how fast you were able to translate
the code & get it going. It tells me I may have a new
language to learn. Any pointers for the beginner?
On the other hand, level 8 is far lower than I got with
OpenSCAD. And far FAR lower than 3D CAD software should
be capable of.
Let's see, level 8 consists of 256 overlapping cubes &
512 overlapping cylinders (if they are there) for a total
of 768 objects altogether. If representing them takes
~ 1GB then that's 1GB/768 objects ~ 1.4MB/object. (Or
1GB/256 ~ 4MB/object, if the cylinders are not there.)
That's just not reasonable to me. Is there something
about 3D CAD software that I don't understand that causes
this to be so?
I can't believe this is the case. There must be something
else taking up all this memory. What can it be & how can
we get rid of it?
P.S. - I was looking at your code again before I hit send
& I noticed that you used a local variable for the complex
translation but not for the recursed dragon(k-1,s) curve.
Can you do that? It might turn an O(2^k) recursion into
an O(k) recursion if you did. Its worth a look. Its also
something I couldn't figure out how to do in OpenSCAD.
More information about the OpenSCAD