Python (MaxPlus) - How to move pivot of an object on a single axis?

Python (MaxPlus) - How to move pivot of an object on a single axis?

Huston94
Enthusiast Enthusiast
1,197 Views
2 Replies
Message 1 of 3

Python (MaxPlus) - How to move pivot of an object on a single axis?

Huston94
Enthusiast
Enthusiast

Hi there, 

 

I'm trying to learn Python (MaxPlus) for 3ds Max. I need to be able to move an object's pivot point along a single axis (preferably to the bottom of the object's bounding box). I have tried everything I can think of but it seems like the only Pivot methods/attributes for the INode class is CenterPivot, AlignPivot, etc.. I haven't found any way to edit the pivot otherwise. Is there a method or attribute I'm missing or am I doing it all wrong lol? Comments are the statements I am wanting to be able to do. Any advice would be greatly appreciated. Thanks.

 

import MaxPlus

scene_objs = MaxPlus.Core.GetRootNode().Children
for obj in scene_objs:
	obj.CenterPivot(0, False)
	
# obj.PivotZ = MaxPlus.Point3(0, 0, -5)
# and/or # obj.PivotZ = obj.BoundBoxZ
0 Likes
1,198 Views
2 Replies
Replies (2)
Message 2 of 3

drew_avis
Autodesk
Autodesk

Hi there, it doesn't look like pivot is exposed in MaxPlus.  However, you can get it through pymxs.  So in your example, you could do something like:

 

import pymxs
rt = pymxs.runtime

for o in rt.objects :
	pv = o.pivot
	pv.z = -5
	o.pivot = pv

Hope that helps,

Drew



Drew Avis
Content Experience Designer
Message 3 of 3

Huston94
Enthusiast
Enthusiast

Awesome. Figured I was going to have to end up using the pymxs module. Thanks a bunch.

0 Likes