POV-Ray : Newsgroups : povray.animations : How to animate ??????????????? : Re: How to animate ??????????????? Server Time
2 Jun 2024 11:38:10 EDT (-0400)
  Re: How to animate ???????????????  
From: Dave VanHorn
Date: 20 Feb 2008 17:10:01
Message: <web.47bca42d86d65c51a08ed15e0@news.povray.org>
> If this is what the file looks like it looks like, you're missing commas at
> the end of each line.

Is there any way to make it work without that?
My data files are >1000 lines, manually fixing it would be awful.


> If the whole file is XYZ coordinates you might want to code it up as vectors
> (depending upon what you want to do with them). e.g:
> <0.128236817,0.17343048,1.06941009>,
> <-0.109255917,-0.005383651,0.765301253>,
> <0.059836132,0.172405022,0.976029181> ,

I don't have any way to make the data come to me in this format.

Maybe a different way to use the #read?

Here's the current version:
//Find how many lines in the file
#fopen MyFile "drop13.csv" read

#while (defined(MyFile))
  #read (MyFile,Xval,Yval,Zval)
  #debug concat("Just read line ", str(Lines_In_File,1,0), "\n")

  #declare  EX=str(Xval,12,9);
  #declare  WY=str(Yval,12,9);
  #declare Zee=str(Zval,12,9);

  #debug concat(EX," ",WY," ",Zee,"\n")

  #declare Lines_In_File=Lines_In_File+1 ;
#end

#fclose MyFile


// Having Lines_In_File now holding the lines count

#declare Count=0;

/*
#declare Read_Line = 1; //int((1/Lines_In_File)*Clock);
#fopen MyFile "drop13.csv" read
#while (defined(MyFile))
 #while (Count<Read_Line)
  #read (MyFile,Xstr,Ystr,Zstr)
  #declare Count=Count+1;
 #end
#end
#fclose MyFile


Here's the debug output:

  Bounding boxes.......On   Bounding threshold: 3
  Light Buffer.........On
  Vista Buffer.........On   Draw Vista Buffer....Off
  Antialiasing.........On  (Method 1, Threshold 0.300, Depth 3, Jitter 1.00)
  Clock value:    0.000  (Animation off)
Just read line 1
 0.128236817  0.173430480  1.069410090
Just read line 2
 0.109255917 -0.005383651  0.765301253
File: drop13.csv  Line: 3
File Context (5 lines):
0.128236817,0.17343048,1.06941009
-0.109255917,-0.005383651,0.765301253
0.059836132,
Parse Error: Expected 'float, vector, or string literal', ,  found instead
Total Scene Processing Times
  Parse Time:    0 hours  0 minutes  0 seconds (0 seconds)
  Photon Time:   0 hours  0 minutes  0 seconds (0 seconds)
  Render Time:   0 hours  0 minutes  0 seconds (0 seconds)
  Total Time:    0 hours  0 minutes  0 seconds (0 seconds)
CPU time used: kernel 0.02 seconds, user 0.05 seconds, total 0.06 seconds

POV-Ray finished


Post a reply to this message

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