[Closed] Does anyone have this script?
… is likely due to tuse of quatToEuler2; that’s only available in 3ds Max 2008/2009; I suspect you’re using an older version of 3ds Max.
You may wish to hit www.maxplugins.de and download the AVG maxscript extension; that’s where quatToEuler2 existed before it was merged into the base 3ds Max package.
That’s the easiest route to fix that problem, anyway
hm… what do you get when you walk through things step-by-step?
( removed the loop so that you can get step-by-step output in the following )
-- blue text is Listener output
txt = ""
""
i = selection[1]
$Plane:Plane01 @ [-0.250304,6.708603,-0.003511]
txt += (i.name + " = " + ((i.transform.position) as string) +" "+ ((quattoeuler2 (i.transform.rotation)) as string) + "
")
"Plane01 = [-0.250304,6.7086,-0.00351107] (eulerAngles -1.34033 51.4492 -179.601)
"
f = createfile "c:\ emp\\file.txt"
<File:c: emp\file.txt>
format txt to: f
OK
close f
OK
It’s barfing on this line:
txt += (i.name + ” = ” + ((i.transform.position) as string) +” “+ ((quattoeuler2 (i.transform.rotation)) as string) + “
“)
[size=1]– Error occurred in anonymous codeblock
[/size][size=1]– Frame:
– quattoeuler2: undefined
[/size][size=1]– Type error: Call needs function or class, got: undefined
[color=white]I’m running Max 2009, not sure why this is undefined.
[/color][/size]
Are you sure it’s not the createfile that’s giving the error? Remember to change the path to one you use and know it exists… for example:
txt = ""
for i in selection do
(
txt += (i.name + " = " + ((i.transform.position) as string) +" "+ ((quattoeuler2 (i.transform.rotation)) as string) + "
")
)
f = createfile "C:\\file.txt"
format txt to: f
close f
The create file section works fine, it is still giving me the problem here:
[size=1]txt += (i.name + ” = ” + ((i.transform.position) as string) +” “+ ((quattoeuler2 (i.transform.rotation)) as string) + “
“)
[/size][size=1]– Error occurred in anonymous codeblock
[/size][size=1]– Frame:
– quattoeuler2: undefined
[/size][size=1]– Runtime error: Attempt to access deleted scene object
[/size]
Hmm, it works now, but I had to change quattoeuler2 to quattoeuler.
I do have another question:
The output format, I eventually have to feed the position and rotation values into an xml file, in a specific format.
Example: (from the maxscript)
NH_Arch01 = [148.44,142.466,-5.88535] (eulerAngles 0 0 -90)
I have to plug the values into this xml document manually:
[size=2]posX[/size][size=2]=[/size]”[size=2]148.44[/size]”[size=2] [/size][size=2]posY[/size][size=2]=[/size]“142.466”[size=2] [/size][size=2]posZ[/size][size=2]=[/size]”-[size=2]5.88535[/size]”[size=2] [/size][size=2]rotX[/size][size=2]=[/size]”[size=2]0[/size]”[size=2] [/size][size=2]rotY[/size][size=2]=[/size]”[size=2]0[/size]”[size=2] [/size][size=2]rotZ[/size][size=2]=[/size]”[size=2]-90[/size]”
Could the script be modified to this format on output?
P.S. Thank you all for the help.