[OpenSCAD] Incrementing a variable doesn't work as expected.

nigeljohnson73 nigel at nigeljohnson.net
Wed Apr 1 03:44:39 EDT 2015


For info, here is my recursive position counter that fails:

function cpos(s, n) = cpos(s,n-1) + (n == -1) ? (0) : ( (s[n]==".") ? 2 :
4);

when I use it instead of pos in the x coordinate for example in the dit:

translate([cpos(s,i)+lu/2,0,0]) cylinder(r=lu/2, h = (id+wt+2)/2);

it says recursion detected. It's not lying  but the manual says I can do
recursion with the trigraph stuff.





--
View this message in context: http://forum.openscad.org/Incrementing-a-variable-doesn-t-work-as-expected-tp12271p12272.html
Sent from the OpenSCAD mailing list archive at Nabble.com.




More information about the Discuss mailing list