how to choose a set set using python

how to choose a set set using python

2368457978
Enthusiast Enthusiast
557 Views
1 Reply
Message 1 of 2

how to choose a set set using python

2368457978
Enthusiast
Enthusiast

Hello, everyone, python selection set can't be used (cmds.ls(sl=True, dag=True))? , my use is invalid,

def stepSize():
    set = cmds.ls(sl=True, dag=True)
    for each in set:
        STS = cmds.floatSliderGrp("stepSize", q=True, value=True)
        cmds.setAttr(each +".stepSize", STS)
                
def Set_att01():
    set = cmds.ls(sl=True, dag=True)
    maxNumber = cmds.floatField("maxNumberOfGuideInfluences", q=True, v=True)
    print(maxNumber)
    for each in set:
        cmds.setAttr(each + ".maxNumberOfGuideInfluences", maxNumber)

def Set_att02():
    set = cmds.ls(sl=True, dag=True)
    minimum = cmds.floatField("minimumNumberOfSteps", q=True, v=True)
    print(minimum)
    for each in set:
        cmds.setAttr(each + ".minimumNumberOfSteps", minimum)    
                
cmds.rowLayout(nc=6)
cmds.text("GuideInfluences",w=110, h=20, bgc=(0.2, 0.5, 0.5))           
cmds.floatField("maxNumberOfGuideInfluences", w=60, h=30,minValue=0, value=3, precision=0)
cmds.button("O K",w=60, bgc=(0.4, 0.2, 0.3), c="Set_att01()")

cmds.text("NumberOfSteps",w=110, h=20, bgc=(0.2, 0.5, 0.5))
cmds.floatField("minimumNumberOfSteps", w=60, h=30,minValue=0, value=10, precision=0)
cmds.button("O K",w=60, bgc=(0.4, 0.2, 0.3), c="Set_att02()")

cmds.setParent( '..' )
cmds.rowLayout(nc=2)
cmds.text("stepSize",w=110, h=20, bgc=(0.2, 0.5, 0.5))
cmds.floatSliderGrp("stepSize", field=True, w=350, min=0.001, max=1, value=0.001, step=0.001, fieldMinValue=0.001, fieldMaxValue=10.000,cc="stepSize()")
cmds.setParent( '..' )                                                             

f8bb2b1f89d8f82f5e3273c031f686c.png

Accepted solutions (1)
558 Views
1 Reply
Reply (1)
Message 2 of 2

Kahylan
Advisor
Advisor
Accepted solution

I'm not quite sure if I understand what your question is, because what you are doing is quite literally choosing the set itself.

I guess you want to know how to find the set members?

If so, this is it:

import maya.cmds as cmds

set = cmds.ls(sl = True)
for s in set:
    members = cmds.sets(s, q= True)

I hope it helps!

0 Likes