If faces are selected do... (python)

If faces are selected do... (python)

Anonymous
Not applicable
755 Views
2 Replies
Message 1 of 3

If faces are selected do... (python)

Anonymous
Not applicable

Hi,
I'm working on a python script where I need an if statement that fires if faces are selected.

 

if faces in selection:

     print "example warning"

 

Thanks

0 Likes
756 Views
2 Replies
Replies (2)
Message 2 of 3

viru.gupta8
Enthusiast
Enthusiast
You can use filterExpand command.
It will filter faces from your list

selection = cmds.ls(sl=True, flatten=True)
facesInSelection = cmds.filterExpand(selection, sm=34)
If facesInSelection:
doSomething(facesInSelection)
0 Likes
Message 3 of 3

viru.gupta8
Enthusiast
Enthusiast
Please mind indentation
If facesInSelection:
doSomething(facesInSelection)

I am posting it via mobile 🤐
0 Likes