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)
    if vtxKey is None:
        connectedVerts = [ vert for vert in vtx.connectedVertices() ]
        connectedVerts.append(vtx)
        connectedVertGroups["group_{0}".format(i)] = connectedVerts
        vertGroups["group_{0}".format(i)] = vtx

​

On 8 October 2014 18:05, Marcus Ottosson <[email protected]> wrote:

> How about a loop?
>
> awesome_verts = list()for name, group in connectedVertGroups.iteritems():
>     for vertex in group:
>          if vertex is 'Awesome':
>               awesome_verts.append(vertex)
>
> ​
>
> On 8 October 2014 17:56, <[email protected]> wrote:
>
>> Hi jack, thx for helping me.
>>
>> I think this works for me:
>>
>> vtxKey = next((key for key, value in connectedVertGroups.iteritems() if
>> value == vtx), None)
>>
>> The only problem I'm having is that my dictionary values are a list of
>> vertices, and I need to check for a vertex within those lists.
>>
>> Do you have any suggestions for getting passed that?  I was able to use
>> chain(*) when checking the dictionary values directly, but it doesn't seem
>> to work when I'm using dict.iteritems().  chain(*dict.iteritems()) or
>> chain(*dict.items()) - too many items to unpack.
>>
>> 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/7246e089-a231-4297-9e81-27e676b1dfb6%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> *Marcus Ottosson*
> [email protected]
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Python Programming for Autodesk Maya" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/python_inside_maya/_K5kHFAEXjo/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAXxCMuYbPfbvX_%3D0BM-pKVciXSXr51V5qqenU2cKDNKA%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAXxCMuYbPfbvX_%3D0BM-pKVciXSXr51V5qqenU2cKDNKA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> 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/CAOz4VE0X%3DavBpD35XUS8VkHTj669MPc2sS0CfbQRYFOz-mACwQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to