fbitonti
12-31-2006, 03:57 AM
I am having a dificult time understanding the data types used when trying to query the color of a vertex. what kind of data is returned and how do you use it?
I am writing this littel script that querys a mesh loooking for a vertex in which the green attribute is equal to one.
The error I get is
// Error: Cannot use data of type float[] in a scalar operation. //
How do I convert the output into something that will work. I can't believe that I have never had to convert data types in mel before so i'm a bit lost. Thanks for any help you can give.
string $intSelection[] = `ls -sl -fl`;
polyColorPerVertex -g 1;
polySelectConstraint -m 3;
string $revSelection[] = `ls -sl -fl`;
// print $revSelection[0];
// print $revSelection[1];
// print $revSelection[2];
// print $revSelection[3];
select -cl;
//path to file
$filename = ("C:/2dTrussLoads.txt");
int $i;
// float $colorQuery;
// open the file for writing
$file = `fopen $filename "w"`;
global float $neigh1;
global float $neigh2;
// fprint
fprint $file ( "Nodal Loads" + "\n" );
while($i < size($revSelection)){
select -r $revSelection[$i];
//$colorQuery[0] = `polyColorPerVertex -q -g`;
if(`polyColorPerVertex -q -g` == 1){
fprint $file ( $neigh1 + "\n" );
fprint $file ( $neigh2 + "\n" );
}
if(`polyColorPerVertex -q -g` == 0){
fprint $file ( "0" + "\n" );
fprint $file ( "0" + "\n" );
}
$i = $i + 1;
}
// close file
fclose $file;
}
I am writing this littel script that querys a mesh loooking for a vertex in which the green attribute is equal to one.
The error I get is
// Error: Cannot use data of type float[] in a scalar operation. //
How do I convert the output into something that will work. I can't believe that I have never had to convert data types in mel before so i'm a bit lost. Thanks for any help you can give.
string $intSelection[] = `ls -sl -fl`;
polyColorPerVertex -g 1;
polySelectConstraint -m 3;
string $revSelection[] = `ls -sl -fl`;
// print $revSelection[0];
// print $revSelection[1];
// print $revSelection[2];
// print $revSelection[3];
select -cl;
//path to file
$filename = ("C:/2dTrussLoads.txt");
int $i;
// float $colorQuery;
// open the file for writing
$file = `fopen $filename "w"`;
global float $neigh1;
global float $neigh2;
// fprint
fprint $file ( "Nodal Loads" + "\n" );
while($i < size($revSelection)){
select -r $revSelection[$i];
//$colorQuery[0] = `polyColorPerVertex -q -g`;
if(`polyColorPerVertex -q -g` == 1){
fprint $file ( $neigh1 + "\n" );
fprint $file ( $neigh2 + "\n" );
}
if(`polyColorPerVertex -q -g` == 0){
fprint $file ( "0" + "\n" );
fprint $file ( "0" + "\n" );
}
$i = $i + 1;
}
// close file
fclose $file;
}
