【问题标题】:3D Max Python selection multiple items on pymxs3D Max Python在pymxs上选择多个项目
【发布时间】:2021-08-21 17:18:13
【问题描述】:

如何从 pymxs 上的列表中选择人脸?​​

例如此代码有错误:运行时错误:操作需要节点集合,得到:

from pymxs import runtime as rt

t = []
for face in rt.getCurrentSelection()[0].Faces:
    t.append(face)
rt.select(t)

以及如何在没有“执行”和 maxplus 命令的情况下转换此代码?

from pymxs import runtime as rt

rt.execute('subObjectLevel = 4')

是否可以在不重新组合的情况下获取列表?

from pymxs import runtime as rt

object = rt.getCurrentSelection()[0]

for face in object.Faces:
    edges = rt.polyop.getEdgesUsingFace(object, face.index)
    for e in [x for x, edge in enumerate(edges, start=1) if edge]:
        print(e)

【问题讨论】:

    标签: python-3.x scripting 3dsmax


    【解决方案1】:

    与 maxscript 中的方法相同,即使用特定类型的方法,polyop 用于可编辑多边形,meshop 用于网格:

    from pymxs import runtime as rt
    
    obj = rt.getCurrentSelection()[0]
    rt.polyop.setFaceSelection(obj, rt.name('all'))
    rt.subObjectLevel = 4
    

    【讨论】:

    • 感谢您的回答。附加问题:是否可以在不重组的情况下获得列表? [x for x, edge in enumerate(edges, start=1) if edge]。我已向主题添加了新代码。
    • 您的意思是如何使用位数组?在 python 中,使用它们感觉很奇怪,因为它们被转换为真/假值列表并且没有它们具有 maxscript 方面的细节。如果需要,您始终可以强制它们排列,但是在这种情况下,只需使用 polyop.getFaceEdges (getEdgesUsingFace 适用于多个面,因为它会遍历所有对象边缘并检查它们是否属于用户提供的面之一列表)。
    猜你喜欢
    • 2015-07-04
    • 1970-01-01
    • 1970-01-01
    • 2011-09-08
    • 1970-01-01
    • 2022-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多