POV-Ray : Newsgroups : povray.general : PoV can't read my array Server Time
1 Nov 2024 13:21:06 EDT (-0400)
  PoV can't read my array (Message 1 to 9 of 9)  
From: Albun
Subject: PoV can't read my array
Date: 11 Jan 2012 20:15:00
Message: <web.4f0e32ef11f51087ec7477a50@news.povray.org>
Hi to all !

A stupid problem , i write an array and i can't read it (141 vectors) with a
'while loop', here's the console message :
--
File: _array.inc  Line: 43
File Context (5 lines):
<462.75,1,102.5> ,<462.75,1,102.5> ,<462.75,1,102.5> ,<493.5,1,101.25> ,
<
Parse Error: No matching } in '{', < found instead
--

In  this  file  _array.inc i see nothing wrong; here is end lines :

<462.75,1,102.5> ,<462.75,1,102.5> ,<462.75,1,102.5> ,<493.5,1,101.25> ,
<511,1,101.5> ,}

And my while loop is :

#declare I=0;
#while (I <Nbr_de_pt)
sphere{Traject_array[I],5 pigment{Blue}}
#declare I =I+1;
#end

I really don't know and see where, and what is the mistake. What do you think
about ?
Thanks for your interest about this.


Post a reply to this message

From: Alain
Subject: Re: PoV can't read my array
Date: 11 Jan 2012 21:26:37
Message: <4f0e44dd@news.povray.org>

> Hi to all !
>
> A stupid problem , i write an array and i can't read it (141 vectors) with a
> 'while loop', here's the console message :
> --
> File: _array.inc  Line: 43
> File Context (5 lines):
> <462.75,1,102.5>  ,<462.75,1,102.5>  ,<462.75,1,102.5>  ,<493.5,1,101.25>  ,
> <
> Parse Error: No matching } in '{',<  found instead
> --
>
> In  this  file  _array.inc i see nothing wrong; here is end lines :
>
> <462.75,1,102.5>  ,<462.75,1,102.5>  ,<462.75,1,102.5>  ,<493.5,1,101.25>  ,
> <511,1,101.5>  ,}
>
> And my while loop is :
>
> #declare I=0;
> #while (I<Nbr_de_pt)
> sphere{Traject_array[I],5 pigment{Blue}}
> #declare I =I+1;
> #end
>
> I really don't know and see where, and what is the mistake. What do you think
> about ?
> Thanks for your interest about this.
>
>
>
>

There is a coma before the closing brace.
As it is now, you write eache elements and unconditionaly follow it with 
a coma, resulting in one superflous coma.


Possible cure:
Write the first element.
Write a coma BEFORE each successive elements.



Alain


Post a reply to this message

From: Thomas de Groot
Subject: Re: PoV can't read my array
Date: 12 Jan 2012 03:01:35
Message: <4f0e935f$1@news.povray.org>
On 12-1-2012 3:26, Alain wrote:

> There is a coma before the closing brace.
> As it is now, you write eache elements and unconditionaly follow it with
> a coma, resulting in one superflous coma.
>
>
> Possible cure:
> Write the first element.
> Write a coma BEFORE each successive elements.
>

or, if you use a counter when writing away your data:

         //Writing the last line in the file:
         #if (i = Count)
           #write (MyFile,MyValue,"\n")
         #else
           #write (MyFile,MyValue,",\n")
         #end

But I guess that Alain's solution is faster.

Thomas


Post a reply to this message

From: Albun
Subject: Re: PoV can't read my array
Date: 12 Jan 2012 05:40:01
Message: <web.4f0eb86f74e4954b3edfa0de0@news.povray.org>
Hi,

I try with and without coma before brace closing and there is no change ..

thanks for Alain and Thomas


Post a reply to this message

From: Albun
Subject: Re: PoV can't read my array
Date: 12 Jan 2012 07:55:03
Message: <web.4f0ed72474e4954b899894a00@news.povray.org>
Hi,

well i try another writing


<462.75,1,102.5> ,
<462.75,1,102.5> ,
<462.75,1,102.5> ,
<493.5,1,101.25> ,

<511,1,101.5> ,
}

and i've got same problem..


Post a reply to this message

From: Thomas de Groot
Subject: Re: PoV can't read my array
Date: 12 Jan 2012 08:18:02
Message: <4f0edd8a$1@news.povray.org>
On 12-1-2012 13:50, Albun wrote:
> Hi,
>
> well i try another writing
>
>
> <462.75,1,102.5>  ,
> <462.75,1,102.5>  ,
> <462.75,1,102.5>  ,
> <493.5,1,101.25>  ,
>
> <511,1,101.5>  ,
> }
>
> and i've got same problem..
>
>
Well, again, the last comma should be deleted in any case. Maybe your 
array declaration is in error.

You could try also the solution explained in the message above "Reading 
from a text file" and see if the error is still there.

Thomas


Post a reply to this message

From: Christian Froeschlin
Subject: Re: PoV can't read my array
Date: 12 Jan 2012 15:08:50
Message: <4f0f3dd2@news.povray.org>
Albun wrote:

> well i try another writing

what's the entire statement? If you write this
file for "#including" it should have the form of

#declare Traject_array = array[<number of elements>]
{
   <462.75,1,102.5>,
   ...
   <511,1,101.5>
}


Post a reply to this message

From: Albun
Subject: Re: PoV can't read my array
Date: 12 Jan 2012 16:50:00
Message: <web.4f0f548274e4954b1eab759b0@news.povray.org>
Hi,

It's OK , i've got it!!!!!!!!

So tired, i forget the real number of element [] about just one vector. The
message console trouble me ...

Thanks for all, and happy new year !!!


Post a reply to this message

From: Albun
Subject: Re: PoV can't read my array
Date: 13 Jan 2012 07:30:01
Message: <web.4f10228974e4954bf0a394290@news.povray.org>
Hi,

so i try to convert a spline to an array 1 dimension

heres is the macro i write and use for it, maybe it'll better for other multiple
dimension...



//  convert_spline_array.mcr
// eg:
//      #include "convert_spline_array.mcr"
//
//
Convert_spline_array(Traject_Spline,0,141,"circuit_array.inc","Traject_array")
//
//That's it ! It's always a little step ...

#macro Convert_spline_array(spline_name, first_pt, last_pt, output_file_name,
output_array_name)


   #declare Nbr_de_points =(last_pt-first_pt)+1;

  #fopen Data output_file_name write

        #write (Data,"\n\n")
        #write (Data,"// ",output_file_name,"  \n\n")
        #write (Data, "// A convert  Spline() to array [] made with
convert_spline_array.mcr\n")
        #write (Data, "// Author : Albun  //Date:  13/01/2012 \n\n\n")
        #write (Data, "// \n")
        #write (Data, "//  \n\n\n")

        #write (Data,"#declare ",output_array_name," = array[",Nbr_de_points,"]
{\n")  //array initialization

                #declare V=first_pt;
                #while (V<= last_pt)

        #write (Data,spline_name(V))                   // array pts
        #write (Data,", //     ",V,"\n")               // nbr of the spline pt

        #if (mod(V,4)=0 ) #write (Data, "\n") #end     // write 4 pts by 4 pts

                #declare V=V+1;
        #end

         #write (Data,"}\n")

 #fclose Data


#end //of macro convert_spline_array.mcr



Bye !


Post a reply to this message

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