so something kinda like this, except I'm getting an error: "MeshVertex" object
has no attribute append, as I'm not quite sure how to do that bit.
import pymel.core as pm
sel = pm.ls(sl=1, fl=True)
connectedVertGroups = {}
vertGroups = {}
for i, vtx in enumerate(sel):
vtxKey = next((key for key, vtx_list in connectedVertGroups.iteritems() if
vtx in vtx_list), None)
connectedVerts = [ vert for vert in vtx.connectedVertices() ]
connectedVerts.append(vtx)
if vtxKey is None:
connectedVertGroups["group_{0}".format(i)] = connectedVerts
vertGroups["group_{0}".format(i)] = vtx
else:
connectedVertGroups[vtxKey] = connectedVertGroups[vtxKey].append(
connectedVerts )
vertGroups[vtxKey] = vertGroups[vtxKey].append( vtx )
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/239e371c-bfef-4fe0-afcb-9880c64f639f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.