John Savage
2018-09-12 14:06:41 UTC
I would like to be able to write a single let() statement and use it on
multiple modules. A simple example is
module leta(){
let(a=23)
children();
}
leta() cylinder(h=a, d=a); // Doesn't work, a is unknown here.
However this does work:
module move(x){
translate([x,0,0])
children();
}
module cone_rod(){
cylinder(h=10,d=5);
cylinder(h=5,d1=15,d2=0);
}
move(0) cone_rod(); // Works as expected
move(20) cone_rod(); // Works as expected
What's the difference and why doesn't the first example work?
Thanks,
John
multiple modules. A simple example is
module leta(){
let(a=23)
children();
}
leta() cylinder(h=a, d=a); // Doesn't work, a is unknown here.
However this does work:
module move(x){
translate([x,0,0])
children();
}
module cone_rod(){
cylinder(h=10,d=5);
cylinder(h=5,d1=15,d2=0);
}
move(0) cone_rod(); // Works as expected
move(20) cone_rod(); // Works as expected
What's the difference and why doesn't the first example work?
Thanks,
John