Skip to content

Instantly share code, notes, and snippets.

@EricTRocks
Created September 16, 2016 21:31
Show Gist options
  • Save EricTRocks/10f6a6d418439109fd96f1c8b5df0b09 to your computer and use it in GitHub Desktop.
Save EricTRocks/10f6a6d418439109fd96f1c8b5df0b09 to your computer and use it in GitHub Desktop.
Create a Bone object in 3dsMax 2017
import MaxPlus
import pymxs
import random
rt = pymxs.runtime
bone = pymxs.runtime.boneSys.createBone(rt.Point3(0, 0, 0), rt.Point3(8, 0, 0), rt.Point3(0,0,1))
hash = random.getrandbits(128)
bone.Name = str(hash)
node = [x for x in MaxPlus.Core.GetRootNode().Children if x.Name == str(hash)][0]
node.SetName('blah')
node.BaseObject.ParameterBlock.Length.Value = 3 * 10.0
node.BaseObject.ParameterBlock.Width.Value = 10.0
node.BaseObject.ParameterBlock.Height.Value = 10.0
node.Scaling = MaxPlus.Point3(3, 3, 3)
node.Position = MaxPlus.Point3(20, 20, 20)
help(MaxPlus.Quat)
node.Rotation = MaxPlus.Quat()
@EricTRocks
Copy link
Author

The hashing is to ensure I can find the object after creation through the runtime. If anyone knows a more direct way to convert from the wrapped object that the run time returns to a MaxPlus node type I'd appreciate the insight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment