[Closed] dubugging: how to
Actually I just did some searching in the help. You may want to try using getPolygonCount <node>. This will return an array of #(faces,verts). For tri-mesh (Edit Mesh, Edit Patch, Parametric Objects, NURBS, etc) it will return the number including hidden edges and for poly objects (Edit Poly or Editable Poly) will return the number of polygon faces.
Ex. a sphere will return #(960, 482), as a mesh #(960, 482), as a patch #(960, 482), as a poly object #(512, 482).
Once you have the array pull the first indice and you will have the proper face count for the type of object the node is at the top of the stack.
If you want the proper face count a specific point in the stack then you would need to use polyop/meshop.getnumfaces and the modifier position. Hope that makes some sense and helps out.
-Eric
thanks for checking out eric…
here is an interesting point: check this with the above object in maxfile as its the main problem of this thread…
getPolygonCount $
polyop.getNumFaces $
both the above functions should return exactly the same polycount (polygons)… but for the above object it doesnt? and from this point if i check material id’s of each face using the below function i will get an “undefined” for a few faces
polyOp.getFaceMatID $ <face id index(s)>
now the interesting bit is if I use the meshop function to get faces (triangles) and then again $.mesh parameter with getFaceMatID then i dont get any undefined and the script runs fine.
meshop.getNumFaces obj.mesh (gets total faces in triangles)
getFaceMatID obj.mesh val (gets material ids without error)
well, i know whats happening now… but it will be nice to find out why different face count in the first case
I see the issue. Your Poly/Face index is messed up run polyop.getDeadFaces obj and it will return #{2…3, 5, 7}. So the non-dead face indices are 1,4,6,8,9,10. Which is probably why it is returning 10 faces. You can fix it by running polyop.collapsedeadstructs obj. If you then run polyop.getnumfaces it will return 6.
polyOp.getDeadFaces <Poly poly>
Returns the current dead faces selection as a bitarray. Normally this will return an empty bitarray.polyOp.CollapseDeadStructs <Poly poly>
Removes all dead SO elements from the poly.
-Eric
omg eric… u are a hero man… i thought this can never be fixed… if an object is corrupt its corrupt… thanks a lot, this way i can now check and report the objects to the user…