Max Script to python script translation

Max Script to python script translation

Anonymous
Not applicable
1,069 Views
1 Reply
Message 1 of 2

Max Script to python script translation

Anonymous
Not applicable

I have made a max script which replace path of render element of max file with some path but i need to make it in python . I  am unable to convert that max script in python script . Can anyone help me to convert it python script ?

to_replace_var = "C:/user/test/"

theManager = maxOps.GetRenderElementMgr #Production theManager.numrenderelements() for n = 0 to (theManager.numrenderelements () - 1) do ( el = re.getrenderelement n path_element = re.GetRenderElementFileName n from_replace_var = getFilenamePath path_element main_path = substituteString path_element from_replace_var to_replace_var element_name = re.SetRenderElementFilename n (main_path) )
0 Likes
1,070 Views
1 Reply
Reply (1)
Message 2 of 2

morten_bohne
Advocate
Advocate

i'm guessing your troubles are in the line:

theManager = maxOps.GetRenderElementMgr #Production

the #Production thing is really not that obvious (or well documented last time i checked) but the way to do it would be to use pymxs.runtime.name("Production")

from pymxs import runtime as rt
theManager = rt.maxOps.GetRenderElementMgr(rt.name("Production"))

hope it helps 🙂