Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Maya reading txt extremely slow (from script)

Maya reading txt extremely slow (from script)

nizrock
Explorer Explorer
468 Views
1 Reply
Message 1 of 2

Maya reading txt extremely slow (from script)

nizrock
Explorer
Explorer

So I've tried to wrote script that need to read some txt file. Just trying to open it and assign to string variable (Need to edit it next). The smallest file weights 25kb and has 670 lines.  Maya just freezes every time.

 

//Proc for read files and give me a string    
proc string ReadFile(string $FilePath)     {
    int $MyFileID = `fopen $FilePath "r"` ;   
    string $WholeFile ="";   
    while(!feof($MyFileID))
        $WholeFile = $WholeFile + (`fgetline $MyFileID`);
    } 
    fclose $MyFileID;
    return($WholeFile);
}

string $Text = `ReadFile("D:\Test.txt")`;
print $Text;

 

469 Views
1 Reply
Reply (1)
Message 2 of 2

malcolm_341
Collaborator
Collaborator

I'm finding the same issue, any way to read a text file quickly through Mel?

0 Likes