PDA

View Full Version : filestream pharsing


igor333
01-20-2005, 12:45 PM
Hi,
I'm reading a file with X Y Z coordinate like this:

1123.213,123213.546,57312.54732
363.213,113.546,573.54732
113.23,1213.54,573.52
1.213,113.56,573.545
13.213,1213.459,57312.111

I'm trying to get each coordinate but i'm not getting it as float:
while not(eof fs) do

(
x = readvalue fs
y = readvalue fs
z = readvalue fs
)

How can I get the data as it is now (float fields)?

igor333
01-20-2005, 02:34 PM
Hi,
Is it another way doing it?

Rens
01-20-2005, 03:38 PM
x = readValue fs as float ?

Max will only display a maximum of six digits of the float, so 1123.213987 will be displayed as 1123.21. It is still stored internally as 1123.213987 though.

Look up "Number Values" in the MaxScript reference, near the bottom is explained how MaxScript handles floats.

Good luck,

- R

igor333
01-20-2005, 03:59 PM
Hi,

I've been tried it, but it doesn't work:-(

Thanks.

lechoo
01-20-2005, 05:00 PM
Maybe you could read whole line at time and filter it with ",". Then read elements 1,2 and 3 from new string.


fLine = "1123.213,123213.546,57312.54732" --line read from file
fLine = filterString fLine "," --split string where "," are
x = fLine[1] as float
y = fLine[2] as float
z = fLine[3] as float

igor333
01-20-2005, 09:18 PM
Hi,

It looks good, I will try it .

Thanks.

igor333
01-23-2005, 07:17 AM
Hi,

I'm still getting:

x = 1123.0f
y = 123214.0f
z = 57313.0f

after using :

format "%" x
format "%" y
format "%" z

Maybe the format command round the number before print it.

lechoo
01-23-2005, 08:33 AM
Maybe try switching dots with comas, like this:
1123.213,123213.546,57312.54732
change to this
1123,213.123213,546.57312,54732
I've had that kind of problem few times.

igor333
01-25-2005, 10:53 AM
Hi,

Still doesn't work:-(

lechoo
01-25-2005, 11:27 AM
Could you post this script?

igor333
01-26-2005, 10:24 AM
Hi,
I guess the problem is in the "format" command.
when I print the mesh , I'm getting its position in floats values,
but when I'm trying to print each coordinate, I'm getting it as integer,
so the important thing is that the positions are correct.

Thanks

CGTalk Moderation
01-26-2006, 11:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.