Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HELP! - Need script that exports Vertex X,Y coordinates to textfile....

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
2469 Views, 5 Replies

HELP! - Need script that exports Vertex X,Y coordinates to textfile....

Hello. I desperately need a script that can export vertex points X,Y coordinates to a textfile like .csv. Like the following...

 

1. Select a set of vertex points.

2. Run script.

3. Browse for a textfile output and name it.

4. A .csv file is created with two columns X and Y for each vertex coordinates in relation to grid 0, 0 position.

 

Could someone help me with this script?

 

Thank you.    

5 REPLIES 5
Message 2 of 6
MedalHellWay
in reply to: Anonymous

Ok, with more calm I have write a better script for stamp the selected Vertex Position of a ObjPoly.

 

Select The vertex and run script.

Save your file .csv with your name

Print the result in file .csv with separate columns for the x, y and z

 

I hope this can help you. 

 

Message 3 of 6
RadioRahim
in reply to: MedalHellWay

I tried running this and all I get is:

Name: Point001

X Y Z

with no coordinates.

I ran the script as instructed. Is this script supposed to create cooridnates in ths CSV file?

Message 4 of 6
MedalHellWay
in reply to: RadioRahim

You have select the vertrex? The script work well...

 

Name: Box01  
     
X Y Z
     
-18.2595 -20.8713 0.0
18.2595 -20.8713 0.0
-18.2595 20.8713 0.0
18.2595 20.8713 0.0
-18.2595 -20.8713 27.0743
18.2595 -20.8713 27.0743
-18.2595 20.8713 27.0743
18.2595 20.8713 27.0743

 

Follow this step: Open Script, Save tha path with button "Path Save". Then Select the vertex and press "Stamp".

Message 5 of 6
Anonymous
in reply to: MedalHellWay

Script NOT work well,   try over and over.    works only sometimes??

 

 

Also how to get the vertex coordinate similar to the values found in the transform tool.   The api coordinates do not match.

 3dsmax-vertex-coords.jpg

 

transform tool values

x = -14.057

y = -1.286

 

values retrieved by script result for same vertex

x =-42.4729

y =-8.58307e-06

 

 

how can I get values shown in transform typein?      and why do I have to reset 3dsmax to get this script to run successfully a second time?

 

THanks,

 

Frustrated.

 

 

Message 6 of 6
MedalHellWay
in reply to: Anonymous

Yeah, you're right @Anonymous... The script is totally wrong and I do not understand how I did not control the error, Im sorry ... Test this if work for you:

 

try (destroydialog ::gvp) catch()

rollout gvp "Print Vertex Point"
(
Global obj, dir_path, outFile, sv
	
button c_path "Path Save"
button c "Stamp Vertex Pos. XY"
	
	
	on c_path pressed do
	(
		dir_path = getSaveFileName caption:"Name Save File" initialDir:(getDir #export) filename:"PositionVertex_XY.csv"
        outFile = createFile dir_path
	)
	
		on c pressed do
	(
		selection.count == 1 and classof selection[1].baseobject == Editable_Poly
			---
		obj = selection[1].baseobject 
		format "Name: %\n\n" (selection[1].name) to:outFile
		format "% % % % %\n\n" ("X") (";") ("Y") (";") ("Z") to:outFile
sv = for i in $.selectedVerts do 
(
	format "% % % % %\n" (i.pos.x) (";") (i.pos.y) (";") (i.pos.z) to:outFile
)
			close outFile
	)
								
)
createdialog gvp style:#(#style_titlebar, #style_sysmenu, #style_toolwindow, #style_sunkenedge)

Below an example:

 

 test.jpg

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report