i'm not sure what you mean. but if you already have mel script and want to 
change it into python in a hurry, just convert it using mel.eval

from maya import mel
>
> mel.eval("ConvertSelectionToEdges;")
> mel.eval("PolySelectConvert 2;")
> mel.eval("PolySelectConstraint -m 2;")
> mel.eval("PolySelectConstraint -r true;")
> mel.eval("PolySelectConstraint -rr 0.20;")
> mel.eval("polySelectSp -loop;")
>
>
>
>


On Thursday, June 4, 2020 at 3:17:13 PM UTC+9, Vishal Kadam wrote:
>
> Hi can anyone please reply on this
>
> On Monday, June 1, 2020 at 7:36:16 PM UTC+5:30, Vishal Kadam wrote:
>>
>> I have this in mel but I need this in python 
>>
>> ConvertSelectionToEdges;
>> PolySelectConvert 2;
>> PolySelectConstraint -m 2;
>> PolySelectConstraint -r true;
>> PolySelectConstraint -rr 0.20;
>> polySelectSp -loop;
>>
>> in this polySelectSp -loop; is not selecting edge loop properly it skips 
>> few edge loops and stuck in the middle
>>
>> can anyone help me to convert this in python or can I have same kind of 
>> script where I can select random edge loops
>>
>> On Monday, June 1, 2020 at 5:46:45 PM UTC+5:30, Vishal Kadam wrote:
>>>
>>> thanks but it selects only one random edge
>>>
>>> On Monday, June 1, 2020 at 1:26:41 PM UTC+5:30, MichaelEden wrote:
>>>>
>>>> # 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/b03cf7f1-ca1a-4bc4-863f-3c3db7060dbc%40googlegroups.com.

Reply via email to