POV-Ray : Newsgroups : povray.general : QUESTION: include :kolors.inc": processing this file Server Time
25 Dec 2024 20:56:27 EST (-0500)
  QUESTION: include :kolors.inc": processing this file (Message 1 to 3 of 3)  
From: Sven Littkowski
Subject: QUESTION: include :kolors.inc": processing this file
Date: 13 Sep 2013 03:10:06
Message: <5232ba4e@news.povray.org>
I have the wonderful "kolors.inc" but would like to see each of the 677
colors it contains. Each useful line begins with "#declare". Two examples:
  #declare OrangeRed            =  rgb <1.0000, 0.2800,0.0000>;
  #declare OrangeRed1           =  rgb <1.0000, 0.2695,0.0000>;


My idea is, to read each line of that file, and transform each line from
a definition to a cylinder showing the color specified in this line's
declaration.

But I don't know which scene commands I have to use, to achieve that.
Please help me. Thanks.

Sven


Post a reply to this message

From: MichaelJF
Subject: Re: QUESTION: include :kolors.inc": processing this file
Date: 13 Sep 2013 13:05:01
Message: <web.523345227de0ad6421b99a9c0@news.povray.org>
Sven Littkowski <jam### [at] yahoocom> wrote:
> I have the wonderful "kolors.inc" but would like to see each of the 677
> colors it contains. Each useful line begins with "#declare". Two examples:
>   #declare OrangeRed            =  rgb <1.0000, 0.2800,0.0000>;
>   #declare OrangeRed1           =  rgb <1.0000, 0.2695,0.0000>;
>
>
> My idea is, to read each line of that file, and transform each line from
> a definition to a cylinder showing the color specified in this line's
> declaration.
>
> But I don't know which scene commands I have to use, to achieve that.
> Please help me. Thanks.
>
> Sven

Hi to the Carribbean,

POV cannot parse files, since the read-directive didn't allow this. You can only
read in quoted strings.

The only idea I have to this is to edit the lines properly within an editor.

1. First declare two arrays and a counter:

#declare Names[677]
#declare Colors{677]
#declare Count=0;

2. Replace all '=' by a new symbol may be '$'
3. Replace all ';' by another new symbol may be '*'
4. Replace all '#declare ' by '#declare Names[Count]="'
   That is why one has to exchange the '=' first!
5. Replace all '$' by '"; #declare Colors[Count]='
6. Finaly replace the '*' by '; #declare Count=Count + 1;'

(Note that I used the apostrophes only to show begin and end of a string, dont
type them in within the find & replace dialog).

This should result in this:

  #declare Names[Count]" OrangeRed            "; #declare Colors[Count]=  rgb
<1.0000, 0.2800,0.0000>; #declare Count = Count + 1;
  #declare Names[Count]" OrangeRed1           "; #declare Colors[Count]=  rgb
<1.0000, 0.2695,0.0000>; #declare Count = Count + 1;

You may want to get rid of some blanks (replace two by one as long as possible
may be), but now you can iterate about the arrays Names and Colors or using the
frame_number during an animation.

Best regards,
Michael


Post a reply to this message

From: MichaelJF
Subject: Re: QUESTION: include :kolors.inc": processing this file
Date: 13 Sep 2013 13:10:01
Message: <web.523346e57de0ad6421b99a9c0@news.povray.org>
"MichaelJF" <mi-### [at] t-onlinede> wrote:
> Sven Littkowski <jam### [at] yahoocom> wrote:
> > I have the wonderful "kolors.inc" but would like to see each of the 677
> > colors it contains. Each useful line begins with "#declare". Two examples:
> >   #declare OrangeRed            =  rgb <1.0000, 0.2800,0.0000>;
> >   #declare OrangeRed1           =  rgb <1.0000, 0.2695,0.0000>;
> >
> >
> > My idea is, to read each line of that file, and transform each line from
> > a definition to a cylinder showing the color specified in this line's
> > declaration.
> >
> > But I don't know which scene commands I have to use, to achieve that.
> > Please help me. Thanks.
> >
> > Sven
>
> Hi to the Carribbean,
>
> POV cannot parse files, since the read-directive didn't allow this. You can only
> read in quoted strings.
>
> The only idea I have to this is to edit the lines properly within an editor.
>
> 1. First declare two arrays and a counter:
>
> #declare Names[677]
> #declare Colors{677]
> #declare Count=0;
>
> 2. Replace all '=' by a new symbol may be '$'
> 3. Replace all ';' by another new symbol may be '*'
> 4. Replace all '#declare ' by '#declare Names[Count]="'
>    That is why one has to exchange the '=' first!
> 5. Replace all '$' by '"; #declare Colors[Count]='
> 6. Finaly replace the '*' by '; #declare Count=Count + 1;'
>
> (Note that I used the apostrophes only to show begin and end of a string, dont
> type them in within the find & replace dialog).
>
> This should result in this:
>
>   #declare Names[Count]" OrangeRed            "; #declare Colors[Count]=  rgb
> <1.0000, 0.2800,0.0000>; #declare Count = Count + 1;
>   #declare Names[Count]" OrangeRed1           "; #declare Colors[Count]=  rgb
> <1.0000, 0.2695,0.0000>; #declare Count = Count + 1;
>
> You may want to get rid of some blanks (replace two by one as long as possible
> may be), but now you can iterate about the arrays Names and Colors or using the
> frame_number during an animation.
>
> Best regards,
> Michael

Sorry forgot an = in my example.


Post a reply to this message

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