Notifications
Clear all

[Closed] Need help to save vertex position to TXT file

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 "%
" vert to:out_file
	)
	
	delete theMesh
)	

close out_file

edit out_name

what am I doing wrong?

Thx in advance.

4 Replies

I think that maybe the path you are using is causing the error in the script. Try with “C:\ estmesh.txt”.

I tried the “d:\ hemesh.txt”, and the result is the same…

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 "%
" vert to:out_file
 )

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

thanks a lot! I knew it was a silly error…