Maya for 3D Printing - Rapid Prototyping
In this course we're going to look at something a little different, creating technically accurate 3D printed parts.
# 1 22-02-2016 , 11:53 PM
Registered User
Join Date: Feb 2016
Posts: 1

load variables from a text file

hello everyone, I need your help.
As indicated in the title, I want to load variables from a text file. I'm writing a single script.
At first, I generate a text file "C:/tmp/variable.txt" , (with a fopen) in which there is this:

string $VARMAX[] = {"nurbsSphere1","pCube1","nurbsCone2"};

secondly, I load it:
source "C:/tmp/variable.txt";
print $VARMAX;


it is now that the problem happens. If my file "C:/tmp/variable.txt" doesn't yet exist, Maya will tell me 'Cannot find file'. Logic.

So I try to put the command in a 'evalEcho',

pause -sec 1;
evalEcho "source \"C://xdk//variable.txt\";";
print $VARMAX;


I have this message: // Error: Line 3.14: "$VARMAX" is an undeclared variable. //
as if it was a procedure.

I need to have this text file to use it instantly or later.

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads