[OpenSCAD] for loop implicid union.

Rogier Wolff R.E.Wolff at BitWizard.nl
Sat Sep 1 04:45:23 EDT 2018


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.



More information about the Discuss mailing list