|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
|
Hello
I am creating a small script that needs to read matrix3 values from a file but I cannot convert them back to matric format as they save to file as string.
They appear as “(matrix3[.........])"”
(the double quote is from the listener)
any idea?
Nir
|
|
|
|
I know everyone says “never use the execute command” but in this case it really does the trick for you.
matrix3String = "(matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0])" --This is essentially how you have read it in from the file "(matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0])" --Listener Output
execute matrix3String
(matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0]) --Listener Output
Hope that gets you what you need!
thedour.net
Render 3D @ ScriptSpot.com
|
|
|
|
|
will try thanks
Nir
Author: nirsul
|
| Replied: 19 April 2010 03:51 AM
|
|
|
|
|
Execute? A simple readValue should work.
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
| Attachment
|
|
|
|
|
|
|
never used readValue actually.... nice
Author: thedour
|
| Replied: 19 April 2010 04:26 AM
|
|
|
|
|
Thanks
I manged to do it with an embedded execute like this:
(execute (execute viewval))
where viewval = “"(matrix3 [0.707107,0.353553,-0.612372] [-0.707107,0.353553,-0.612372] [0,0.866025,0.5] [-73.7862,38.0014,-166.667])"”
|
|
|
|
Maybe I’ve got the problem… I guess (watching this double quote) so your matrix3 data is formated as string to external file (as in the third example - “text3.txt") and you read it back from the file using readLine(), right?
myVar = Matrix3 1 --> (matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0])
file1 = createFile "C:\\test1.txt" format "%\n" myVar to:file1
close file1
file2 = createFile "C:\\test2.txt" print myVar to:file2
close file2
file3 = createFile "C:\\test3.txt" print (myVar as string) to:file3
close file3
f = openFile "C:\\test3.txt" mode:"r+" getVar = readLine f --> ""(matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0])"" close f
If this is the case you can solve it using readValue() as Steve suggest, like this --
f = openFile "C:\\test3.txt" mode:"r+" getVar = readValue ((readValue f) as stringStream)
close f
Max 9 through 2009, XP-Pro x64 SP2
ASUS EAH3450 Series (Driver 8.470).
Core 2 Duo E8400 3GHz, 4Gb Ram, DX9.0c.
| Attachment
|
|
|
|
|
|