|
|
I've got a file with data in it that I want povray to consider (read).
There are several lines in the file which I want povray to ignore outright.
Others have text like,
[quote]
TEXTONE TEXTTWO TEXTTHREE 0.0 34.00 27.0
[/quote]
.... where I want povray to be able to use the values of 0.0, 34.00, and 27.0 as
variables in what it does.
I could probably use a spreadsheet or text editor to re-format the file with
#declares and brackets and the like, but with great headaches. And that would
sort of ruin the whole point of my exercise.
Q: is there any way to get povray to read space-separated variables, to ignore
lines in a file it has #opened which are bad povray syntax. ?
May I do something like:
#fopen MyInput file
#read Garbage_variable
#read Garbage_variable,Garbage_variable,Garbage_variable, Useful_variable_01,
Useful_variable_02, Useful_variable_01
etc?
Post a reply to this message
|
|
|
|
The #read command can not be used to freely parse an input file. It can
only be used to read in comma-separated (in some cases space-separated
works) values which have the same format as a regular pov-file would have
(eg. something you would write at the right of a "#declare Value =").
(As a curiosity, if the input file being #read has any #-commands,
those will be parsed in the regular way until POV-Ray finds a value
which it can read.)
--
- Warp
Post a reply to this message
|
|
|
|
gregjohn nous illumina en ce 2008-05-30 12:05 -->
> I've got a file with data in it that I want povray to consider (read).
>
> There are several lines in the file which I want povray to ignore outright.
> Others have text like,
> [quote]
> TEXTONE TEXTTWO TEXTTHREE 0.0 34.00 27.0
> [/quote]
> .... where I want povray to be able to use the values of 0.0, 34.00, and 27.0 as
> variables in what it does.
>
> I could probably use a spreadsheet or text editor to re-format the file with
> #declares and brackets and the like, but with great headaches. And that would
> sort of ruin the whole point of my exercise.
>
> Q: is there any way to get povray to read space-separated variables, to ignore
> lines in a file it has #opened which are bad povray syntax. ?
>
> May I do something like:
>
> #fopen MyInput file
> #read Garbage_variable
> #read Garbage_variable,Garbage_variable,Garbage_variable, Useful_variable_01,
> Useful_variable_02, Useful_variable_01
It's:
#fopen FileHandle MyInput_File read
#read(FileHandle, Garbage_variable,Garbage_variable,Garbage_variable, Variable1,
Variable2, Variable3)
It will read 6 entries from your file, and discard the first 2.
If the numerical values represent a vector, you can enclose then in angle
brackets and they will be read as a single vector:
#fopen FileHandle MyInput_File read
#read(FileHandle, Garbage_variable,Garbage_variable,Garbage_variable, Vector_value)
>
> etc?
>
>
>
>
If all the numerical values are positive, there is no problem. If some of the
values are negative, then POV-Ray will calculate the difference between the
preceding value and the negative one unless they are separated by a comma.
It is preferable to convert your file from a space separated one to comma separated.
Please read the documentations. Search for #fopen, #read and #fclose.
--
Alain
-------------------------------------------------
Don't argue with an idiot; people watching may not be able to tell the difference.
Post a reply to this message
|
|