Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Maya Script reading txt-file and interpret data (https://simplymaya.com/forum/showthread.php?t=62281)

AverageRigger 28-10-2020 04:53 PM

Maya Script reading txt-file and interpret data
 
Hello world!
I am currently experimenting with txt files inside maya. F.e.
"
1 sphere
2 cube
3 cylinder
4 cone
5 plane

"

The left column reflects a frame number and the right an objectname.
I want to read the file and interact with an object only for a specific frame. For example switching the visibility of an object on and off.

this is what i got so far:

fileHandle = open('c:\\text.txt', 'r' )
str1 = fileHandle.read()
fileHandle.close()
print str1

(This doesn't have to be written in Python. MEL is perfect aswell)
I know how to read the file and save it to an string but not how to navigate inside.
Perhaps someone is experienced enough to help :)
Thank you very :bounce:

AverageRigger 30-10-2020 10:30 AM

Quote:

Originally Posted by AverageRigger (Post 382461)
Perhaps someone is experienced enough to help :)
Thank you very :bounce:

After a short research i found the answer! If anyone else needs it :)
https://knowledge.autodesk.com/suppo...A7495-htm.html

This is the way! :ninja:


All times are GMT. The time now is 06:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018