PDA

View Full Version : MEL: line break


zworp
01-22-2003, 12:58 PM
hmm here I go again, sorry :rolleyes:

how do I start i new line when I'm writing text to a file?

my humble code:
---------------------
$fileId=`fopen $FileName "w"`;
fprint $fileId ( $svar[0] + ".x" + " = " + $obj1x + "f;" );
fprint $fileId ( $svar[0] + ".y" + " = " + $obj1y + "f;" );
fprint $fileId ( $svar[0] + ".z" + " = " + $obj1z + "f;" );
fclose $fileId;
----------------------

result:
pCylinder1.x = -5.834730367f;pCylinder1.y = 1.956431688f;pCylinder1.z = 4.367406601f;

and I want it to look like this:
pCylinder1.x = -5.834730367f;
pCylinder1.y = 1.956431688f;
pCylinder1.z = 4.367406601f;

alexx
01-22-2003, 02:02 PM
how bout adding a "\n" behind :)

zworp
01-22-2003, 03:45 PM
doesn work for me, i only get this wierd symbol, if I paste the symbol in this window(webbrowser) i get a new line but in notepad it doesn work.

Razvan
01-22-2003, 05:03 PM
Try "\r\n" instead of just "\n".

zworp
01-22-2003, 05:31 PM
ahh that worked,
great! thanks

alexx
01-22-2003, 09:13 PM
hmm..
you should think about getting a more flexible text-editor if you plan to do more mel scripting..
try ultra edit with the MEL syntax highlighting from highend.3d
that one will display the \n as a newline.

if you add the \r\n like suggested by razvan, be sure to strip them both if you ever read that file in maya again.. otherwise you might get into trouble..

but if you use notepad: use \r\n

cheers

alexx

CGTalk Moderation
01-14-2006, 05:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.