import maya.cmds as cmds
import maya.OpenMaya as om
violationPolygons = []
mIt_kMesh = om.MItDependencyNodes( om.MFn.kMesh )
while not mIt_kMesh.isDone():
mObject = mIt_kMesh.thisNode()
dagPath = om.MDagPath.getAPathTo( mObject )
mFnMesh = om.MFnMesh( dagPath )
mObject_numFaces = mFnMesh.numPolygons()
for faceID in range(0, mObject_numFaces ):
mIntArray = om.MIntArray()
mFnMesh.getPolygonVertices( faceID, mIntArray )
if mIntArray.__len__() > 4:
if not dagPath.fullPathName() in violationMesh:
violationMesh.append( dagPath.fullPathName() )
violationPolygons.append( '%s.f[%d]' %( dagPath.fullPathName(), faceID ) )
mIt_kMesh.next()
cmds.select(violationPolygons)
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/6e6e3e86-ed5d-4335-9c10-352696e8701e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Justin
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/6e6e3e86-ed5d-4335-9c10-352696e8701e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2r5rbjv1XZpDKYRBm39DvsnAehMrUykyBW%3DxLeuaav-g%40mail.gmail.com.
import maya.cmds as cmds
import maya.OpenMaya as om
violationMesh = [ ]
violationPolygons = [ ]
mIt_kMesh = om.MItDependencyNodes( om.MFn.kMesh )
while not mIt_kMesh.isDone():
mObject = mIt_kMesh.thisNode()
dagPath = om.MDagPath.getAPathTo( mObject )
mFnMesh = om.MFnMesh( dagPath )
mObject_numFaces = mFnMesh.numPolygons()
mIntArray = om.MIntArray()
for faceID in range(0, mObject_numFaces ):
mIntArray.clear()
For completeness and to not miss anything obvious,
Side note: the script cannot select anything. I previously used a command to run the PolyCleanup tool. Although it finds NGons in a microsecond, it doesnt give me a list, it selects them.
What about selecting, and running cmds.ls(selection=True)
afterwards? If you restore your selection afterwards, this would give you a list in that microsecond.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/6737d41f-73fc-4c5c-9951-598dc05d821b%40googlegroups.com.