I have written this funciton in OpensCAD 2019.05:
module build(s,ndst)
{
thing(s,$nsrc,ndst,port)
union()
{
$nsrc=ndst;
children();
}
}
Watch the custom $nsrc variable.
Its set to a certain value at the beginning. But it can be redefined for
the inner scope
when children() is executed.
The fact that variables are set at compile time and only the latest value
set holds is no longer true.
Without using the $ sign, this does not work anymore
cheers, Günther
Variables that start with a $ have dynamic scope and are visible in all the
called functions and modules and children. Normal variables have lexical
scope and are visible in the textually nested blocks only.
It is mentioned here:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Special_Variables
On Wed, 19 Jun 2019 at 15:29, Guenther Sohler guenther.sohler@gmail.com
wrote:
I have written this funciton in OpensCAD 2019.05:
module build(s,ndst)
{
thing(s,$nsrc,ndst,port)
union()
{
$nsrc=ndst;
children();
}
}
Watch the custom $nsrc variable.
Its set to a certain value at the beginning. But it can be redefined for
the inner scope
when children() is executed.
The fact that variables are set at compile time and only the latest value
set holds is no longer true.
Without using the $ sign, this does not work anymore
cheers, Günther
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org