问题描述
如何从pymxs上的列表中选择人脸?
from pymxs import runtime as rt
t = []
for face in rt.getCurrentSelection()[0].Faces:
t.append(face)
rt.select(t)
以及如何在没有“execute”和 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)
解决方法
与在 maxscript 中的做法相同,即使用特定于类型的方法,polyop 用于可编辑多边形,meshop 用于网格:
from pymxs import runtime as rt
obj = rt.getCurrentSelection()[0]
rt.polyop.setFaceSelection(obj,rt.name('all'))
rt.subObjectLevel = 4