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

Peter Falke stempeldergeschichte at googlemail.com
Wed Apr 1 04:54:47 EDT 2015


You can not reassign variables. Variables in OpenSCAD are constants.
Please have a look at the manual:
http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Variables

2015-04-01 10:50 GMT+02:00 Peter Falke <stempeldergeschichte at googlemail.com>
:

> Are ypu using a current version of OpenSCAD? The latest?
>
>
> 2015-04-01 9:44 GMT+02:00 nigeljohnson73 <nigel at nigeljohnson.net>:
>
>> 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.
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> Discuss at lists.openscad.org
>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>
>
>
>
> --
> stempeldergeschichte at googlemail.com <karsten at rohrbach.de>
>
> P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
> Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu
> schreiben.
> Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.
>
> P.S. In case my e-mail is shorter than you enjoy:
> I am currently trying short replies instead of no replies at all.
> Please let me know, if you like to read more.
>
> Enjoy!
>



-- 
stempeldergeschichte at googlemail.com <karsten at rohrbach.de>

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu
schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20150401/ccceba58/attachment-0002.html>


More information about the Discuss mailing list