MaxPlus Python - 3Ds Max - Add Worldspace Modifier

Hi!

I’m trying to learn MaxPlus/Python in 3Ds Max, and I’m stuck with creating a worldspace modifier. (Path Deform Binding WSM modifier)

mod = MaxPlus.Factory.CreateWorldSpaceModifier(MaxPlus.ClassIds.PathDeformSpaceWarp)
MaxPlus.ModifierPanel.AddToSelection(mod)

Above code gives the following error:

File "C:\Program Files\Autodesk\3ds Max 2017\MaxPlus.py", line 30534, in CreateWorldSpaceModifier
    return _MaxPlus.Factory_CreateWorldSpaceModifier(*args)
RuntimeError: creation failure

Not sure why it happens, maybe the class ID is wrong? Adding object space modifiers works like a charm.

My current workaround is using the new pymxs:

# pymxs part
rt.execute("meshObj=$")
rt.modpanel.addmodtoselection(rt.SpacePathDeform())
rt.meshObj.modifiers[0].path = rt.s

But that feels really hacky. Any ideas?

Thanks!

mod = MaxPlus.Factory.CreateWorldSpaceModifier(MaxPlus.Class_ID(0x000110b4, 0x00007f9e))
MaxPlus.ModifierPanel.AddToSelection(mod)

Full answer: http://stackoverflow.com/questions/38906782/maxplus-python-3ds-max-add-worldspace-modifier