Paddon
07-26-2007, 02:03 PM
Hey all,
I am a bit of a newb in the MEL world, but not the programming one. I am a computational physicist and I was hoping to use Maya to achieve some of the more intensive visualizations we would like to employ. I am just starting from the begining right now so all I would like to do is read in a data file that contains nothing but coordinates and plot them in the Maya scene. From there I would like to move on to reading seperate files and having each be a key frame. This is the code I attempted just from reading MEL api and the few tutorials I could find on the web. Below the code I posted and example file for reading in.
$fileId=`fopen "(absolute path here)" "r"`;
$x = 0.0;
$y = 0.0;
$z = 0.0;
$index = 0;
$numParticles = 2;
while ( $index < $numParticles ) {
$x = `fread $fileId $x`;
$y = `fread $fileId $y`;
$z = `fread $fileId $z`;
sphere -r 2 -px $x -py $y -pz $z -name $index;
}
fclose $fileId;
[code]
1 0 1
0 1 0
0 2 1
3 5 8
0 5 4
7 8 4
..
..
..
[code]
Any help would be greatly appreciated.
I am a bit of a newb in the MEL world, but not the programming one. I am a computational physicist and I was hoping to use Maya to achieve some of the more intensive visualizations we would like to employ. I am just starting from the begining right now so all I would like to do is read in a data file that contains nothing but coordinates and plot them in the Maya scene. From there I would like to move on to reading seperate files and having each be a key frame. This is the code I attempted just from reading MEL api and the few tutorials I could find on the web. Below the code I posted and example file for reading in.
$fileId=`fopen "(absolute path here)" "r"`;
$x = 0.0;
$y = 0.0;
$z = 0.0;
$index = 0;
$numParticles = 2;
while ( $index < $numParticles ) {
$x = `fread $fileId $x`;
$y = `fread $fileId $y`;
$z = `fread $fileId $z`;
sphere -r 2 -px $x -py $y -pz $z -name $index;
}
fclose $fileId;
[code]
1 0 1
0 1 0
0 2 1
3 5 8
0 5 4
7 8 4
..
..
..
[code]
Any help would be greatly appreciated.
