Nabble has removed Mailing-list integration.
Posts created here DO NOT GET SENT TO THE MAILING LIST.
Mailing-list emails DO NOT GET POSTED TO THE FORUM.
So basically the Forum is now out of date, we are looking into migrating the history.
module all(m) {
m(); mirror([1, 0, 0]) m(); mirror([0, 1, 0]) { m(); mirror([1, 0, 0]) m(); } } I am finding strange this does not work. What would be the best solution for the above problem? _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
How do you mean not work? What does it do? On Thu, 4 Jun 2020, 10:36 sean d'epagnier, <[hidden email]> wrote: module all(m) { _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by seandepagnier
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 [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
I want to pass different modules like:
module m() { cube(10); } module n() { ... } all(m); all(n); On 6/4/20, lar3ry <[hidden email]> 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 > [hidden email] > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
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(); On Thu, 4 Jun 2020, 11:17 sean d'epagnier, <[hidden email]> wrote: I want to pass different modules like: _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
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 <[hidden email]> wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
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 <[hidden email]> wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> >> 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, <[hidden email]> >>> wrote: >>> >>>> I want to pass different modules like: >>>> module m() { >>>> cube(10); >>>> } >>>> >>>> module n() { >>>> ... >>>> } >>>> >>>> all(m); >>>> all(n); >>>> >>>> On 6/4/20, lar3ry <[hidden email]> 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 >>>> > [hidden email] >>>> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>>> > >>>> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> [hidden email] >>>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>>> >>> > _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Modules aren't passable at all, they are in a different space On Thu, 4 Jun 2020, 15:51 sean d'epagnier, <[hidden email]> wrote: Thanks for pointing out the use of children(), this makes a lot more possible. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by seandepagnier
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 <[hidden email]> wrote: Thanks for pointing out the use of children(), this makes a lot more possible. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
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); > _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by nophead
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 <[hidden email]> wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by jon_bondy
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 <[hidden email]> wrote: a BIT of a hack? _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by seandepagnier
This is still a limitation compared to multiple parameters.. but I 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(); _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by nophead
Yes but useful when we have a big list that is
constant
throughout a recursive process. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
I have learned a lot.. The $ variables hack is interesting, but I
hope not to use it. On 6/4/20, Ronaldo Persiano <[hidden email]> 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. > _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Free forum by Nabble | Edit this page |