POV-Ray : Newsgroups : povray.general : Syntax for reading a large file of numbers. : Re: Syntax for reading a large file of numbers. Server Time
31 Jul 2024 10:25:05 EDT (-0400)
  Re: Syntax for reading a large file of numbers.  
From: Alain
Date: 18 May 2007 17:24:17
Message: <464e1981$1@news.povray.org>
gregjohn nous apporta ses lumieres en ce 18 / 05 / 2007 16:21:
> I've got a large ASCII txt file.  Every row is an integer. I have forgotten
> how to get povray to read the file so that povray can use them as declared
> variables.
> 
> I know I could go in and edit the file and have it say something like
> #declare My_Array[1000]={item,item...}.  If I were to do that I could
> simply #include the file.   But I have an application where I would be
> doing a bunch of them and would like to avoid editing every single one of
> them.
> 
> thanks.
> 
> 
> 
> 
> 
You can do this:
#declare My_Array[1000]={#include "Your_text_file.txt"}

It's safer to generate your file as a comma separated list, that way, a negative 
value wont get substracted from the preceding one. If your file is not comma 
separated, a search and replace can be done where you replace "/n" by ",".

-- 
Alain
-------------------------------------------------
You know you've been raytracing too long when your personal correspondence to 
friends starts out with #Dear Linda =
Ken Tyler


Post a reply to this message

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