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@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.
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@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@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@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
On Sat, Sep 01, 2018 at 10:11:16AM +0100, nop head wrote:
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.
On 1 September 2018 at 09:45, Rogier Wolff R.E.Wolff@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);
}
I have found a reasonably elegant solution to my problem:
I have now the "one beam" module do the rotations (and colors)
So.. I'd like to use a loop here, but can't.
makepuzzle (pitch=35, theblock = bn, real=1) {
onebeam (0);
onebeam (1);
onebeam (2);
onebeam (3);
onebeam (4);
onebeam (5);
}
I'm working on a design where the number of pieces is not six, so
that'll be annoying. But other than that... things are looking good.
For printing I need to rotate the stuff back to a fixed orientation
so while forward rotation is:
rotate (lor[num]);
(list-of-rotations).
the inverse is:
module rrotate (v)
{
rotate ([-v[0],0,0])
rotate ([0,-v[1],0])
rotate ([0,0,-v[2]])
children ();
}
Roger.
--
** R.E.Wolff@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.
nophead wrote
I believe there is work in progress to fix this.
May be a while https://github.com/openscad/openscad/issues/350 , it needs
some neurons applied.
Admin - email* me if you need anything, or if I've done something stupid...
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
Sent from: http://forum.openscad.org/