I have some code where a particular Module "M()" is invoked 4 times, but
only one of those times is actually displayed, because I only put "!" in
front of one of the references; the other 3 should be ignored. And yet
when I use echo() inside M(), it appears 4 times. It seems that while I
have only asked for ONE of the invocations to be calculated, in fact all
four are. One can hope that it is actually calculated only once, and
then pulled from a cache for the other 3 times, but this is not what I
expected. That is, in the code below, I thought that modules A(), B(),
and C() would be ignored entirely.
Not sure if this is important or just a curiosity. Not sure whether
there are performance issues lurking there.
Jon
module M() {
cube(1);
echo("hello");
}
module A()
M();
module B()
M();
module C()
M();
A();
B();
C();
!M();
they are all there. You should translate them differently then you'll see
them all.
Am Di., 9. Feb. 2021 um 16:19 Uhr schrieb jon jon@jonbondy.com:
I have some code where a particular Module "M()" is invoked 4 times, but
only one of those times is actually displayed, because I only put "!" in
front of one of the references; the other 3 should be ignored. And yet
when I use echo() inside M(), it appears 4 times. It seems that while I
have only asked for ONE of the invocations to be calculated, in fact all
four are. One can hope that it is actually calculated only once, and
then pulled from a cache for the other 3 times, but this is not what I
expected. That is, in the code below, I thought that modules A(), B(),
and C() would be ignored entirely.
Not sure if this is important or just a curiosity. Not sure whether
there are performance issues lurking there.
Jon
module M() {
cube(1);
echo("hello");
}
module A()
M();
module B()
M();
module C()
M();
A();
B();
C();
!M();
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
No, there's only one shown due to the ! (root modifier).
The root modifier only applies to display, not to evaluation,
so all the calls are done to evaluate the full script. That's
intentional at this point.
ciao,
Torsten.
Not true:
module M() {
cube(1);
echo("hello");
}
module A()
M();
module B()
M();
module C()
M();
translate([3, 0, 0]) A();
translate([6, 0, 0]) B();
translate([9, 0, 0]) C();
!M();
On 2/9/2021 10:47 AM, dpa wrote:
module M() {
cube(1);
echo("hello");
}
module A()
M();
module B()
M();
module C()
M();
A();
B();
C();
!M();
ah, well.. I have then probably misunderstood the question. That !M() only
outputs this one M() was so clear to me that I omitted it and the other 3
are just in the same place.
Am Di., 9. Feb. 2021 um 16:51 Uhr schrieb Torsten Paul <Torsten.Paul@gmx.de
:
No, there's only one shown due to the ! (root modifier).
The root modifier only applies to display, not to evaluation,
so all the calls are done to evaluate the full script. That's
intentional at this point.
ciao,
Torsten.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org