# import random module, documentation is here:
# https://docs.python.org/3/library/random.html
import random

# select the object
selection = cmds.ls(sl=True)[0]
# calculate how many edges this object have
maxRandomValue = cmds.polyEvaluate(edge=True)

# select the random edges of the object selected
cmds.select("{}.e[{}]".format(selection, random.randint(0,maxRandomValue)))

# print
print "{} is selected".format(cmds.ls(sl=True)[0])


hopefully it helps. cheers. 


On Monday, June 1, 2020 at 4:38:03 PM UTC+9, Vishal Kadam wrote:
>
> Hello,
>
> can anyone help me, I want to select random edges using python script, as 
> we do that from polygon selection constraint on edges then adjusting the 
> count using ratio value
>

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/8b2a893a-5714-4373-bd3f-11672599931d%40googlegroups.com.

Reply via email to