[Closed] filestream pharsing
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)?
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
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
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.
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.