Message 1 of 14
Reading text files
Not applicable
11-29-2009
04:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello there! I need some help with reading some text files with maxscript, as I don't know how to do this. This is the structure of the file I want to read:
I got to this part where I don't know how to read the different atributes
I can't get it to load one of the attributes (mass for example). I hope you can help me, or point me in the good direction!
attributes {
atrib1 float;
atrib2 float;
etc...
}
compound {
sphere {
centre 0 0 0;
radius .15
}
}I got to this part where I don't know how to read the different atributes
on imp pressed do (
colopenname = getOpenFileName caption:"Open file" types:"file (*.tcol)|*.tcol|"
colname = openfile colopenname
if colname != undefined do
(
while not eof colname do
(
line = readLine colname --We start reading the file
if line == "TCOL1.0" do
(
format "TCOL 1.0\nStarted TCOL import\nName: %\n" colopenname to:listener
continue
)
line = readLine colname
if line == "attributes {" do
(
format "Importing atributes\n" to:listener
continue
if line == "mass" do (
massv = args as float
smass.value massv
format "Mass: %\n" massv to:listener
continue
)
continue
)
if line == "}" do
(
format "Finish\n" to:listener
continue
)
)
)
)
I can't get it to load one of the attributes (mass for example). I hope you can help me, or point me in the good direction!
