PDA

View Full Version : script to select everyother face of object


ozzinator
12-14-2011, 01:09 AM
can someone please give me a mel script which selects everyother face of any object ? Thanks you

supertom44
12-17-2011, 10:39 AM
Heres a quick way to do it in python, I know you asked for mel but it should be easy enough to convert.

There is probably a better way to do it.

import maya.cmds as mc
mesh = mc.ls(sl=True)[0]
faceCount = mc.polyEvaluate(f=True)

for face in range(0,faceCount,2):
mc.select("%s.f[%s]" % (mesh,face), add=True)

Nyro
12-17-2011, 01:22 PM
I guess in MEL this would look like this:

string $mesh[] = `ls -sl`;
int $faceCount = `polyEvaluate -f`;

for ($i = 0; $i < $faceCount; $i++) {
if(fmod($i, 2) == 0) {
select -add ($mesh[0] + ".[" + $i + "]");
}
}

CGTalk Moderation
12-17-2011, 01:22 PM
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.