[Closed] Box creator
Hello!
I would like maxscript to read a text file
and generate a box at the (x data from file,ydata from file) coordinates width(0.9) lengt(0.9) hight(data from file) with the name (data from file)
the content of the file look like this:
5452,Gubba dagis,33679,575,508,270,K55
the value “Gubba dagis” is the name
the value “575” is x coordinate
the value “508” is y coordinate
the value “270” is is the hight
Can this by done?
And how does the code look?
Or Were can i find this script/info on how to do this script?
Please i need help
yeah this can be done look ,info is in the help that comes with max . I used a text file in my fftmax script to animate a set of boxes you could have a look at that script ,it should give you a idea of where to start :).
heres a link to my script
http://www.dmax-scripts.co.uk/Index_files/Scripts_files/FFT_files/FFT.htm
Wow, Danny I could have really done with your Piano MIDI maxscript a few years ago when I did this for my university project, had to animate it all by hand!
dave: Wow… How many hours on the piano animation? Just a little bit of detail… nice.
Iro:
I don’t have max to test this, but here’s some non error trapped starter code…
FS = openFile <Data filename>
do(
-- reads in from file
tnLine = readLine FS
-- divides line into an array by the ,'s
tnData = filterString tnLine ","
-- create Box
newBox = Box name:tnData[2] pos:[tnData[5],tnData[4],0] height:tnData[6]
-- do till end of file
)while( not EOF FS)
You can add more box attributes after the box is made like this
newBox.wirecolor = ( color 120 120 120 )
checkout “Node Common Properties” and “Box” in the MSX help file
Good luck!
My First year, first semester coursework at uni, 20 credits worth for the animation 20creds for R&D portfolio, used some scripting to help me animate, just had to select the notes and click an option for how long it’d get played for and it’d automatically put the keyframes in for rotation and everything else was wire-parametered. Still wish I could have just chucked in a MIDI. Probs spent about 5 weeks on it, back in 3dsmax 5 with Scanline, not bad for my first propper animation? eh
Thanks guys. I had been messing around with max and 3d programs for a couple of years before Uni, but nothing serious.
I remember my uni lecturer thinking I was crazy to attempt the whole piano and insisted I concentrated my time on just doing one key, long time ago… 4 or 5 years hehe, how things have changed!
P.S. Sorry for post-hijacking, will be doing something similar with particles soon so is very interesting.
FS = openFile [size=1]“C:\medlemmar2.txt”
[/size][size=1]do[/size](
[size=1]– reads in from file
[/size]tnLine = readLine FS
[size=1]– divides line into an array by the ,’s
[/size]tnData = filterString tnLine [size=1]”,”
[/size][size=1]– create Box
[/size][size=1]function[/size] newbox
newBox = Box name:tnData[2] pos:[tnData[4],tnData[5],0] length:0.9 height:0.9 height:tnData[6]
[size=1]– do till end of file
[/size])[size=1]while[/size]( [size=1]not[/size] EOF FS)
I can’t get it to work
What am i doing wrong??
Are there data lines in the txt file that do not look like the sample provided? if so it will error on those? What does the error say?
the “[size=1]function[/size] newbox” line will create an error…
All the lines are alike
5452,Gubba dagis,33679,575,508,270,K55
id name id2 x y size id3