|
|
"Tungsten" <nomail@nomail> wrote in message
news:web.484cf2d470f619f3f495ce020@news.povray.org...
> How can I declare a variable inside a loop while the name which I declare
> depends on a counter?
>
> I'd like to generate 100 clock variables (clockX1 to clockX100). To do
> this, I
> hoped to use something like
> #declare concat("clockX",str(SomeCounter))=...
> How can I tell POVRay to use the actual value of a variable/function
> instead of
> the variable name?
> In other words not to assign
> #declare Mystring=...
> but to declare a new variable named by the value of Mystring.
> I guess it's a simple thing (like using the $variable in IGOR) but I
> couldn't
> find it in the help/support.
>
Sounds to me like you would be better off using arrays:
#declare ClockX = array[100];
#declare SomeCounter = 0;
#while (SomeCounter <100)
....
#declare ClockX[SomeCounter] = ... ;
#declare SomeCounter = SomeCounter + 1;
#end
The only way that I know of doing precisely what you asked for is to create
a string using the concat function that you write out to a file, then
#include the file on the following line so that it gets parsed. I think
there is a function somewhere to do this for you, but it obviously
introduces additional disk IO that can slow your render down.
Regards,
Chris B.
Post a reply to this message
|
|