[OpenSCAD] for loop implicid union.

nop head nop.head at gmail.com
Sat Sep 1 05:11:16 EDT 2018


Yes its a major problem but it isn't just for loops. Any openscad module,
like translate(), etc, can only return one child, so it has to union its
results.

The only way to get more than one child is to have a list in braces
directly after the object with the children() statements. You can't even
pass them on because children() being a module only ever returns one node.

I believe there is work in progress to fix this.

On 1 September 2018 at 09:45, Rogier Wolff <R.E.Wolff at bitwizard.nl> wrote:

> Hi,
>
> I have this puzzle I'm making:
>     makepuzzle (pitch=35, theblock = bn, real=1)
>       {
>         rotate ([  0,  0,  0]) beam (r=bs, height=bl);
>         rotate ([  0,180,  0]) beam (r=bs, height=bl);
>         rotate ([  0, 90, 90]) beam (r=bs, height=bl);
>         rotate ([  0,-90,-90]) beam (r=bs, height=bl);
>         rotate ([ 90,  0, 90]) beam (r=bs, height=bl);
>         rotate ([-90,  0,-90]) beam (r=bs, height=bl);
>       }
>
> where I would like to have the list-of-rotations available elsewhere.
>
> So I'm going towards:
>
>     makepuzzle (pitch=35, theblock = bn, real=1)
>       for (i=[0:5])
>         rotate (lor[i]) beam (r=bs, height=bl);
>
> (lor  is the list-of-rotations).
>
> but now the "makepuzzle" module has only one child because for does an
> implicit union. And makepuzzle needs access to all the six
> children....
>
> IMHO this is why the "implicit" anything is not a good idea. In pascal
> there is the "writeln" with the implicit newline. As a building block
> you cannot make a "write" out of that, but the other way around you
> can easily make a writeln out of "write".
>
> Similarly here: If you want a union of your for loop you can easily
> add the union in front, but the other way around is difficult. Or at
> least not obvious how to do it for me.
>
>         Roger.
>
> --
> ** R.E.Wolff at BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2600998 **
> **    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **
> *-- BitWizard writes Linux device drivers for any device you may have! --*
> The plan was simple, like my brother-in-law Phil. But unlike
> Phil, this plan just might work.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180901/38fd947b/attachment.html>


More information about the Discuss mailing list