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 (or any textfile) is created with two columns X and Y for each vertex coordinate in relation to grid 0, 0 position in model.

Could someone help me with this script?

Thank you.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Thomas Jarkowski's picture

When looking at the

When looking at the coordinates in the file, I see that the first and the last have 0,0 in them.. this means the coordinates are in relation to the editable poly object as an isolated object, not the world grid in the model.

Would this be an easy fix? I need coordinates in relation to the full model 0,0 grid position?

pixamoon's picture


ah, sure, I didn't check that. Will post fix soon

pixamoon's picture


oki, try this one: didn't have time to test it, but i think it should be it:

csvFile = "c:\\text2.csv"
separator = " "  --- can be tab "\t" space " " or "|"
if selection.count == 1 and classof $ == Editable_Poly do (
	arr = $.GetSelection #Vertex
	if arr != undefined do 
		verArr = for i in arr collect ((polyOp.getVert $ i)[1] as string + separator + (polyOp.getVert $ i)[2] as string)
	try( (dotnetClass "System.IO.File").WriteAllLines csvFile verArr )catch()
Thomas Jarkowski's picture

Thanks.. runned it but gor

Thanks.. runned it but gor these numbers...

5202.83 -3730.04
8060.24 -7757.49
7409.35 -7453.97
6734.48 -7208.34
6040.77 -7022.46
5333.5 -6897.75
4626.23 -7022.46
3951.36 -6776.83
3765.48 -6083.12
3828.07 -5367.67
4187.16 -4745.71
4694.99 -4237.87

checked a vertex but the model coordinates are in cm and all are positive numbers. Checked on of the vertex numbers and got, X: 402,239, Y: 426,456. So these coordinates cant be right either.

sorry.. but is it fixable?

pixamoon's picture


can you check your System Unit (not display unit)

or can u send me some part of your scene to [email protected]

Thomas Jarkowski's picture

Here is a screendump from the

Here is a screendump from the system unit setup....

system_unit_setup.jpg 148.68 KB
pixamoon's picture


oki, look like scripts saves in system units, and u have it as millimeters. Can u try to select one vertex and save it. then check result with your max scene.

I tried here with inches System Units and all looks good
Let me know

Thomas Jarkowski's picture

ok.. but sorry I don't

ok.. but sorry I don't understand fully.. do you mean that in system unit setup 1 unit = 1 millimeter, as set... but even if output is in millimeters, the numbers don't match if transforming from millimeters to cm?

Thomas Jarkowski's picture

changed display unit to

changed display unit to millimeters now also but still the same problem with output.. negative value also.

pixamoon's picture


I tried here few different meshes different scale etc, every time it saves good coordinate.

I think I'll need to see any part of your scene to find out what is wrong.

or try this... create box, convert it to editable poly, select vertex and run scripts...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.