yes, something like that thanks, but why should i use arrays instead text files? is it faster?
pun. --- On Tue, 1/20/09, IOhannes m zmoelnig <zmoel...@iem.at> wrote: > From: IOhannes m zmoelnig <zmoel...@iem.at> > Subject: Re: [PD] reading colors from txt file with repeat > To: punch...@yahoo.com > Cc: pd-list@iem.at > Date: Tuesday, January 20, 2009, 1:46 PM > punchik punchik wrote: > > Hello pd happy people, one question , i have a txt > file with rgb colors . > > The txt file i have is something like this: > > > > 142 250 0 > > 0 100 50 > > 14 123 0 > > 123 222 111 .... and so on. > > > > each line represents the rgb color where the first > item in each line is red , the second green and the third > blue. > > > > My question is this: i have a gem patch that creates > random 3d shapes using nested repeat objects with geos. > How can i read each line of my txt file (each color ) and > apply to each repeated geo? for example if i have a sphere > repeated 10 times, i would like that the first sphere would > be the color of the first line in my txt file, the second > sphere the second line in my txt file , the third sphere > the third color in my txt file and so on..... > > > > how can i do something like this???????????? > > something like the attached? > > but you probably really should use tables/arrays to store > the values rather than using [textfile] > > fgmasdr > IOhannes > 1 1 1 > 1 0 0 > 0 1 0 > 0 0 1 > 1 1 0 > 1 0 1 > 0 1 1 > #N canvas 142 81 784 483 10; > #X obj 135 138 gemhead; > #X obj 547 125 gemwin; > #X msg 548 96 create \, 1; > #X obj 135 195 repeat 10; > #X obj 270 241 textfile; > #X obj 135 166 t a b; > #X msg 248 156 rewind; > #X obj 135 299 color; > #X obj 135 244 t a b; > #X obj 135 350 translateXYZ 0.5 0 0; > #X obj 135 326 sphere 0.1; > #X obj 135 374 rotateXYZ 0 0 10; > #X msg 327 165 read colors.txt cr; > #X msg 341 304 rewind \, bang; > #X obj 341 284 spigot; > #X obj 455 199 tgl 15 0 empty empty empty 17 7 0 10 -262144 > -1 -1 0 > 1; > #X obj 273 209 spigot 1; > #X obj 339 220 == 0; > #X obj 409 220 t f f; > #X text 477 197 --> turn on to loop through the file; > #X floatatom 281 93 5 0 0 0 - - -; > #X obj 135 398 scale 0.9; > #X connect 0 0 5 0; > #X connect 2 0 1 0; > #X connect 3 0 8 0; > #X connect 4 0 7 1; > #X connect 4 1 14 0; > #X connect 5 0 3 0; > #X connect 5 1 6 0; > #X connect 6 0 16 0; > #X connect 7 0 10 0; > #X connect 8 0 7 0; > #X connect 8 1 4 0; > #X connect 9 0 11 0; > #X connect 10 0 9 0; > #X connect 11 0 21 0; > #X connect 12 0 4 0; > #X connect 13 0 4 0; > #X connect 14 0 13 0; > #X connect 15 0 18 0; > #X connect 16 0 4 0; > #X connect 17 0 16 1; > #X connect 18 0 17 0; > #X connect 18 1 14 1; > #X connect 20 0 3 1; _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list