Module question

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Module question

Johannes Reinhardt
Hi everybody,

I ran into some conceptual difficulties with modules. I have not done
much with OpenSCAD, but do quite a bit of programming, so I suspect
that my mental model of how OpenSCAD works is inaccurate.


I want to write modules that transform their child node in some way. So
a minimal example would be:

module up(){
    translate([0,0,1]) child();
}

module down(){
    translate([0,0,-1]) child();
}

up() down() cylinder();

Which works as expected. However

up() up() cylinder();

fails with the error message (OpenSCAD 2012.05.12, current git)
a while ago).

"Ignoring recursive module instantiation of 'translate'."


I would have expected that the resulting csg tree looks like that

translate
    |
translate
    |
cylinder

But apparently does something different which results in a recursion.
Maybe someone can shed some light on the evaluation rules in this case.
The documentation is not very specific for this topic and I was not
able to find something on the web.

Greetings

Johannes

--
Johannes Reinhardt <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: Module question

kintel
Administrator
On May 12, 2012, at 07:12 AM, Johannes Reinhardt wrote:

> But apparently does something different which results in a recursion.
> Maybe someone can shed some light on the evaluation rules in this case.
> The documentation is not very specific for this topic and I was not
> able to find something on the web.
>
I added this as an issue on github. Please follow this issue for updates:
https://github.com/openscad/openscad/issues/116

 -Marius