如何通过 Python 在 Maya 中列出选定边上的顶点
How to list the vertices over a selected edge in Maya via Python
我有一个场景,我需要在 Object A
的选定边的顶点上捕捉 Object B
。
我需要知道如何按顺序列出选定多边形对象边的所有顶点,以便我可以根据我的要求复制对象并将其捕捉到所需的顶点。就像捕捉到每个备用顶点一样。
你的建议对我很有价值。
提前致谢。
这是一个 MEL
版本:
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] ) ;
这是 Python
版本:
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] )
我有一个场景,我需要在 Object A
的选定边的顶点上捕捉 Object B
。
我需要知道如何按顺序列出选定多边形对象边的所有顶点,以便我可以根据我的要求复制对象并将其捕捉到所需的顶点。就像捕捉到每个备用顶点一样。
你的建议对我很有价值。
提前致谢。
这是一个 MEL
版本:
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] ) ;
这是 Python
版本:
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] )