discuss@lists.openscad.org

OpenSCAD general discussion

View all threads

for ( i = [start:step:stop]) {...} doesn't work

GH
Gene Heskett
Thu, Sep 2, 2021 12:01 PM

Taking some measurements and finding I need more clearance above this thing, I have embarqued on a process to
shrinks its diameter about 5mm.

However this is going to make the splines smaller and hsrder to print
at a 30/1 ratio. So I'm tryting to shrink the gear ratio too, to 25/1.
Which will expand the splines enough to maintain printability as long
as the flexibility needed doesn't break the innerspline part.

But the for loop that positions the splines around a circle, has turned
it all into a toothless no-op.

The code...
var declarations at top of file:

IDofspl=67.05;
splsocht=6.00;
ODofCup=IDofspl+splsocht*2.5;
sink=.745;// jack up bolt head countersink to top of 3.1 mm thick disk
sht=1.513;// height of countersink+noise in preview fudge
$fn=360;// make circles with 1 degree flats
reghole=38.3;// motor registration hole + printer undersize fudge, exact!
nemahole=47.2/2; // one side of square pattern, 47.1 is official target,
ddht=3.1;//input panel with nema 23 bolt pattern
ddia=5.1;//5mm bolt clearance
spcringh=6.0;//could be 6.3
spcringh1=6.0;//vertical offset
spcringd1=81.0;// outside of ring, id of surround band
spcringd2=66.5;// inside of spacer ring, press fit on spline od
wrapperh=18.5;//surround band height.
//globals for keys
t1=spcringd1;
t2=spcringd2+.3;
y=spcringh+.05;
z1=4.3;// key sizes, will need tweaked to fit well, probably by .2 + & -
z2=3.7;
z3=2.3;
z4=1.7;
// globals for output timing pulley
toothType=1;
toothWidth = 1.14; // Teeth of PULLEY, that is. Larger=tighter fit of teeth.

this module:

module outspline50() // mode must be 7
{
aa=42.0000; // was 69.00000000 a blond one too big
xx=5.7;//thickness
dd1=59.25;
dd0=66.7; // outer a bit snug in output cup, reduced from 67.75
toothrad50=29; // getting close, but not global
st = ([ 360.00000000 / 50.00000000 ]); // arc of circle per tooth, works but...
// for 50 st=7.2 but whole "for" has disappeared
echo ("336", aa, xx, dd0, dd1, st,toothrad50) ;  // echo? yes, once
union()
{
difference()
{ // the outside smoother
cylinder(d=dd0, h=xx, $fn=360); //outer is fussy
translate([0,0,-.005]) cylinder(d=dd1, h=xx+.01, $fn=360);
//but the inner isn't
} // end of that difference
// use this to add 50 inner splines
echo(346,st);
// for (i = [start:step:end]) { … } pasted from the cheat sheet
for (i = [0:st:359]) // enabling this line kills it all
// comment it and I get one spline whereever I set i
{
rotate([0,0,i]) // place around circle
translate([toothrad50,0,0])
// move x only
scale(v= [.1,.1,1]) //scale it to size
rotate(180)// switch rotate on for outers and readjust sizes
cylinder(d=aa, h=xx, $fn=3); // make big thick triangle
}
}
};

No doubt something gnubie stupid but what?

Thanks all.

Cheers, Gene Heskett

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.

Taking some measurements and finding I need more clearance above this thing, I have embarqued on a process to shrinks its diameter about 5mm. However this is going to make the splines smaller and hsrder to print at a 30/1 ratio. So I'm tryting to shrink the gear ratio too, to 25/1. Which will expand the splines enough to maintain printability as long as the flexibility needed doesn't break the innerspline part. But the for loop that positions the splines around a circle, has turned it all into a toothless no-op. The code... var declarations at top of file: ========== IDofspl=67.05; splsocht=6.00; ODofCup=IDofspl+splsocht*2.5; sink=.745;// jack up bolt head countersink to top of 3.1 mm thick disk sht=1.513;// height of countersink+noise in preview fudge $fn=360;// make circles with 1 degree flats reghole=38.3;// motor registration hole + printer undersize fudge, exact! nemahole=47.2/2; // one side of square pattern, 47.1 is official target, ddht=3.1;//input panel with nema 23 bolt pattern ddia=5.1;//5mm bolt clearance spcringh=6.0;//could be 6.3 spcringh1=6.0;//vertical offset spcringd1=81.0;// outside of ring, id of surround band spcringd2=66.5;// inside of spacer ring, press fit on spline od wrapperh=18.5;//surround band height. //globals for keys t1=spcringd1; t2=spcringd2+.3; y=spcringh+.05; z1=4.3;// key sizes, will need tweaked to fit well, probably by .2 + & - z2=3.7; z3=2.3; z4=1.7; // globals for output timing pulley toothType=1; toothWidth = 1.14; // Teeth of PULLEY, that is. Larger=tighter fit of teeth. ========= this module: ========= module outspline50() // mode must be 7 { aa=42.0000; // was 69.00000000 a blond one too big xx=5.7;//thickness dd1=59.25; dd0=66.7; // outer a bit snug in output cup, reduced from 67.75 toothrad50=29; // getting close, but not global st = ([ 360.00000000 / 50.00000000 ]); // arc of circle per tooth, works but... // for 50 st=7.2 but whole "for" has disappeared echo ("336", aa, xx, dd0, dd1, st,toothrad50) ; // echo? yes, once union() { difference() { // the outside smoother cylinder(d=dd0, h=xx, $fn=360); //outer is fussy translate([0,0,-.005]) cylinder(d=dd1, h=xx+.01, $fn=360); //but the inner isn't } // end of that difference // use this to add 50 inner splines echo(346,st); // for (i = [start:step:end]) { … } pasted from the cheat sheet for (i = [0:st:359]) // enabling this line kills it all // comment it and I get one spline whereever I set i { rotate([0,0,i]) // place around circle translate([toothrad50,0,0]) // move x only scale(v= [.1,.1,1]) //scale it to size rotate(180)// switch rotate on for outers and readjust sizes cylinder(d=aa, h=xx, $fn=3); // make big thick triangle } } }; ======= No doubt something gnubie stupid but what? Thanks all. Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/gene>
NH
nop head
Thu, Sep 2, 2021 12:07 PM

st = ([ 360.00000000 / 50.00000000 ]);

That makes st a one element vector, which probably breaks the for loop. Why
all the brackets and decimal points? Why not 360/50?

On Thu, 2 Sept 2021 at 13:02, Gene Heskett gheskett@shentel.net wrote:

Taking some measurements and finding I need more clearance above this
thing, I have embarqued on a process to
shrinks its diameter about 5mm.

However this is going to make the splines smaller and hsrder to print
at a 30/1 ratio. So I'm tryting to shrink the gear ratio too, to 25/1.
Which will expand the splines enough to maintain printability as long
as the flexibility needed doesn't break the innerspline part.

But the for loop that positions the splines around a circle, has turned
it all into a toothless no-op.

The code...
var declarations at top of file:

IDofspl=67.05;
splsocht=6.00;
ODofCup=IDofspl+splsocht*2.5;
sink=.745;// jack up bolt head countersink to top of 3.1 mm thick disk
sht=1.513;// height of countersink+noise in preview fudge
$fn=360;// make circles with 1 degree flats
reghole=38.3;// motor registration hole + printer undersize fudge, exact!
nemahole=47.2/2; // one side of square pattern, 47.1 is official target,
ddht=3.1;//input panel with nema 23 bolt pattern
ddia=5.1;//5mm bolt clearance
spcringh=6.0;//could be 6.3
spcringh1=6.0;//vertical offset
spcringd1=81.0;// outside of ring, id of surround band
spcringd2=66.5;// inside of spacer ring, press fit on spline od
wrapperh=18.5;//surround band height.
//globals for keys
t1=spcringd1;
t2=spcringd2+.3;
y=spcringh+.05;
z1=4.3;// key sizes, will need tweaked to fit well, probably by .2 + & -
z2=3.7;
z3=2.3;
z4=1.7;
// globals for output timing pulley
toothType=1;
toothWidth = 1.14; // Teeth of PULLEY, that is. Larger=tighter fit of
teeth.

this module:

module outspline50() // mode must be 7
{
aa=42.0000; // was 69.00000000 a blond one too big
xx=5.7;//thickness
dd1=59.25;
dd0=66.7; // outer a bit snug in output cup, reduced from 67.75
toothrad50=29; // getting close, but not global
st = ([ 360.00000000 / 50.00000000 ]); // arc of circle per tooth,
works but...
// for 50 st=7.2 but whole "for" has disappeared
echo ("336", aa, xx, dd0, dd1, st,toothrad50) ;  // echo? yes, once
union()
{
difference()
{ // the outside smoother
cylinder(d=dd0, h=xx, $fn=360); //outer is fussy
translate([0,0,-.005]) cylinder(d=dd1, h=xx+.01, $fn=360);
//but the inner isn't
} // end of that difference
// use this to add 50 inner splines
echo(346,st);
// for (i = [start:step:end]) { … } pasted from the cheat sheet
for (i = [0:st:359]) // enabling this line kills it all
// comment it and I get one spline whereever I set i
{
rotate([0,0,i]) // place around circle
translate([toothrad50,0,0])
// move x only
scale(v= [.1,.1,1]) //scale it to size
rotate(180)// switch rotate on for outers and readjust sizes
cylinder(d=aa, h=xx, $fn=3); // make big thick triangle
}
}
};

No doubt something gnubie stupid but what?

Thanks all.

Cheers, Gene Heskett

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

st = ([ 360.00000000 / 50.00000000 ]); That makes st a one element vector, which probably breaks the for loop. Why all the brackets and decimal points? Why not 360/50? On Thu, 2 Sept 2021 at 13:02, Gene Heskett <gheskett@shentel.net> wrote: > Taking some measurements and finding I need more clearance above this > thing, I have embarqued on a process to > shrinks its diameter about 5mm. > > However this is going to make the splines smaller and hsrder to print > at a 30/1 ratio. So I'm tryting to shrink the gear ratio too, to 25/1. > Which will expand the splines enough to maintain printability as long > as the flexibility needed doesn't break the innerspline part. > > But the for loop that positions the splines around a circle, has turned > it all into a toothless no-op. > > The code... > var declarations at top of file: > ========== > IDofspl=67.05; > splsocht=6.00; > ODofCup=IDofspl+splsocht*2.5; > sink=.745;// jack up bolt head countersink to top of 3.1 mm thick disk > sht=1.513;// height of countersink+noise in preview fudge > $fn=360;// make circles with 1 degree flats > reghole=38.3;// motor registration hole + printer undersize fudge, exact! > nemahole=47.2/2; // one side of square pattern, 47.1 is official target, > ddht=3.1;//input panel with nema 23 bolt pattern > ddia=5.1;//5mm bolt clearance > spcringh=6.0;//could be 6.3 > spcringh1=6.0;//vertical offset > spcringd1=81.0;// outside of ring, id of surround band > spcringd2=66.5;// inside of spacer ring, press fit on spline od > wrapperh=18.5;//surround band height. > //globals for keys > t1=spcringd1; > t2=spcringd2+.3; > y=spcringh+.05; > z1=4.3;// key sizes, will need tweaked to fit well, probably by .2 + & - > z2=3.7; > z3=2.3; > z4=1.7; > // globals for output timing pulley > toothType=1; > toothWidth = 1.14; // Teeth of PULLEY, that is. Larger=tighter fit of > teeth. > ========= > this module: > ========= > module outspline50() // mode must be 7 > { > aa=42.0000; // was 69.00000000 a blond one too big > xx=5.7;//thickness > dd1=59.25; > dd0=66.7; // outer a bit snug in output cup, reduced from 67.75 > toothrad50=29; // getting close, but not global > st = ([ 360.00000000 / 50.00000000 ]); // arc of circle per tooth, > works but... > // for 50 st=7.2 but whole "for" has disappeared > echo ("336", aa, xx, dd0, dd1, st,toothrad50) ; // echo? yes, once > union() > { > difference() > { // the outside smoother > cylinder(d=dd0, h=xx, $fn=360); //outer is fussy > translate([0,0,-.005]) cylinder(d=dd1, h=xx+.01, $fn=360); > //but the inner isn't > } // end of that difference > // use this to add 50 inner splines > echo(346,st); > // for (i = [start:step:end]) { … } pasted from the cheat sheet > for (i = [0:st:359]) // enabling this line kills it all > // comment it and I get one spline whereever I set i > { > rotate([0,0,i]) // place around circle > translate([toothrad50,0,0]) > // move x only > scale(v= [.1,.1,1]) //scale it to size > rotate(180)// switch rotate on for outers and readjust sizes > cylinder(d=aa, h=xx, $fn=3); // make big thick triangle > } > } > }; > ======= > > No doubt something gnubie stupid but what? > > Thanks all. > > Cheers, Gene Heskett > -- > "There are four boxes to be used in defense of liberty: > soap, ballot, jury, and ammo. Please use in that order." > -Ed Howdershelt (Author) > If we desire respect for the law, we must first make the law respectable. > - Louis D. Brandeis > Genes Web page <http://geneslinuxbox.net:6309/gene> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RP
Ronaldo Persiano
Thu, Sep 2, 2021 12:18 PM

I would expect a runtime error by using anything except numbers in a for
range.

Em qui., 2 de set. de 2021 às 13:10, nop head nop.head@gmail.com escreveu:

st = ([ 360.00000000 / 50.00000000 ]);

That makes st a one element vector, which probably breaks the for loop.
Why all the brackets and decimal points? Why not 360/50?

On Thu, 2 Sept 2021 at 13:02, Gene Heskett gheskett@shentel.net wrote:

Taking some measurements and finding I need more clearance above this
thing, I have embarqued on a process to
shrinks its diameter about 5mm.

However this is going to make the splines smaller and hsrder to print
at a 30/1 ratio. So I'm tryting to shrink the gear ratio too, to 25/1.
Which will expand the splines enough to maintain printability as long
as the flexibility needed doesn't break the innerspline part.

But the for loop that positions the splines around a circle, has turned
it all into a toothless no-op.

The code...
var declarations at top of file:

IDofspl=67.05;
splsocht=6.00;
ODofCup=IDofspl+splsocht*2.5;
sink=.745;// jack up bolt head countersink to top of 3.1 mm thick disk
sht=1.513;// height of countersink+noise in preview fudge
$fn=360;// make circles with 1 degree flats
reghole=38.3;// motor registration hole + printer undersize fudge, exact!
nemahole=47.2/2; // one side of square pattern, 47.1 is official target,
ddht=3.1;//input panel with nema 23 bolt pattern
ddia=5.1;//5mm bolt clearance
spcringh=6.0;//could be 6.3
spcringh1=6.0;//vertical offset
spcringd1=81.0;// outside of ring, id of surround band
spcringd2=66.5;// inside of spacer ring, press fit on spline od
wrapperh=18.5;//surround band height.
//globals for keys
t1=spcringd1;
t2=spcringd2+.3;
y=spcringh+.05;
z1=4.3;// key sizes, will need tweaked to fit well, probably by .2 + & -
z2=3.7;
z3=2.3;
z4=1.7;
// globals for output timing pulley
toothType=1;
toothWidth = 1.14; // Teeth of PULLEY, that is. Larger=tighter fit of
teeth.

this module:

module outspline50() // mode must be 7
{
aa=42.0000; // was 69.00000000 a blond one too big
xx=5.7;//thickness
dd1=59.25;
dd0=66.7; // outer a bit snug in output cup, reduced from 67.75
toothrad50=29; // getting close, but not global
st = ([ 360.00000000 / 50.00000000 ]); // arc of circle per tooth,
works but...
// for 50 st=7.2 but whole "for" has disappeared
echo ("336", aa, xx, dd0, dd1, st,toothrad50) ;  // echo? yes, once
union()
{
difference()
{ // the outside smoother
cylinder(d=dd0, h=xx, $fn=360); //outer is fussy
translate([0,0,-.005]) cylinder(d=dd1, h=xx+.01, $fn=360);
//but the inner isn't
} // end of that difference
// use this to add 50 inner splines
echo(346,st);
// for (i = [start:step:end]) { … } pasted from the cheat sheet
for (i = [0:st:359]) // enabling this line kills it all
// comment it and I get one spline whereever I set i
{
rotate([0,0,i]) // place around circle
translate([toothrad50,0,0])
// move x only
scale(v= [.1,.1,1]) //scale it to size
rotate(180)// switch rotate on for outers and readjust sizes
cylinder(d=aa, h=xx, $fn=3); // make big thick triangle
}
}
};

No doubt something gnubie stupid but what?

Thanks all.

Cheers, Gene Heskett

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I would expect a runtime error by using anything except numbers in a for range. Em qui., 2 de set. de 2021 às 13:10, nop head <nop.head@gmail.com> escreveu: > st = ([ 360.00000000 / 50.00000000 ]); > > That makes st a one element vector, which probably breaks the for loop. > Why all the brackets and decimal points? Why not 360/50? > > On Thu, 2 Sept 2021 at 13:02, Gene Heskett <gheskett@shentel.net> wrote: > >> Taking some measurements and finding I need more clearance above this >> thing, I have embarqued on a process to >> shrinks its diameter about 5mm. >> >> However this is going to make the splines smaller and hsrder to print >> at a 30/1 ratio. So I'm tryting to shrink the gear ratio too, to 25/1. >> Which will expand the splines enough to maintain printability as long >> as the flexibility needed doesn't break the innerspline part. >> >> But the for loop that positions the splines around a circle, has turned >> it all into a toothless no-op. >> >> The code... >> var declarations at top of file: >> ========== >> IDofspl=67.05; >> splsocht=6.00; >> ODofCup=IDofspl+splsocht*2.5; >> sink=.745;// jack up bolt head countersink to top of 3.1 mm thick disk >> sht=1.513;// height of countersink+noise in preview fudge >> $fn=360;// make circles with 1 degree flats >> reghole=38.3;// motor registration hole + printer undersize fudge, exact! >> nemahole=47.2/2; // one side of square pattern, 47.1 is official target, >> ddht=3.1;//input panel with nema 23 bolt pattern >> ddia=5.1;//5mm bolt clearance >> spcringh=6.0;//could be 6.3 >> spcringh1=6.0;//vertical offset >> spcringd1=81.0;// outside of ring, id of surround band >> spcringd2=66.5;// inside of spacer ring, press fit on spline od >> wrapperh=18.5;//surround band height. >> //globals for keys >> t1=spcringd1; >> t2=spcringd2+.3; >> y=spcringh+.05; >> z1=4.3;// key sizes, will need tweaked to fit well, probably by .2 + & - >> z2=3.7; >> z3=2.3; >> z4=1.7; >> // globals for output timing pulley >> toothType=1; >> toothWidth = 1.14; // Teeth of PULLEY, that is. Larger=tighter fit of >> teeth. >> ========= >> this module: >> ========= >> module outspline50() // mode must be 7 >> { >> aa=42.0000; // was 69.00000000 a blond one too big >> xx=5.7;//thickness >> dd1=59.25; >> dd0=66.7; // outer a bit snug in output cup, reduced from 67.75 >> toothrad50=29; // getting close, but not global >> st = ([ 360.00000000 / 50.00000000 ]); // arc of circle per tooth, >> works but... >> // for 50 st=7.2 but whole "for" has disappeared >> echo ("336", aa, xx, dd0, dd1, st,toothrad50) ; // echo? yes, once >> union() >> { >> difference() >> { // the outside smoother >> cylinder(d=dd0, h=xx, $fn=360); //outer is fussy >> translate([0,0,-.005]) cylinder(d=dd1, h=xx+.01, $fn=360); >> //but the inner isn't >> } // end of that difference >> // use this to add 50 inner splines >> echo(346,st); >> // for (i = [start:step:end]) { … } pasted from the cheat sheet >> for (i = [0:st:359]) // enabling this line kills it all >> // comment it and I get one spline whereever I set i >> { >> rotate([0,0,i]) // place around circle >> translate([toothrad50,0,0]) >> // move x only >> scale(v= [.1,.1,1]) //scale it to size >> rotate(180)// switch rotate on for outers and readjust sizes >> cylinder(d=aa, h=xx, $fn=3); // make big thick triangle >> } >> } >> }; >> ======= >> >> No doubt something gnubie stupid but what? >> >> Thanks all. >> >> Cheers, Gene Heskett >> -- >> "There are four boxes to be used in defense of liberty: >> soap, ballot, jury, and ammo. Please use in that order." >> -Ed Howdershelt (Author) >> If we desire respect for the law, we must first make the law respectable. >> - Louis D. Brandeis >> Genes Web page <http://geneslinuxbox.net:6309/gene> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
FH
Father Horton
Thu, Sep 2, 2021 12:24 PM

Especially in for loops, never use floating point where integers will do.
If necessary, convert the index to floating point inside the loop.

On Thu, Sep 2, 2021 at 7:19 AM Ronaldo Persiano rcmpersiano@gmail.com
wrote:

I would expect a runtime error by using anything except numbers in a for
range.

Em qui., 2 de set. de 2021 às 13:10, nop head nop.head@gmail.com
escreveu:

st = ([ 360.00000000 / 50.00000000 ]);

That makes st a one element vector, which probably breaks the for loop.
Why all the brackets and decimal points? Why not 360/50?

On Thu, 2 Sept 2021 at 13:02, Gene Heskett gheskett@shentel.net wrote:

Taking some measurements and finding I need more clearance above this
thing, I have embarqued on a process to
shrinks its diameter about 5mm.

However this is going to make the splines smaller and hsrder to print
at a 30/1 ratio. So I'm tryting to shrink the gear ratio too, to 25/1.
Which will expand the splines enough to maintain printability as long
as the flexibility needed doesn't break the innerspline part.

But the for loop that positions the splines around a circle, has turned
it all into a toothless no-op.

The code...
var declarations at top of file:

IDofspl=67.05;
splsocht=6.00;
ODofCup=IDofspl+splsocht*2.5;
sink=.745;// jack up bolt head countersink to top of 3.1 mm thick disk
sht=1.513;// height of countersink+noise in preview fudge
$fn=360;// make circles with 1 degree flats
reghole=38.3;// motor registration hole + printer undersize fudge, exact!
nemahole=47.2/2; // one side of square pattern, 47.1 is official target,
ddht=3.1;//input panel with nema 23 bolt pattern
ddia=5.1;//5mm bolt clearance
spcringh=6.0;//could be 6.3
spcringh1=6.0;//vertical offset
spcringd1=81.0;// outside of ring, id of surround band
spcringd2=66.5;// inside of spacer ring, press fit on spline od
wrapperh=18.5;//surround band height.
//globals for keys
t1=spcringd1;
t2=spcringd2+.3;
y=spcringh+.05;
z1=4.3;// key sizes, will need tweaked to fit well, probably by .2 + & -
z2=3.7;
z3=2.3;
z4=1.7;
// globals for output timing pulley
toothType=1;
toothWidth = 1.14; // Teeth of PULLEY, that is. Larger=tighter fit of
teeth.

this module:

module outspline50() // mode must be 7
{
aa=42.0000; // was 69.00000000 a blond one too big
xx=5.7;//thickness
dd1=59.25;
dd0=66.7; // outer a bit snug in output cup, reduced from 67.75
toothrad50=29; // getting close, but not global
st = ([ 360.00000000 / 50.00000000 ]); // arc of circle per tooth,
works but...
// for 50 st=7.2 but whole "for" has disappeared
echo ("336", aa, xx, dd0, dd1, st,toothrad50) ;  // echo? yes, once
union()
{
difference()
{ // the outside smoother
cylinder(d=dd0, h=xx, $fn=360); //outer is fussy
translate([0,0,-.005]) cylinder(d=dd1, h=xx+.01, $fn=360);
//but the inner isn't
} // end of that difference
// use this to add 50 inner splines
echo(346,st);
// for (i = [start:step:end]) { … } pasted from the cheat sheet
for (i = [0:st:359]) // enabling this line kills it all
// comment it and I get one spline whereever I set i
{
rotate([0,0,i]) // place around circle
translate([toothrad50,0,0])
// move x only
scale(v= [.1,.1,1]) //scale it to size
rotate(180)// switch rotate on for outers and readjust sizes
cylinder(d=aa, h=xx, $fn=3); // make big thick triangle
}
}
};

No doubt something gnubie stupid but what?

Thanks all.

Cheers, Gene Heskett

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Especially in for loops, never use floating point where integers will do. If necessary, convert the index to floating point inside the loop. On Thu, Sep 2, 2021 at 7:19 AM Ronaldo Persiano <rcmpersiano@gmail.com> wrote: > I would expect a runtime error by using anything except numbers in a for > range. > > Em qui., 2 de set. de 2021 às 13:10, nop head <nop.head@gmail.com> > escreveu: > >> st = ([ 360.00000000 / 50.00000000 ]); >> >> That makes st a one element vector, which probably breaks the for loop. >> Why all the brackets and decimal points? Why not 360/50? >> > >> On Thu, 2 Sept 2021 at 13:02, Gene Heskett <gheskett@shentel.net> wrote: >> >>> Taking some measurements and finding I need more clearance above this >>> thing, I have embarqued on a process to >>> shrinks its diameter about 5mm. >>> >>> However this is going to make the splines smaller and hsrder to print >>> at a 30/1 ratio. So I'm tryting to shrink the gear ratio too, to 25/1. >>> Which will expand the splines enough to maintain printability as long >>> as the flexibility needed doesn't break the innerspline part. >>> >>> But the for loop that positions the splines around a circle, has turned >>> it all into a toothless no-op. >>> >>> The code... >>> var declarations at top of file: >>> ========== >>> IDofspl=67.05; >>> splsocht=6.00; >>> ODofCup=IDofspl+splsocht*2.5; >>> sink=.745;// jack up bolt head countersink to top of 3.1 mm thick disk >>> sht=1.513;// height of countersink+noise in preview fudge >>> $fn=360;// make circles with 1 degree flats >>> reghole=38.3;// motor registration hole + printer undersize fudge, exact! >>> nemahole=47.2/2; // one side of square pattern, 47.1 is official target, >>> ddht=3.1;//input panel with nema 23 bolt pattern >>> ddia=5.1;//5mm bolt clearance >>> spcringh=6.0;//could be 6.3 >>> spcringh1=6.0;//vertical offset >>> spcringd1=81.0;// outside of ring, id of surround band >>> spcringd2=66.5;// inside of spacer ring, press fit on spline od >>> wrapperh=18.5;//surround band height. >>> //globals for keys >>> t1=spcringd1; >>> t2=spcringd2+.3; >>> y=spcringh+.05; >>> z1=4.3;// key sizes, will need tweaked to fit well, probably by .2 + & - >>> z2=3.7; >>> z3=2.3; >>> z4=1.7; >>> // globals for output timing pulley >>> toothType=1; >>> toothWidth = 1.14; // Teeth of PULLEY, that is. Larger=tighter fit of >>> teeth. >>> ========= >>> this module: >>> ========= >>> module outspline50() // mode must be 7 >>> { >>> aa=42.0000; // was 69.00000000 a blond one too big >>> xx=5.7;//thickness >>> dd1=59.25; >>> dd0=66.7; // outer a bit snug in output cup, reduced from 67.75 >>> toothrad50=29; // getting close, but not global >>> st = ([ 360.00000000 / 50.00000000 ]); // arc of circle per tooth, >>> works but... >>> // for 50 st=7.2 but whole "for" has disappeared >>> echo ("336", aa, xx, dd0, dd1, st,toothrad50) ; // echo? yes, once >>> union() >>> { >>> difference() >>> { // the outside smoother >>> cylinder(d=dd0, h=xx, $fn=360); //outer is fussy >>> translate([0,0,-.005]) cylinder(d=dd1, h=xx+.01, $fn=360); >>> //but the inner isn't >>> } // end of that difference >>> // use this to add 50 inner splines >>> echo(346,st); >>> // for (i = [start:step:end]) { … } pasted from the cheat sheet >>> for (i = [0:st:359]) // enabling this line kills it all >>> // comment it and I get one spline whereever I set i >>> { >>> rotate([0,0,i]) // place around circle >>> translate([toothrad50,0,0]) >>> // move x only >>> scale(v= [.1,.1,1]) //scale it to size >>> rotate(180)// switch rotate on for outers and readjust sizes >>> cylinder(d=aa, h=xx, $fn=3); // make big thick triangle >>> } >>> } >>> }; >>> ======= >>> >>> No doubt something gnubie stupid but what? >>> >>> Thanks all. >>> >>> Cheers, Gene Heskett >>> -- >>> "There are four boxes to be used in defense of liberty: >>> soap, ballot, jury, and ammo. Please use in that order." >>> -Ed Howdershelt (Author) >>> If we desire respect for the law, we must first make the law respectable. >>> - Louis D. Brandeis >>> Genes Web page <http://geneslinuxbox.net:6309/gene> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
NH
nop head
Thu, Sep 2, 2021 12:32 PM

I would expect an error, especially now OpenSCAD has got annoying with its
errors, but this just fails silently.

for(i = [0 : [1] : 10]) echo(i);

On Thu, 2 Sept 2021 at 13:25, Father Horton fatherhorton@gmail.com wrote:

Especially in for loops, never use floating point where integers will do.
If necessary, convert the index to floating point inside the loop.

On Thu, Sep 2, 2021 at 7:19 AM Ronaldo Persiano rcmpersiano@gmail.com
wrote:

I would expect a runtime error by using anything except numbers in a for
range.

Em qui., 2 de set. de 2021 às 13:10, nop head nop.head@gmail.com
escreveu:

st = ([ 360.00000000 / 50.00000000 ]);

That makes st a one element vector, which probably breaks the for loop.
Why all the brackets and decimal points? Why not 360/50?

On Thu, 2 Sept 2021 at 13:02, Gene Heskett gheskett@shentel.net wrote:

Taking some measurements and finding I need more clearance above this
thing, I have embarqued on a process to
shrinks its diameter about 5mm.

However this is going to make the splines smaller and hsrder to print
at a 30/1 ratio. So I'm tryting to shrink the gear ratio too, to 25/1.
Which will expand the splines enough to maintain printability as long
as the flexibility needed doesn't break the innerspline part.

But the for loop that positions the splines around a circle, has turned
it all into a toothless no-op.

The code...
var declarations at top of file:

IDofspl=67.05;
splsocht=6.00;
ODofCup=IDofspl+splsocht*2.5;
sink=.745;// jack up bolt head countersink to top of 3.1 mm thick disk
sht=1.513;// height of countersink+noise in preview fudge
$fn=360;// make circles with 1 degree flats
reghole=38.3;// motor registration hole + printer undersize fudge,
exact!
nemahole=47.2/2; // one side of square pattern, 47.1 is official
target,
ddht=3.1;//input panel with nema 23 bolt pattern
ddia=5.1;//5mm bolt clearance
spcringh=6.0;//could be 6.3
spcringh1=6.0;//vertical offset
spcringd1=81.0;// outside of ring, id of surround band
spcringd2=66.5;// inside of spacer ring, press fit on spline od
wrapperh=18.5;//surround band height.
//globals for keys
t1=spcringd1;
t2=spcringd2+.3;
y=spcringh+.05;
z1=4.3;// key sizes, will need tweaked to fit well, probably by .2 + & -
z2=3.7;
z3=2.3;
z4=1.7;
// globals for output timing pulley
toothType=1;
toothWidth = 1.14; // Teeth of PULLEY, that is. Larger=tighter fit of
teeth.

this module:

module outspline50() // mode must be 7
{
aa=42.0000; // was 69.00000000 a blond one too big
xx=5.7;//thickness
dd1=59.25;
dd0=66.7; // outer a bit snug in output cup, reduced from 67.75
toothrad50=29; // getting close, but not global
st = ([ 360.00000000 / 50.00000000 ]); // arc of circle per tooth,
works but...
// for 50 st=7.2 but whole "for" has disappeared
echo ("336", aa, xx, dd0, dd1, st,toothrad50) ;  // echo? yes, once
union()
{
difference()
{ // the outside smoother
cylinder(d=dd0, h=xx, $fn=360); //outer is fussy
translate([0,0,-.005]) cylinder(d=dd1, h=xx+.01, $fn=360);
//but the inner isn't
} // end of that difference
// use this to add 50 inner splines
echo(346,st);
// for (i = [start:step:end]) { … } pasted from the cheat sheet
for (i = [0:st:359]) // enabling this line kills it all
// comment it and I get one spline whereever I set i
{
rotate([0,0,i]) // place around circle
translate([toothrad50,0,0])
// move x only
scale(v= [.1,.1,1]) //scale it to size
rotate(180)// switch rotate on for outers and readjust sizes
cylinder(d=aa, h=xx, $fn=3); // make big thick triangle
}
}
};

No doubt something gnubie stupid but what?

Thanks all.

Cheers, Gene Heskett

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law
respectable.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I would expect an error, especially now OpenSCAD has got annoying with its errors, but this just fails silently. for(i = [0 : [1] : 10]) echo(i); On Thu, 2 Sept 2021 at 13:25, Father Horton <fatherhorton@gmail.com> wrote: > Especially in for loops, never use floating point where integers will do. > If necessary, convert the index to floating point inside the loop. > > On Thu, Sep 2, 2021 at 7:19 AM Ronaldo Persiano <rcmpersiano@gmail.com> > wrote: > >> I would expect a runtime error by using anything except numbers in a for >> range. >> >> Em qui., 2 de set. de 2021 às 13:10, nop head <nop.head@gmail.com> >> escreveu: >> >>> st = ([ 360.00000000 / 50.00000000 ]); >>> >>> That makes st a one element vector, which probably breaks the for loop. >>> Why all the brackets and decimal points? Why not 360/50? >>> >> >>> On Thu, 2 Sept 2021 at 13:02, Gene Heskett <gheskett@shentel.net> wrote: >>> >>>> Taking some measurements and finding I need more clearance above this >>>> thing, I have embarqued on a process to >>>> shrinks its diameter about 5mm. >>>> >>>> However this is going to make the splines smaller and hsrder to print >>>> at a 30/1 ratio. So I'm tryting to shrink the gear ratio too, to 25/1. >>>> Which will expand the splines enough to maintain printability as long >>>> as the flexibility needed doesn't break the innerspline part. >>>> >>>> But the for loop that positions the splines around a circle, has turned >>>> it all into a toothless no-op. >>>> >>>> The code... >>>> var declarations at top of file: >>>> ========== >>>> IDofspl=67.05; >>>> splsocht=6.00; >>>> ODofCup=IDofspl+splsocht*2.5; >>>> sink=.745;// jack up bolt head countersink to top of 3.1 mm thick disk >>>> sht=1.513;// height of countersink+noise in preview fudge >>>> $fn=360;// make circles with 1 degree flats >>>> reghole=38.3;// motor registration hole + printer undersize fudge, >>>> exact! >>>> nemahole=47.2/2; // one side of square pattern, 47.1 is official >>>> target, >>>> ddht=3.1;//input panel with nema 23 bolt pattern >>>> ddia=5.1;//5mm bolt clearance >>>> spcringh=6.0;//could be 6.3 >>>> spcringh1=6.0;//vertical offset >>>> spcringd1=81.0;// outside of ring, id of surround band >>>> spcringd2=66.5;// inside of spacer ring, press fit on spline od >>>> wrapperh=18.5;//surround band height. >>>> //globals for keys >>>> t1=spcringd1; >>>> t2=spcringd2+.3; >>>> y=spcringh+.05; >>>> z1=4.3;// key sizes, will need tweaked to fit well, probably by .2 + & - >>>> z2=3.7; >>>> z3=2.3; >>>> z4=1.7; >>>> // globals for output timing pulley >>>> toothType=1; >>>> toothWidth = 1.14; // Teeth of PULLEY, that is. Larger=tighter fit of >>>> teeth. >>>> ========= >>>> this module: >>>> ========= >>>> module outspline50() // mode must be 7 >>>> { >>>> aa=42.0000; // was 69.00000000 a blond one too big >>>> xx=5.7;//thickness >>>> dd1=59.25; >>>> dd0=66.7; // outer a bit snug in output cup, reduced from 67.75 >>>> toothrad50=29; // getting close, but not global >>>> st = ([ 360.00000000 / 50.00000000 ]); // arc of circle per tooth, >>>> works but... >>>> // for 50 st=7.2 but whole "for" has disappeared >>>> echo ("336", aa, xx, dd0, dd1, st,toothrad50) ; // echo? yes, once >>>> union() >>>> { >>>> difference() >>>> { // the outside smoother >>>> cylinder(d=dd0, h=xx, $fn=360); //outer is fussy >>>> translate([0,0,-.005]) cylinder(d=dd1, h=xx+.01, $fn=360); >>>> //but the inner isn't >>>> } // end of that difference >>>> // use this to add 50 inner splines >>>> echo(346,st); >>>> // for (i = [start:step:end]) { … } pasted from the cheat sheet >>>> for (i = [0:st:359]) // enabling this line kills it all >>>> // comment it and I get one spline whereever I set i >>>> { >>>> rotate([0,0,i]) // place around circle >>>> translate([toothrad50,0,0]) >>>> // move x only >>>> scale(v= [.1,.1,1]) //scale it to size >>>> rotate(180)// switch rotate on for outers and readjust sizes >>>> cylinder(d=aa, h=xx, $fn=3); // make big thick triangle >>>> } >>>> } >>>> }; >>>> ======= >>>> >>>> No doubt something gnubie stupid but what? >>>> >>>> Thanks all. >>>> >>>> Cheers, Gene Heskett >>>> -- >>>> "There are four boxes to be used in defense of liberty: >>>> soap, ballot, jury, and ammo. Please use in that order." >>>> -Ed Howdershelt (Author) >>>> If we desire respect for the law, we must first make the law >>>> respectable. >>>> - Louis D. Brandeis >>>> Genes Web page <http://geneslinuxbox.net:6309/gene> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
GH
Gene Heskett
Thu, Sep 2, 2021 12:48 PM

On Thursday 02 September 2021 08:07:23 nop head wrote:

st = ([ 360.00000000 / 50.00000000 ]);

That makes st a one element vector, which probably breaks the for
loop. Why all the brackets and decimal points? Why not 360/50?

It echos as a 7.2 degree result for either syntax, but that was in fact
the magic twanger and it now works as expected/desired.  Thank you nop
head.

Cheers, Gene Heskett

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.

On Thursday 02 September 2021 08:07:23 nop head wrote: > st = ([ 360.00000000 / 50.00000000 ]); > > That makes st a one element vector, which probably breaks the for > loop. Why all the brackets and decimal points? Why not 360/50? > It echos as a 7.2 degree result for either syntax, but that was in fact the magic twanger and it now works as expected/desired. Thank you nop head. Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/gene>
NH
nop head
Thu, Sep 2, 2021 12:53 PM

It should echo [7.2], which is subtly different from 7.2.

On Thu, 2 Sept 2021 at 13:48, Gene Heskett gheskett@shentel.net wrote:

On Thursday 02 September 2021 08:07:23 nop head wrote:

st = ([ 360.00000000 / 50.00000000 ]);

That makes st a one element vector, which probably breaks the for
loop. Why all the brackets and decimal points? Why not 360/50?

It echos as a 7.2 degree result for either syntax, but that was in fact
the magic twanger and it now works as expected/desired.  Thank you nop
head.

Cheers, Gene Heskett

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

It should echo [7.2], which is subtly different from 7.2. On Thu, 2 Sept 2021 at 13:48, Gene Heskett <gheskett@shentel.net> wrote: > On Thursday 02 September 2021 08:07:23 nop head wrote: > > > st = ([ 360.00000000 / 50.00000000 ]); > > > > That makes st a one element vector, which probably breaks the for > > loop. Why all the brackets and decimal points? Why not 360/50? > > > It echos as a 7.2 degree result for either syntax, but that was in fact > the magic twanger and it now works as expected/desired. Thank you nop > head. > > Cheers, Gene Heskett > -- > "There are four boxes to be used in defense of liberty: > soap, ballot, jury, and ammo. Please use in that order." > -Ed Howdershelt (Author) > If we desire respect for the law, we must first make the law respectable. > - Louis D. Brandeis > Genes Web page <http://geneslinuxbox.net:6309/gene> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
GH
Gene Heskett
Thu, Sep 2, 2021 12:56 PM

On Thursday 02 September 2021 08:32:14 nop head wrote:

I would expect an error, especially now OpenSCAD has got annoying with
its errors, but this just fails silently.

for(i = [0 : [1] : 10]) echo(i);

That it did. Absolutely silently. zero warnings, zero errors, total failure of everything inside the {} loop. If that was an error, it should be reported as such.  It is the i that failed in the rest of that {} stanza.

[...]

Cheers, Gene Heskett

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.

On Thursday 02 September 2021 08:32:14 nop head wrote: > I would expect an error, especially now OpenSCAD has got annoying with > its errors, but this just fails silently. > > for(i = [0 : [1] : 10]) echo(i); > That it did. Absolutely silently. zero warnings, zero errors, total failure of everything inside the {} loop. If that was an error, it should be reported as such. It is the i that failed in the rest of that {} stanza. [...] Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/gene>
GH
Gene Heskett
Thu, Sep 2, 2021 2:23 PM

On Thursday 02 September 2021 08:53:05 nop head wrote:

It should echo [7.2], which is subtly different from 7.2.

Now that you mention it, that it did. echo'd as [7.2], I had noted that,
but the penny never dropped. It should have, can I blame it on
oldtimers?  Thanks nop head.

Cheers, Gene Heskett

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.

On Thursday 02 September 2021 08:53:05 nop head wrote: > It should echo [7.2], which is subtly different from 7.2. > Now that you mention it, that it did. echo'd as [7.2], I had noted that, but the penny never dropped. It should have, can I blame it on oldtimers? Thanks nop head. Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/gene>