PDA

View Full Version : Need help to save vertex position to TXT file


trcsilva
05-19-2008, 10:24 AM
Hi there,

I am new to 3DS Max, so I think this is going to be a pretty simple question for you guys...

I have a cartography map made of splines in 3DS Max, and I need to store the splines' vertices positions in a TXT file, but all I get is a blank file...

this is the script I am using


clearselection()

out_name = ("c:/testmesh.txt")

out_file = createfile out_name

for o in objects do --all the objects in the scene
(
local theMesh = snapshotAsMesh o

for v = 1 to getNumVerts theMesh do --loop through all vertices
(
vert = getVert obj v --get the v-th vertex

format "%\n" vert to:out_file
)

delete theMesh
)

close out_file

edit out_name


what am I doing wrong?

Thx in advance.

IkerCLoN
05-19-2008, 05:24 PM
I think that maybe the path you are using is causing the error in the script. Try with "C:\\testmesh.txt".

trcsilva
05-20-2008, 04:28 AM
I tried the "d:\\themesh.txt", and the result is the same...

zortech
05-20-2008, 10:51 AM
Looks like a copy and paste problem.

for v = 1 to getNumVerts theMesh do --loop through all vertices
(
vert = getVert obj v --get the v-th vertex

format "%\n" vert to:out_file
)

the variable obj is undefined, as it was never declared. If you replace it with theMesh it should work.

trcsilva
05-20-2008, 01:38 PM
thanks a lot! I knew it was a silly error...

CGTalk Moderation
05-20-2008, 01:38 PM
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.