|
I have a problem with this practical example “How To ... Output Geometry Data To Text File - Part One”
http://docs.autodesk.com/3DSMAX/...-9265-DE965319A2F-322.htm
I draw a simple plane into the scene and while it is selected I click on my scripts button
mesh = snapshotAsMesh selection[1]
out_name = ((GetDir #export)+"/testmesh.dat") out_file = createfile out_name
num_verts = tmesh.numverts
for v = 1 to num_verts do
(
vert = getVert tmesh v
format "%," vert to:out_file )
close out_file
this is very simplified part of the whole script I have but it suffices the purpose. Anyway when my command panel is on anything else than Modifiers tab this script throws an error:
maxscript rollout handler exception
-- runtime error: Mesh vertex index out of range: 8
If before running this script I switch to Modifiers list and then I run it it works fine. Why this is happening?
|
|
|
|
( thisMesh = snapshotAsMesh $Plane001
num_verts = thisMesh.numVerts
for v = 1 to num_verts do
(
thisVert = getVert thisMesh v
format "% %\n" v thisVert to:listener
)
)
“mesh” is a constructor for a new Mesh object - shouldn’t be used as a varaiable name.
“tmesh” is undefined (on original line 4).
Removed the file handling as it’s not relevent (in the context of the question being posed).
Forced the use of the object directly to remove any complications to with selections or the command panel. Always try reducing the code to the bare essentials when trying to debug a problem like this - the less code there is the less there is which can go wrong, which makes finding the problem much easier.
If you have a plane object (Plane001) in the scene, the above code works regardless of selection, command panel status etc, therefore simply changing the variable name (consistently) throughout that part of your script should fix the problem.
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
I tried on very simple version of my script and it worked, so I it has to be something with my script anyway, I think I will go with obj exporter and will just make a parsing in my other software as this maxscript is extremely slow mesh with 8000 polys takes couple seconds to export…
thanks for your help
|
|
|