POV-Ray : Newsgroups : povray.general : How to read a pov file? Server Time
1 Nov 2024 05:20:59 EDT (-0400)
  How to read a pov file? (Message 1 to 8 of 8)  
From: Alf Peake
Subject: How to read a pov file?
Date: 28 Dec 2004 14:33:59
Message: <41d1b527@news.povray.org>
POV-Ray's read ignores "//" and chokes when it finds a reserved word 
so how do I read a *.pov or *.inc file without errors?

#fopen Data "ANY.pov" read
#read ( Data, In )
#debug concat("\n** ", In," **\n")
#fclose Data

Parse Error: Expected 'float, vector, or string literal', camera found 
instead.

Enclosing the whole file in quotes gets you a "String too long" 
message.

So I've got this large POV file of 7K+ balls, outputed by another 
application of the form object{ sphere,0 1 scale 1of2 texture{ 1of5 } 
translate There }. I thought it would be easy to use POV-Ray to read, 
scan and re-write to a 2nd file using 5 simple unions. I'm sure I've 
done it with my own INCs a couple of years or so ago but don't 
remember how :(

Alf


Post a reply to this message

From: Warp
Subject: Re: How to read a pov file?
Date: 29 Dec 2004 06:45:16
Message: <41d298cc@news.povray.org>
Alf Peake <alf### [at] peake42freeservecouk> wrote:
> POV-Ray's read ignores "//" and chokes when it finds a reserved word 
> so how do I read a *.pov or *.inc file without errors?

  You don't.

  #read only reads comma-separated values, nothing more.

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

From: Alf Peake
Subject: Re: How to read a pov file?
Date: 30 Dec 2004 07:02:52
Message: <41d3ee6c@news.povray.org>
"Warp" wrote:
>  You don't.
:(
>  #read only reads comma-separated values, nothing more.
Yes. Of course, I should have remembered.

OK - I've figured what I did before. The original output format was 
strict, a scene setup followed by many objects. Instead of trying to 
retrieve data, I deleted unwanted data with find and delete or replace 
using my favourite text editor - Notespad - freeware from 
http://www.bremercorp.com/

I'll post before and after stats in a few days.

Alf


Post a reply to this message

From: Alf Peake
Subject: Re: How to read a pov file?
Date: 30 Dec 2004 07:16:53
Message: <41d3f1b5$1@news.povray.org>
"Alf Peake" wrote:
> using my favourite text editor - Notespad - freeware from 
> http://www.bremercorp.com/

Hmmm... that link seems down ATM.
Try here http://www.newbie.com/NotesPad/  for V8.0

Alf


Post a reply to this message

From: Alf Peake
Subject: Re: How to read a pov file?
Date: 3 Jan 2005 15:53:38
Message: <41d9b0d2@news.povray.org>
To satisfy my own curiosity re memory requirements (and as an
excercise), this is the result of playing with a MolPov output file.

I used a text editor to Cut and Save the scene setup.
Careful use of search and replace or delete on the remainder modifies
each object as shown in <Before> and <After>, leaving a string and 3
vectors. POV-Ray then reads this file and writes/appends a union{} for
each pigment in one pass to a second *.POV file. The original scene
setup is then pasted in.

<Before>
//  Object: description ...
object
{    sphere {<0, 0, 0>, 1.0 }
      texture
     {
     pigment
      {  color Gray
      }
   }
scale < 1.65,  1.65,  1.65>
translate < 1.404333, 0, 0>
}
</Before>

<After> (a temp file)
"//  Object: description ...
",
<1.75,0.75,0.75>
,< 1.65,  1.65,  1.65>
,< 1.404333, 0, 0>
,
</After>

Before and after stats, -d
Finite objects:         7378

Original *.pov 1790KB (#included "colours.inc")
Peak memory used:           8685329 bytes
CPU time used: kernel 0.13 seconds, user 1.67 seconds, total 1.80
seconds

Modified *.pov  591KB ("colours.inc" not #included)
Peak memory used:           2577761 bytes
CPU time used: kernel 0.13 seconds, user 1.36 seconds, total 1.48
seconds

Alf


Post a reply to this message

From: Florian Brucker
Subject: Re: How to read a pov file?
Date: 4 Jan 2005 07:18:03
Message: <41da897b@news.povray.org>
> <Before>
> //  Object: description ...
> object
> {    sphere {<0, 0, 0>, 1.0 }
>       texture
>      {
>      pigment
>       {  color Gray
>       }
>    }
> scale < 1.65,  1.65,  1.65>
> translate < 1.404333, 0, 0>
> }
> </Before>

> <After> (a temp file)
> "//  Object: description ...
> ",
> <1.75,0.75,0.75>
> ,< 1.65,  1.65,  1.65>
> ,< 1.404333, 0, 0>
> ,
> </After>

If you're only interested in filtering out the vectors (and maybe 
comments) in this, then I guess it would be a one-liner in Perl. Could 
save you some work :)


HTH,
Florian
-- 
camera{look_at-y*10location<8,-3,-8>*10}#local a=0;#while(a<999)sphere{
#local _=.01*a-4.99;#local p=a*.01-5;#local c=.01*a-4.995;<sin(p*pi)*5p
*10pow(p,5)*.01>sin(c*c*c*.1)+1pigment{rgb 3}}#local a=a+1;#end
/******** http://www.torfbold.com ******** http://www.imp.org ********/


Post a reply to this message

From: Alf Peake
Subject: Re: How to read a pov file?
Date: 4 Jan 2005 07:27:39
Message: <41da8bbb$1@news.povray.org>
"Florian Brucker" wrote:
> If you're only interested in filtering out the vectors (and maybe 
> comments) in this, then I guess it would be a one-liner in Perl. 
> Could save you some work :)

Ahhh ... but its much more fun using POV-Ray ;)

Alf


Post a reply to this message

From: Florian Brucker
Subject: Re: How to read a pov file?
Date: 4 Jan 2005 08:06:52
Message: <41da94ec@news.povray.org>
> Ahhh ... but its much more fun using POV-Ray ;)

That's of course true :)


Florian
-- 
camera{look_at-y*10location<8,-3,-8>*10}#local a=0;#while(a<999)sphere{
#local _=.01*a-4.99;#local p=a*.01-5;#local c=.01*a-4.995;<sin(p*pi)*5p
*10pow(p,5)*.01>sin(c*c*c*.1)+1pigment{rgb 3}}#local a=a+1;#end
/******** http://www.torfbold.com ******** http://www.imp.org ********/


Post a reply to this message

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