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.

For now you should send emails, people will see them, discuss@lists.openscad.org.

too much WARNING: Bad range parameter in for statement: too many elements

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

too much WARNING: Bad range parameter in for statement: too many elements

bboett
Hello,
trying to build a sand filter for my pump, made this :

module SandFilter(partikel = 1, luft = .2, overkill = 1)
{
  //halbZollMutter();//need my libs for that one
  translate([0,0,11])
  {
    difference()
    {
      cylinder(d1=24.3, d2=40, h=20,$fn = 64);
      translate([0,0,-1])
        cylinder(d1=18.5, d2=36, h=22,$fn = 64);
    }
  }
  pumpFlaeche = PI*18.5*18.5/4;
  lochFlAeche = PI * partikel*partikel/4;
  anzahl = ceil(PI*18.5/(partikel+luft));
  einKreisF = anzahl * lochFlAeche;
  kreisAnzahl = ceil(pumpFlaeche/einKreisF)+2;//+2 to compensate for borders
  echo("Pf = ",pumpFlaeche, " LF : ", lochFlAeche," * ",anzahl," = ", einKreisF," * ",kreisAnzahl);
  translate([0,0,31])
  {
    difference()
    {
      cylinder(d=40, h=overkill*kreisAnzahl*(partikel+luft),$fn = 64);
      union()
      {
          schritt = 1*(partikel+luft);
        translate([0,0,-1])
          cylinder(d=36, h=overkill*kreisAnzahl*(partikel+luft)-1,$fn = 64);
        for(y = [1 : schritt:overkill*(kreisAnzahl)*(partikel+luft)-1])
        {
          translate([0,0,y])
            for(w = [0 : 360/anzahl:360])
              rotate([0,0,w+((y/schritt)%2*90/anzahl)])
                color("red")translate([0,30,0])rotate([90,0,0])cylinder(d=partikel, h=60,$fn = 64);
            for(r = [0 : (partikel+luft):18])
            for(w = [0 : ceil(PI*r/(partikel+luft)):360])
            rotate([0,0,w])
            translate([0,r,overkill*kreisAnzahl*(partikel+luft)-2])
                color("red")cylinder(d=partikel, h=10,$fn = 64);
        }
      }
    }
  }
}//module SandFilter(partikel = 1)

problem is here i filter 1mm sand corns, i would like to go down to .2, or even try .1 but as is, i launched to compilation for 1mm holes 20 min ago and i am at 34/1000 in the advancement bar :'(

so this doesn't seem to be the right way to do it? what would the correct one be?

--
ciao
Bruno

===========================================
http://nohkumado.eu/, http://aikido.nohkumado.eu/,
http://aikido.zorn.free.fr

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: too much WARNING: Bad range parameter in for statement: too many elements

nophead
I can't follow the code as I don't speak German and the error message I get from running it doesn't make sense.

ECHO: "Pf = ", 268.803, " LF : ", 314.159, " * ", 3, " = ", 942.478, " * ", 3

WARNING: Bad range parameter in for statement: too many elements (4294967295), in file RepRaptor, line 36 

TRACE: called by 'for', in file RepRaptor, line 36. 

TRACE: called by 'for', in file RepRaptor, line 35. 

TRACE: called by 'for', in file RepRaptor, line 29. 

TRACE: called by 'union', in file RepRaptor, line 24. 

TRACE: called by 'difference', in file RepRaptor, line 21. 

TRACE: called by 'translate', in file RepRaptor, line 19. 

TRACE: called by 'SandFilter', in file RepRaptor, line 47. 


The file is Untitled.scad, there is no file called RepRaptor.


I don't know where 4 billion comes from, seems to be 2^32-1.


The likely solution to it being too slow is to do it in 2D and linear extrude the result.


On Sat, 9 May 2020 at 12:48, Bruno Boettcher <[hidden email]> wrote:
Hello,
trying to build a sand filter for my pump, made this :

module SandFilter(partikel = 1, luft = .2, overkill = 1)
{
  //halbZollMutter();//need my libs for that one
  translate([0,0,11])
  {
    difference()
    {
      cylinder(d1=24.3, d2=40, h=20,$fn = 64);
      translate([0,0,-1])
        cylinder(d1=18.5, d2=36, h=22,$fn = 64);
    }
  }
  pumpFlaeche = PI*18.5*18.5/4;
  lochFlAeche = PI * partikel*partikel/4;
  anzahl = ceil(PI*18.5/(partikel+luft));
  einKreisF = anzahl * lochFlAeche;
  kreisAnzahl = ceil(pumpFlaeche/einKreisF)+2;//+2 to compensate for borders
  echo("Pf = ",pumpFlaeche, " LF : ", lochFlAeche," * ",anzahl," = ", einKreisF," * ",kreisAnzahl);
  translate([0,0,31])
  {
    difference()
    {
      cylinder(d=40, h=overkill*kreisAnzahl*(partikel+luft),$fn = 64);
      union()
      {
          schritt = 1*(partikel+luft);
        translate([0,0,-1])
          cylinder(d=36, h=overkill*kreisAnzahl*(partikel+luft)-1,$fn = 64);
        for(y = [1 : schritt:overkill*(kreisAnzahl)*(partikel+luft)-1])
        {
          translate([0,0,y])
            for(w = [0 : 360/anzahl:360])
              rotate([0,0,w+((y/schritt)%2*90/anzahl)])
                color("red")translate([0,30,0])rotate([90,0,0])cylinder(d=partikel, h=60,$fn = 64);
            for(r = [0 : (partikel+luft):18])
            for(w = [0 : ceil(PI*r/(partikel+luft)):360])
            rotate([0,0,w])
            translate([0,r,overkill*kreisAnzahl*(partikel+luft)-2])
                color("red")cylinder(d=partikel, h=10,$fn = 64);
        }
      }
    }
  }
}//module SandFilter(partikel = 1)

problem is here i filter 1mm sand corns, i would like to go down to .2, or even try .1 but as is, i launched to compilation for 1mm holes 20 min ago and i am at 34/1000 in the advancement bar :'(

so this doesn't seem to be the right way to do it? what would the correct one be?

--
ciao
Bruno

===========================================
http://nohkumado.eu/, http://aikido.nohkumado.eu/,
http://aikido.zorn.free.fr
_______________________________________________
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
tp3
Reply | Threaded
Open this post in threaded view
|

Re: too much WARNING: Bad range parameter in for statement: too many elements

tp3
In reply to this post by bboett
If you put an echo between the 2 for loop

for(r = [0 : (partikel+luft):18])
echo(step = ceil(PI*r/(partikel+luft)))
for(w = [0 : ceil(PI*r/(partikel+luft)):360])

you'll see that the step gets 0 at some point, which makes
the range basically infinite causing the complaint citing
the maximum integer as loop count.

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: too much WARNING: Bad range parameter in for statement: too many elements

bboett
Indeed... argh.... i could kick myself....

still its very slow....

ok, here's the corrected (and commented, does that help?) code:

//filter for a pump, outside diameter 4cm, partikel size as argument as an offset to space them up
//overkill, factor to increase the needed surface, 1 same surface
module Filter(partikel,luft, overkill)
{
  pumpFlaeche = PI*18.5*18.5/4;//surface of the pumphole
  lochFlAeche = PI * partikel*partikel/4;//surface of the individual hole
  anzahl = ceil(PI*18.5/(partikel+luft));//number of holes on the radius of the filter
  einKreisF = anzahl * lochFlAeche; //surface of one circle of holes
  kreisAnzahl = ceil(pumpFlaeche/einKreisF)+2;//number of circles needed +2 to compensate for borders
  //echo("Pf = ",pumpFlaeche, " LF : ", lochFlAeche," * ",anzahl," = ", einKreisF," * ",kreisAnzahl);
  difference()
  {
    cylinder(d=40, h=overkill*kreisAnzahl*(partikel+luft),$fn = 64);
    union()
    {
      schritt = 1*(partikel+luft);
      translate([0,0,-1])
        cylinder(d=36, h=overkill*kreisAnzahl*(partikel+luft)-1,$fn = 64);
      for(y = [1 : schritt:overkill*(kreisAnzahl)*(partikel+luft)-1])
      {
        translate([0,0,y])
          for(w = [0 : 360/anzahl:360])
            rotate([0,0,w+((y/schritt)%2*90/anzahl)])
              color("red")translate([0,30,0])rotate([90,0,0])cylinder(d=partikel, h=60,$fn = 64);
        for(r = [partikel : (partikel+luft):18])
           for(w = [0 : 360/ceil(PI*r/(partikel+luft)):360])
              rotate([0,0,w])
              translate([0,r,overkill*kreisAnzahl*(partikel+luft)-2])
              color("red")cylinder(d=partikel, h=10,$fn = 64);
      }
    }
  }
}

Am Sa., 9. Mai 2020 um 14:32 Uhr schrieb Torsten Paul <[hidden email]>:
If you put an echo between the 2 for loop

for(r = [0 : (partikel+luft):18])
echo(step = ceil(PI*r/(partikel+luft)))
for(w = [0 : ceil(PI*r/(partikel+luft)):360])

you'll see that the step gets 0 at some point, which makes
the range basically infinite causing the complaint citing
the maximum integer as loop count.

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


--
ciao
Bruno

===========================================
http://nohkumado.eu/, http://aikido.nohkumado.eu/,
http://aikido.zorn.free.fr

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: too much WARNING: Bad range parameter in for statement: too many elements

bboett
1h later we are at 143/1000 for the compilation :(

Am Sa., 9. Mai 2020 um 15:06 Uhr schrieb Bruno Boettcher <[hidden email]>:
Indeed... argh.... i could kick myself....

still its very slow....

ok, here's the corrected (and commented, does that help?) code:

//filter for a pump, outside diameter 4cm, partikel size as argument as an offset to space them up
//overkill, factor to increase the needed surface, 1 same surface
module Filter(partikel,luft, overkill)
{
  pumpFlaeche = PI*18.5*18.5/4;//surface of the pumphole
  lochFlAeche = PI * partikel*partikel/4;//surface of the individual hole
  anzahl = ceil(PI*18.5/(partikel+luft));//number of holes on the radius of the filter
  einKreisF = anzahl * lochFlAeche; //surface of one circle of holes
  kreisAnzahl = ceil(pumpFlaeche/einKreisF)+2;//number of circles needed +2 to compensate for borders
  //echo("Pf = ",pumpFlaeche, " LF : ", lochFlAeche," * ",anzahl," = ", einKreisF," * ",kreisAnzahl);
  difference()
  {
    cylinder(d=40, h=overkill*kreisAnzahl*(partikel+luft),$fn = 64);
    union()
    {
      schritt = 1*(partikel+luft);
      translate([0,0,-1])
        cylinder(d=36, h=overkill*kreisAnzahl*(partikel+luft)-1,$fn = 64);
      for(y = [1 : schritt:overkill*(kreisAnzahl)*(partikel+luft)-1])
      {
        translate([0,0,y])
          for(w = [0 : 360/anzahl:360])
            rotate([0,0,w+((y/schritt)%2*90/anzahl)])
              color("red")translate([0,30,0])rotate([90,0,0])cylinder(d=partikel, h=60,$fn = 64);
        for(r = [partikel : (partikel+luft):18])
           for(w = [0 : 360/ceil(PI*r/(partikel+luft)):360])
              rotate([0,0,w])
              translate([0,r,overkill*kreisAnzahl*(partikel+luft)-2])
              color("red")cylinder(d=partikel, h=10,$fn = 64);
      }
    }
  }
}

Am Sa., 9. Mai 2020 um 14:32 Uhr schrieb Torsten Paul <[hidden email]>:
If you put an echo between the 2 for loop

for(r = [0 : (partikel+luft):18])
echo(step = ceil(PI*r/(partikel+luft)))
for(w = [0 : ceil(PI*r/(partikel+luft)):360])

you'll see that the step gets 0 at some point, which makes
the range basically infinite causing the complaint citing
the maximum integer as loop count.

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


--
ciao
Bruno

===========================================
http://nohkumado.eu/, http://aikido.nohkumado.eu/,
http://aikido.zorn.free.fr


--
ciao
Bruno

===========================================
http://nohkumado.eu/, http://aikido.nohkumado.eu/,
http://aikido.zorn.free.fr

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: too much WARNING: Bad range parameter in for statement: too many elements

nophead
OK I can see my 2D suggestion makes no sense now.

I think it will go a lot faster if you stop the cylinders intersecting at the middle. Any 3D operation with so many objects will be slow though.

On Sat, 9 May 2020 at 15:13, Bruno Boettcher <[hidden email]> wrote:
1h later we are at 143/1000 for the compilation :(

Am Sa., 9. Mai 2020 um 15:06 Uhr schrieb Bruno Boettcher <[hidden email]>:
Indeed... argh.... i could kick myself....

still its very slow....

ok, here's the corrected (and commented, does that help?) code:

//filter for a pump, outside diameter 4cm, partikel size as argument as an offset to space them up
//overkill, factor to increase the needed surface, 1 same surface
module Filter(partikel,luft, overkill)
{
  pumpFlaeche = PI*18.5*18.5/4;//surface of the pumphole
  lochFlAeche = PI * partikel*partikel/4;//surface of the individual hole
  anzahl = ceil(PI*18.5/(partikel+luft));//number of holes on the radius of the filter
  einKreisF = anzahl * lochFlAeche; //surface of one circle of holes
  kreisAnzahl = ceil(pumpFlaeche/einKreisF)+2;//number of circles needed +2 to compensate for borders
  //echo("Pf = ",pumpFlaeche, " LF : ", lochFlAeche," * ",anzahl," = ", einKreisF," * ",kreisAnzahl);
  difference()
  {
    cylinder(d=40, h=overkill*kreisAnzahl*(partikel+luft),$fn = 64);
    union()
    {
      schritt = 1*(partikel+luft);
      translate([0,0,-1])
        cylinder(d=36, h=overkill*kreisAnzahl*(partikel+luft)-1,$fn = 64);
      for(y = [1 : schritt:overkill*(kreisAnzahl)*(partikel+luft)-1])
      {
        translate([0,0,y])
          for(w = [0 : 360/anzahl:360])
            rotate([0,0,w+((y/schritt)%2*90/anzahl)])
              color("red")translate([0,30,0])rotate([90,0,0])cylinder(d=partikel, h=60,$fn = 64);
        for(r = [partikel : (partikel+luft):18])
           for(w = [0 : 360/ceil(PI*r/(partikel+luft)):360])
              rotate([0,0,w])
              translate([0,r,overkill*kreisAnzahl*(partikel+luft)-2])
              color("red")cylinder(d=partikel, h=10,$fn = 64);
      }
    }
  }
}

Am Sa., 9. Mai 2020 um 14:32 Uhr schrieb Torsten Paul <[hidden email]>:
If you put an echo between the 2 for loop

for(r = [0 : (partikel+luft):18])
echo(step = ceil(PI*r/(partikel+luft)))
for(w = [0 : ceil(PI*r/(partikel+luft)):360])

you'll see that the step gets 0 at some point, which makes
the range basically infinite causing the complaint citing
the maximum integer as loop count.

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


--
ciao
Bruno

===========================================
http://nohkumado.eu/, http://aikido.nohkumado.eu/,
http://aikido.zorn.free.fr


--
ciao
Bruno

===========================================
http://nohkumado.eu/, http://aikido.nohkumado.eu/,
http://aikido.zorn.free.fr
_______________________________________________
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
tp3
Reply | Threaded
Open this post in threaded view
|

Re: too much WARNING: Bad range parameter in for statement: too many elements

tp3
On 09.05.20 16:40, nop head wrote:
> I think it will go a lot faster if you stop the cylinders
> intersecting at the middle. Any 3D operation with so many> objects will be slow though.

Also it seems the code is generating the top holes multiple
times.

Maybe check if $fn = 64 is really needed for all those tiny
holes.

ciao,
  Torsten.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: too much WARNING: Bad range parameter in for statement: too many elements

Ronaldo
Besides the high $fn values for holes, your code imposes extra avoidable work to CGAL. For instance, the for loop that makes the top holes is inside the for loop of the radial holes; the cylinders making the ring of radial holes are duplicated and unnecessarily longs. You could use a high $fn value for the outer filter cylinder but keep a smaller value for the hole cylinders.

Correcting those flaws and redesigning a little the order of the operations, I was able to render your filter in 2min 48sec while your original code required 13min 26sec in my machine, both running with $fn=64 for the outer cylinder and $fn=24 for the others. If you need I can share my code.


Em sáb., 9 de mai. de 2020 às 16:03, Torsten Paul <[hidden email]> escreveu:
On 09.05.20 16:40, nop head wrote:
> I think it will go a lot faster if you stop the cylinders
> intersecting at the middle. Any 3D operation with so many> objects will be slow though.

Also it seems the code is generating the top holes multiple
times.

Maybe check if $fn = 64 is really needed for all those tiny
holes.

ciao,
  Torsten.

_______________________________________________
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