python-3.xscripting3dsmax

3D Max Python selection multiple items on pymxs


How to select faces from list on pymxs?

For example this code has the error: Runtime error: operation requires a collection of nodes, got:

from pymxs import runtime as rt

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

And how to convert this code without "execute" and maxplus commands?

from pymxs import runtime as rt

rt.execute('subObjectLevel = 4')

is it possible to get list without recombine?

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)

Solution

  • Same approach as doing that in maxscript, ie use type-specific methods, polyop for editable poly, meshop for mesh:

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