gpt4 book ai didi

python - 如何通过 Python 在 Maya 中列出选定边上的顶点

转载 作者:太空宇宙 更新时间:2023-11-03 15:10:21 25 4
gpt4 key购买 nike

我有一个场景,我需要将对象 B 捕捉到对象 A 的选定边的顶点上。我需要知道如何按顺序列出选定的 PolyObject 边的所有顶点,以便我可以根据我的要求将对象复制并捕捉到所需的顶点。就像捕捉到每个备用顶点一样。

您的建议对我来说非常有值(value)。

提前致谢。

最佳答案

这是 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] )

关于python - 如何通过 Python 在 Maya 中列出选定边上的顶点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44255617/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com