[OpenSCAD] limit on range in for statement

kitwallace kit.wallace at gmail.com
Tue Oct 15 05:16:14 EDT 2019


I'm bumping into another limit - for long lists of points the following fails
with

WARNING: Bad range parameter in for statement: too many elements (12288), in
file lsystem.scad, line 69

module path(points,width,closed=false) {
   r=width/2;
   for (i=[0:len(points)-2]) {
      hull() {    
          translate(points[i]) circle(r);
          translate(points[i+1]) circle(r);
      }    
    }
    if (closed) {
      hull() {    
          translate(points[len(points)-1]) 
              circle(r);
          translate(points[0])
              circle(r);
      } 
    }
};

A workaround is to replace the range with a vector in the for statement:

for (i=to_n(len(points)-2)) 

where

function to_n(n) = [for (i=0;i<=n;i=i+1) i];

but this seems clumsy 
Any other ways to get past this limit - I believe it's 9999 ?

Kit



--
Sent from: http://forum.openscad.org/



More information about the Discuss mailing list