【问题标题】:How to list the vertices over a selected edge in Maya via Python如何通过 Python 在 Maya 中列出选定边上的顶点
【发布时间】:2017-10-30 12:54:15
【问题描述】:

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

你的建议对我很有价值。

提前致谢。

【问题讨论】:

    标签: python scripting maya mel


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-13
      • 2017-03-08
      • 2022-10-08
      相关资源
      最近更新 更多