How to access the WorkingPivot in Python?

How to access the WorkingPivot in Python?

Tupaia
Advocate Advocate
772 Views
3 Replies
Message 1 of 4

How to access the WorkingPivot in Python?

Tupaia
Advocate
Advocate

Hello!

I have zero max script experience, but some with Python, from other 3d applications.

My goal is to write a simple Python script that activates the WorkingPivot and auto-aligns it to the Transform Gizmo, among other things.

 

Im max script, this activates the WP:

WorkingPivot.EditMode = true

 

However, I can't figure how to do the same in Python, not counting this:

MaxPlus.Core.EvalMAXScript("WorkingPivot.EditMode = true")

 

 

What's the 'clean' way of accessing Max' core interface functionality?

 

Thanks a lot!

0 Likes
Accepted solutions (1)
773 Views
3 Replies
Replies (3)
Message 2 of 4

Swordslayer
Advisor
Advisor
Accepted solution

I'd use the pymxs.runtime MAXScript engine wrapper. For example, the sample of activating the working pivot mode you used would be:

 

pymxs.runtime.workingPivot.editMode = True
0 Likes
Message 3 of 4

Tupaia
Advocate
Advocate

That's clean enough for me!

Thank you, Sir! 😃

 

0 Likes
Message 4 of 4

denisT.MaxDoctor
Advisor
Advisor

i don't mess with Max Python, but it should be an API solution as well, where c++ is:

void SetWorkingPivotUseMode(BOOL use)
{
	IWorkingPivot* pvi = (IWorkingPivot*)(GetCOREInterface(IWORKINGPIVOT_INTERFACE));
	pvi->SetUseMode(use);
}

 

0 Likes