tmesh = snapshotAsMesh selection[1]
out_name = ((GetDir #export)+"/testmesh.dat")
out_file = createfile out_name
num_verts = tmesh.numverts
num_faces = tmesh.numfaces
format "%,%\n" num_verts num_faces to:out_file
for v = 1 to num_verts do
(
vert = getVert tmesh v
format "%" vert to:out_file
)
format "\n" to:out_file
for f = 1 to num_faces do
(
face = getFace tmesh f
format "%" face to:out_file
)
close out_file
delete tmesh
edit out_name
The code above came from 3DS Max 2016 online help at http://help.autodesk.com/view/3DSMAX/2016/ENU//?guid=__files_GUID_38562330_1435_4112_9265_DE965319A2... It creates a file below:
8,12
[-7.5,-7.5,0][7.5,-7.5,0][-7.5,7.5,0][7.5,7.5,0][-7.5,-7.5,15][7.5,-7.5,15][-7.5,7.5,15][7.5,7.5,15]
[1,3,4][4,2,1][5,6,8][8,7,5][1,2,6][6,5,1][2,4,8][8,6,2][4,3,7][7,8,4][3,1,5][5,7,3]
The first line shows the number of verticles and number of triangular faces.
The second line shows the coordinates of the verticles at each corner of the cube.
The third line shows the positions of the verticles for drawing each triangular face.
Position [1,3,4] have verticles at [-7.5,-7.5,0],[-7.5,7.5,0], and [7.5,7.5,0].
<mesh>
<name>m.tiny</name>
<triangles>
<triangle>
<materialId>0</materialId>
<vertex>
<position>-7.5,-7.5,0</position>
<texcoord>0,0</texcoord>
</vertex>
<vertex>
<position>-7.5,7.5,0</position>
<texcoord>1,0</texcoord>
</vertex>
<vertex>
<position>7.5,7.5,0</position>
<texcoord>1,1</texcoord>
</vertex>
</triangle>
</triangles>
</mesh>
How do I get each position and separate it into verticles?
1st face = 1,3,4
1st verticle = -7.5,-7.5,0
2nd verticle = -7.5,7.5,0
3rd verticle = 7.5,7.5,0
2nd face = 4,2,1
1st verticle = 7.5,7.5,0
2nd verticle = 7.5,-7.5,0
3rd verticle = -7.5,-7.5,0
3rd face = 5,6,8
1st verticle = -7.5,-7.5,15
2nd verticle = 7.5,-7.5,15
3rd verticle = 7.5,7.5,15
4th face = 8,7,5
1st verticle = 7.5,7.5,15
2nd verticle = -7.5,7.5,15
3rd verticle = -7.5,-7.5,15
so on?