|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I want to make my own graph-plotting routine in povray using some CSV files that
are frequently generated at work.
I know how to do this if I were to go to the trouble of editing the file and
inserting #declare's and {'s into the text. I don't want to do this on a
regular basis, and might like to share the pov with folks who aren't as
pov-savvy right now.
Any tips on how to get the data into povray from a typical standard CSV?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Wed, 20 May 2009 21:47:20 -0400, gregjohn wrote:
> I know how to do this if I were to go to the trouble of editing the file
> and inserting #declare's and {'s into the text. I don't want to do this
> on a regular basis, and might like to share the pov with folks who
> aren't as pov-savvy right now.
If it's just a question of inserting some stuff into the text, have a
look at using something like awk or perl to process the CSV data to
generate the POV stuff.
Jim
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it gregjohn who wrote:
>I want to make my own graph-plotting routine in povray using some CSV
>files that
>are frequently generated at work.
>
>I know how to do this if I were to go to the trouble of editing the file and
>inserting #declare's and {'s into the text. I don't want to do this on a
>regular basis, and might like to share the pov with folks who aren't as
>pov-savvy right now.
>
>Any tips on how to get the data into povray from a typical standard CSV?
The significant difference between standard CSV format and the file
format that can be read by POV with #read is that POV doesn't consider a
line break to be a field separator. So you need to add a comma at the
end of every line.
Another problem is that CSV files can contain commas within quoted
strings. I suspect that #fread may treat those as field separators. I
imagine that working round that might be quite messy if your data
contains commas. (I was going to check how #fread handles commas inside
quoted strings, but my copy of POV seems to have suddenly died).
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"gregjohn" <pte### [at] yahoocom> wrote:
> Any tips on how to get the data into povray from a typical standard CSV?
#read should be able to do the job, if the file is nice straightforward CSV.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka wrote:
> "gregjohn" <pte### [at] yahoocom> wrote:
>> Any tips on how to get the data into povray from a typical standard CSV?
>
> #read should be able to do the job, if the file is nice straightforward CSV.
Except if the file contains unquoted strings. #read seems to require
quotes even if no delimiter occurs in the text. Stumbled across that one
with an astronomical database which included the object designation in
the CSV output.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"clipka" <nomail@nomail> wrote:
> "gregjohn" <pte### [at] yahoocom> wrote:
> > Any tips on how to get the data into povray from a typical standard CSV?
>
> #read should be able to do the job, if the file is nice straightforward CSV.
Really? Suppose it's a list like this, how could you actually get these data
"into" povray?
1 , -2 , -8.4715E-05 , 57983.2925
2 , -1.98 , -8.5116E-05 , 56354.0494
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
gregjohn wrote:
> Really? Suppose it's a list like this, how could you actually get these data
> "into" povray?
>
> 1 , -2 , -8.4715E-05 , 57983.2925
> 2 , -1.98 , -8.5116E-05 , 56354.0494
#fopen CSV_FILE "file.csv" read
// For each line you wish to read:
#read(CSV_FILE, INDEX, V1, V2, V3)
// Do something with the data
Instead of simple variables, you can also use arrays,
but then you need to create the array in advance. This
requires two passes if you don't know the number of
elements in advance.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it gregjohn who wrote:
>"clipka" <nomail@nomail> wrote:
>> "gregjohn" <pte### [at] yahoocom> wrote:
>> > Any tips on how to get the data into povray from a typical standard CSV?
>>
>> #read should be able to do the job, if the file is nice straightforward CSV.
>
>
>Really? Suppose it's a list like this, how could you actually get these data
>"into" povray?
>
>
>1 , -2 , -8.4715E-05 , 57983.2925
>2 , -1.98 , -8.5116E-05 , 56354.0494
As mentioned upthread, in order to be read by POVRay the data needs to
be preprocessed to change it to
1 , -2 , -8.4715E-05 , 57983.2925 ,
2 , -1.98 , -8.5116E-05 , 56354.0494 ,
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Mike Williams wrote:
> Wasn't it gregjohn who wrote:
>> I want to make my own graph-plotting routine in povray using some CSV
>> files that
>> are frequently generated at work.
>>
>> I know how to do this if I were to go to the trouble of editing the
>> file and
>> inserting #declare's and {'s into the text. I don't want to do this o
n a
>> regular basis, and might like to share the pov with folks who aren't a
s
>> pov-savvy right now.
>>
>> Any tips on how to get the data into povray from a typical standard CS
V?
>
> The significant difference between standard CSV format and the file
> format that can be read by POV with #read is that POV doesn't consider
a
> line break to be a field separator. So you need to add a comma at the
> end of every line.
>
> Another problem is that CSV files can contain commas within quoted
> strings. I suspect that #fread may treat those as field separators. I
> imagine that working round that might be quite messy if your data
> contains commas. (I was going to check how #fread handles commas inside
> quoted strings, but my copy of POV seems to have suddenly died).
>
And finally, depending on your os language settings and the
software you use to create the CSV, the format may change
completely. For example in France, Excel creates CSV where the
separator is the semicolon and the coma is used as a decimal point...
Jerome
--
mailto:jeb### [at] freefr
http://jeberger.free.fr
Jabber: jeb### [at] jabberfr
Post a reply to this message
Attachments:
Download 'us-ascii' (1 KB)
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Mike Williams wrote:
> As mentioned upthread, in order to be read by POVRay the data needs to
> be preprocessed to change it to
>
> 1 , -2 , -8.4715E-05 , 57983.2925 ,
> 2 , -1.98 , -8.5116E-05 , 56354.0494 ,
I didn't find that necessary when reading in the galaxy positions
for my recent "Local Neighborhood" image. I used one #read per line.
The file had unix line endings, although that shouldn't matter.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |