On Thu, Oct 9, 2014 at 8:45 AM, <[email protected]> wrote:

> Ah-ha.  I was appending a list to the list of connectedVerts.
>
> I still need to test it a bit, but I think this gets me what I'm after.
> Thanks guys for holding my hand through it.
>
> btw, how are you guys nicely formatting your code? are there no <code>
> tags?
>

Marcus shared a cool browser plugin a little while ago that some of us
started using:
http://markdown-here.com/


>
>
> #=================================
> import pymel.core as pm
> from itertools import chain
>
> 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:
>         connectedVertList = list( set( connectedVertGroups.get(vtxKey) ) )
>         connectedVertList = connectedVertList + [ vert for vert in
> connectedVerts ]
>
>         vertList = list(vertGroups.get(vtxKey))
>         vertList.append( vtx )
>
>         connectedVertGroups[vtxKey] = connectedVertList
>         vertGroups[vtxKey] = vertList
>
> #===============================
>
>
> Kev
>
> --
> 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/6cf4e066-9ca3-46fd-a734-7253d8876834%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA14b%3DTCu4ychrCEE-Uo6Qwb0Ej4AvUVkNDhgZ-a0Y65Xg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to