Reputation: 2972
I have a scenario, where I need to snap an Object B
over the vertices of a selected edge of Object A
.
I need to know, how to list all the vertices of a selected polyObject edge in a sequence, so that I can duplicate and snap the objects to required vertices based on my requirement. Like snap to every alternate vertex.
Your suggestions are so valuable to me.
Thanks in advance.
Upvotes: 1
Views: 3715
Reputation: 58553
This is a MEL
version:
polyCube -sx 1 -sy 1 -sz 1 ;
select -r pCube1.e[7] ;
PolySelectConvert 3 ;
select -d pCube1.e[7] ;
$allComponents = `ls -selection` ;
print ( $allComponents ) ;
// print ( $allComponents[0] ) ;
// print ( $allComponents[1] ) ;
This is a Python
version:
import maya.cmds as mc
mc.polyCube( sx=1, sy=1, sz=1 )
mc.select( 'pCube1.e[7]' )
mc.select( mc.polyListComponentConversion( tv=True ) )
allComponents = mc.ls( sl=True )
print( allComponents )
# print( allComponents[0] )
# print( allComponents[1] )
Upvotes: 1