Notifications
Clear all

[Closed] I need a script that will batch move meshes

I need something that will record mesh XYZ coordinates and save them to a max script text file.

Right now I’m writing the max scripts by hand with a text editor like this:

 
 
target = "C:\\Program Files\\3dsmax\\meshes\\Rachel\\rei0"
 
 
 
importFile (target + "00.3ds") #noPrompt
$mesh00.pos = [0.0000,0.0000,0.0000]
 
 
 
importFile (target + "01.3ds") #noPrompt
$mesh01.pos = [0.0000,12.000,2.1000]
 

I use the macro recorder when I need to know how to I need to phrase something in the script but this is way too time consuming. Is there a way to record all the mesh’s XYZ coordinates to a text file?

I have been searching but there is so much information here, it’s almost overwhelming.

In other words I need a 3ds coordinate exporter that export a .ms file with mesh positions like the one’s I have been writing by hand i.e.

target = “C://some//path”

importFile (target + “00.3ds”) #noPrompt
$mesh00.pos = [0.0000,0.0000,0.0000]

importFile (target + “01.3ds”) #noPrompt
$mesh01.pos = [0.0000,12.000,2.1000]

etc etc

3 Replies

Well I got no replies so I have a friend write me a program in Ruby for this. I’m sure there was an easier way but I got no replies from here <sigh>

Hi,

Your point is not very clear, so i’m ‘guestimating’ what you want:

  1. import a 3ds file
  2. save the position of the object

so you could go with someting like:
[size=1]
[/size]

 
t="C:\\Program Files\\3dsmax\\meshes\\Rachel\\rei0" 
f=getfiles (t + "\\*.3ds") 

PosArray=#()

for i in f do

(

resetMaxFile #noPrompt

importFile i #noPrompt

for o in geometry do append PosArray #(i, o.name,o.pos)

)
 
format "File:%
Object:%	 pos:%
" PosArray[1][1] PosArray[1][2] PosArray[1][3]

PosArray hold all the names of the file and the objects with their position

hope this helps

Thanks Zbuffer

I really appreciate the reply. I already had a friend that wrote me a program in ruby that get’s the job done.

I also wanted to try your script but when I tried it, all it seemed to do is open and close all the meshes.

I apologize if I was not clear in what I was asking, it takes a real talent to clearly communicate.

If your still curious about what I was trying to accomplish, here is the full story:

http://forums.ninjahacker.net/index.php?showtopic=3844