POV-Ray : Newsgroups : povray.newusers : reading from a text file : Re: reading from a text file Server Time
29 Jul 2024 10:25:05 EDT (-0400)
  Re: reading from a text file  
From: Alain
Date: 25 Jan 2006 17:56:35
Message: <43d80223$1@news.povray.org>
shimon_a10 nous apporta ses lumieres en ce 25/01/2006 10:18:
> Mike Williams <nos### [at] econymdemoncouk> wrote:
> 
>>Wasn't it shimon_a10 who wrote:
>>
>>
>>1. I can't imagine what defined() has to do with any of this.
>>
>>2. POV's #read command doesn't see the file as a series of lines, it
>>sees it as a series of fields separated by commas. If you don't have
>>commas between each of your fields it will miss them.
>>
>>3. That's no good. It doesn't have any commas.
>>
>>4. Only if the data file contains the fields in vector format, like this
>>        <-0.5,0,-0.5>,
>>        <0,0,0>,
>>        <0.2,0,0.2>,
>>        <1,1,1>
>>Note that the commas after each vector are required. The line breaks are
>>not required, sot you can write it like this if you prefer.
>>        <-0.5,0,-0.5>,<0,0,0>,<0.2,0,0.2>,<1,1,1>
>>
>>POV doesn't know in advance what sort of field it is expected to try to
>>read. If is sees a vector it reads a vector. If it sees a number it
>>reads a number. If it sees a quoted string it reads a string. It doesn't
>>matter if the variable already contains a different type of object.
>>
>>5. You can give the file any extension you like, but it has to contain
>>ASCII text in the specified format.
>>
>>6. You're welcome
>>--
>>Mike Williams
>>Gentleman of Leisure
> 
> 
> Hi to Mike Williams , and thank u!
> 
> 1. How can i put commas to very long text file for separting the float
>    numbers.
> 2. thanks again.
> 
> Shimon
> 
> 
> 
> 
Search & replace in a text editor, NOT a word processor. Launch a search for <space>
and replace 
with a comma.
You may end up with strings of commas, if you have formating spaces, in that case, do
a new search & 
replace for ",," to "," and repeate until you no longer have strings of commas.

-- 
Alain
-------------------------------------------------
Agnostic: Shit might have happened; then again, maybe not.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.