The help which Soham Parmar has done it works as same as the built-in maya 
from poly constraints selecting random edges that is fine it works and 
thanks for that, but my question is is there any option or possibility 
possible to select more random edges horizontally, or control the count of 
edge selection for vertically and horizontally

On Tuesday, June 9, 2020 at 5:36:16 PM UTC+5:30, Marcus Ottosson wrote:
>
> You've already gotten tons of (really good!) help Vishal, but I haven't 
> seen you apply any of the help to your problem. What have you tried so far, 
> where do you get stuck?
>
> On Tue, 9 Jun 2020 at 12:30, Vishal Kadam <vishalk...@gmail.com 
> <javascript:>> wrote:
>
>> Hi can anyone please reply on this
>>
>> On Monday, June 8, 2020 at 3:26:45 PM UTC+5:30, Vishal Kadam wrote:
>>>
>>> Thanks this it works but for example if I have a cube with these values 
>>> height = 5, subdiv width and depth = 5, and  subdiv height = 20, and when 
>>> we use this script horizontal edges selection will be very lesser than 
>>> vertical edges, so is it possible to select more random edges horizontally, 
>>> or control the count of edge selection for vertically and horizontally 
>>>
>>> On Thursday, June 4, 2020 at 12:54:01 PM UTC+5:30, Soham Parmar wrote:
>>>>
>>>> I am also not sure what exactly what you want, but if you just want to 
>>>> select random edges from polygon then MichaelEden’s first reply was 
>>>> helpful 
>>>> i think. you just want to change some line if you want multiple edges 
>>>> rather then one.
>>>> i have quickly  changed few line from MichaelEden’s first reply for 
>>>> selecting multiple edges.
>>>>
>>>> import random
>>>> def randomEdgeSelection(obj, randomEdgeCount):
>>>>
>>>>    # calculate how many edges this object have
>>>>    maxRandomValue = cmds.polyEvaluate(edge=True)
>>>>    
>>>>    # random edges count can not be grater the edges in the poly
>>>>    if randomEdgeCount > maxRandomValue:
>>>>       cmds.error("randomEdgeCount can not be grator then maxRandomValue")
>>>>    
>>>>    edgeIndex = []
>>>>    for i in range(randomEdgeCount):
>>>>       # select the random edges of the object selected
>>>>       edgeIndex.append(random.randint(0, maxRandomValue))
>>>>    
>>>>    edges = []
>>>>    for index in edgeIndex:
>>>>       edges.append("{0}.e[{1}]".format(obj, index))
>>>>    
>>>>    cmds.select(edges)
>>>>    
>>>> randomEdgeSelection(cmds.ls(sl=True)[0], 20)
>>>>
>>>> hopefully it helps.
>>>>
>>>> On 04-Jun-2020, at 12:31 PM, Vishal Kadam <vishalk...@gmail.com> wrote:
>>>>
>>>> this doesn't work for me as I need it, so basically I want to select 
>>>> random edges from an object and control the random count by a value, can 
>>>> that be possible using python
>>>>
>>>> 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/53235f73-0223-4e2c-807e-eb65306e5f3b%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/python_inside_maya/53235f73-0223-4e2c-807e-eb65306e5f3b%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>>
>>>> -- 
>> 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 <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/b4e44ad0-69cf-43ce-b8ba-d95cbcf2dbbao%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/python_inside_maya/b4e44ad0-69cf-43ce-b8ba-d95cbcf2dbbao%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/f5c4053a-d7a6-472d-9acb-a3cd91f7d6cao%40googlegroups.com.

Reply via email to