View Full Version : filestream pharsing
01-20-2005, 01:45 PM
I'm reading a file with X Y Z coordinate like this:
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)?
01-20-2005, 03:34 PM
Is it another way doing it?
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.
01-20-2005, 04:59 PM
I've been tried it, but it doesn't work:-(
01-20-2005, 06: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 as float
y = fLine as float
z = fLine as float
01-20-2005, 10:18 PM
It looks good, I will try it .
01-23-2005, 08:17 AM
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.
01-23-2005, 09:33 AM
Maybe try switching dots with comas, like this:
change to this
I've had that kind of problem few times.
01-25-2005, 11:53 AM
Still doesn't work:-(
01-25-2005, 12:27 PM
Could you post this script?
01-26-2005, 11:24 AM
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.
01-26-2006, 12:00 PM
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.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.