PDA

View Full Version : advanced poly counter script?


BlackL1ghtn1ng
02-08-2005, 09:42 PM
I decided to get ambitious and deviate from the suggested classes for my Digital Animation degree and took a 3D Modeling class offered at a local art school. We've been using Lightwave and it got me thinking about a few tools. The one that I found most valuable to me at the time is Lightwave's polygon counter. It lists how many polygons of each type (3 sides, 4 sides, 5+ sides) there are in the scene and also lets the user select all of the specified type. I've asked fellow classmates about a utility in Max that does this and they all looked at me like I was crazy, so I figured I was going to have to write a script to do so. The problem I am having is figuring out how to select all the vertices that make up any given polygon. Is there a chunk of code someone could share with me, or if anyone has made this script already could they give me an idea of how you did it? I'm looking forward to this project, I just need a push in the right direction. Thanks.

~Pete

ofer_z
02-08-2005, 11:25 PM
Hi Pete,

for polyobject there's a command that returns an array of the vertices' numbers used by a specified face:
polyop.getFaceVerts obj faceNum

you could then use the count property to get the amount of vertices in the face:
(polyop.getFaceVerts obj faceNum).count

as for meshobjects this is be a bit trickier, since there are no "real" polygons. however, you can use this:

polyfaces = meshOp.getPolysUsingFace obj faceNum -- get all the faces in the polygon based on the face number
verts = meshop.getVertsUsingFace obj polyfaces -- get the vertices used by the above faces
verts.numberSet -- get the number of vertices in verts




for more information check out the maxscript help on the topics of "meshop" and "polyop"

hOpe this helps,
o

CGTalk Moderation
02-09-2006, 12:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.