a BIT of a hack?
On 6/4/2020 3:54 PM, nop head wrote:
You can pass parameters to children via $ variables. A bit of hack but
it works.
module ten() {
let($p = 10) children();
}
ten() cube($p);
Not sure what your question was, but you can pass multiple modules as
children.
module twokids() {
difference() {
children(0);
children(1);
}
}
twokids() {
cube();
sphere();
}
On Thu, 4 Jun 2020 at 20:54, nop head nop.head@gmail.com wrote:
You can pass parameters to children via $ variables. A bit of hack but it
works.
module ten() {
let($p = 10) children();
}
ten() cube($p);
On Thu, 4 Jun 2020 at 20:51, sean d'epagnier seandepagnier@gmail.com
wrote:
Thanks for pointing out the use of children(), this makes a lot more
possible.
This is still a limitation compared to multiple parameters.. but I
guess openscad doesn't allow mixing passed parameters with modules.
On 6/4/20, A. Craig West acraigwest@gmail.com wrote:
Personally, I think it would be awesome if there was a version of
render()
which was a function, that returned a list of faces
On Thu, Jun 4, 2020 at 11:34 AM A. Craig West acraigwest@gmail.com
wrote:
essentially there are userspace objects that can be passed as
parameters,
and rendered objects, like modules, and they live in different spaces
On Thu, Jun 4, 2020 at 11:33 AM A. Craig West acraigwest@gmail.com
wrote:
Ahhh, modules aren't objects that can be passed. You would use
children()
:
module all() {
children();
mirror([1, 0, 0])
children();
mirror([0, 1, 0]) {
children();
mirror([1, 0, 0])
children();
}
}
module m() {
cube(10);
}
module n() {
cube(20);
}
all() m();
all() n();
On Thu, 4 Jun 2020, 11:17 sean d'epagnier, seandepagnier@gmail.com
wrote:
I want to pass different modules like:
module m() {
cube(10);
}
module n() {
...
}
all(m);
all(n);
On 6/4/20, lar3ry lar3ry@sasktel.net wrote:
Works fine for me.
all();
module all(m) {
m();
mirror([1, 0, 0])
m();
mirror([0, 1, 0]) {
m();
mirror([1, 0, 0])
m();
}
}
module m() {
cube(10);
}
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
Yes, it is. But I do find it necessary sometimes. Even worse is use $p in
the child module without it being a parameter!
On Thu, 4 Jun 2020 at 20:59, jon jon@jonbondy.com wrote:
a BIT of a hack?
On 6/4/2020 3:54 PM, nop head wrote:
You can pass parameters to children via $ variables. A bit of hack but
it works.
module ten() {
let($p = 10) children();
}
ten() cube($p);
This is still a limitation compared to multiple parameters.. but I
guess openscad doesn't allow mixing passed parameters with modules.
You may use parameters in all() provided they are not modules:
module all(v=[0,0,0]) {
translate(v)
children();
mirror([1, 0, 0])
translate(v)
children();
mirror([0, 1, 0]) {
translate(v)
children();
mirror([1, 0, 0])
translate(v)
children();
}
}
module m() {
sphere(10);
}
module n() {
cube(10);
}
all([20,20,20]) m();
all([10,10,-10]) n();
Even worse is use $p in the child module without it being a parameter!
Yes but useful when we have a big list that is constant throughout a
recursive process.
I have learned a lot.. The $ variables hack is interesting, but I
hope not to use it.
On 6/4/20, Ronaldo Persiano rcmpersiano@gmail.com wrote:
Even worse is use $p in the child module without it being a parameter!
Yes but useful when we have a big list that is constant throughout a
recursive process.