|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
|
|