PDA

View Full Version : How to print separate lines


chuachinghong
10-19-2008, 09:39 AM
Hi, I am very new to MEL script.

I have a simple NURBS plane and I use this command to query the world CV positions:

getAttr surfaceInfo.controlPoints["*"];

The results I got is
X1 Y1 Z1 X2 Y2 Z2 X3 Y3 Z3 ...

I need to print it out in this format:
X1 Y1 Z1
X2 Y2 Z2
X3 Y3 Z3

May I know how should I approach this?
Hope you guys can help me. Thanks!

Robert Bateman
10-20-2008, 11:49 AM
$cvs = `getAttr surfaceInfo.controlPoints["*"]`;
for(int $i=0;$i<size($cvs);$i+=3)
{
print ($cvs[$i] + " " +$cvs[$i+1] + " " +$cvs[$i+2] + "\n");
}

CGTalk Moderation
10-20-2008, 11:49 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.