3ds Max crushes with this script
Good day to all gurus here.
I have lots of experience with programming, but until recently I never needed Max, so I am new in Max scripting in particular. If this is too simple to work around - please excuse my incompetence, I am just trying out still.
Here is my problem: I want to import a series of altitudes from a file, that is formatted as coma delimited:
where each line is a row of altitudes and each altitude is separated with the next by ",".
This is my test file.
I wrote a script as follows:
x=x0 as float
y=y0 as float
theShape = splineshape name:"imported"
fName = getOpenFileName caption:"Select a .csv file to import" filename:"*.csv" types:"csv|*.csv"
if fName != undefined then
addknot theShape 1 #smooth #line [x,y,0]
thefile = openFile fName mode:"r"
while not eof theFile do
theFileLine = readline theFile as stringstream
while not eof theFileLine do
z = readDelimitedString theFileLine "," as float
addKnot theShape n #smooth #line [x,y,z]
the first four lines are to fix the starting poin of the insertion, and the steps by X and Y.
When I start this script, by "Evaluate All", 3ds Max stops responding and even the debugger is blacking out. When I try to evaluate line by line, it gets stacked on line 21 - "while not eof theFileLine do".
Please help. I really tried out...