PDA

View Full Version : simple problem from MaxScript noob


Ferrums
10-03-2004, 04:28 PM
Hi,

I have just started learning MaxScript today, becouse I need a script finished quickly - today. Here's what I need to do with the script: I have a scene open in Max, run this script, that opens up a text file, reads in an object name, copies the object with that name to coordinates specified in the file.


Example:
if I have the following objects in my scene
1) Box1
2) Sphere2
3) SomethingElse
and the text file contains:
Box1 10 10 10 20 20 20
Box1 30 30 30 40 40 40
Sphere2 10 10 10 20 20 20

then the script should make a copy of the object Box1 at coords 10 10 10 with rotation angles 30 30 30 and another copy of Box1 at 30 30 30 with rotation angles 40 40 40 and one Sphere2 at 10 10 10 with rotation angles 20 20 20.

Heres what i have so far:


f = undefined

fname = getOpenFileName caption:"Find file" filename:"*.txt"

if fname != undefined then
f = openFile fname object_name = "none"
object_pos = [0.0,0.0,0.0]
object_rot = [0.0,0.0,0.0]

if f != undefined then
(
while (not eof f) do
(

object_name = readvalue f;

object_pos.x = readvalue f;
object_pos.y = readvalue f;
object_pos.z = readvalue f;

object_rot.x = readvalue f;
object_rot.y = readvalue f;
object_rot.z = readvalue f;
--need to do stuff here--
)
close f
)




So how do I actually copy the object and assign the position and rotation to it ?

P.S. This is my first try at maxscript, and I need this done real quick, so I havent had the time to look at some tutorials in depth, so, please, dont flame for not knowing simple things ;)

CGTalk Moderation
01-19-2006, 10:00 AM
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.