Face Axis Compare?

Hi! I working on a oil refinery model so I'm trying to make an automatic pipe script. This is my first attempt at MEL and I have the first part working.

I need to know how to evaluate the axis of a single face and then compare to some xyz coords to change direction. something like this:

if (selected Face AXIS) xyz = 0 1 0 then set corner rotation to z;

if (selected Face AXIS) xyz = 1 0 0 then set corner rotation to y;

etc...

I just can't figure what commands to use to get the (selected Face AXIS) xyz, AND compare it to my own xyz (0 1 0) options.

I want to create hot keys for extrude and corners of a pipe, sort of like the MS Windows pipe screen saver.
here's the first part of the script that will make a corner pipe in one direction:

// select the top single face of a cylinder, it will make a 90 degree corner pipe.
float $TransZ; $TransZ = 2; // size of bend
string $strSelObj[] = ls -sl;
{
for ($laps = 0; $laps <= 3; $laps++ ) // number of bend sections
{
polyExtrudeFacet -keepFacetTogether true
-localTranslateZ $TransZ
-lry 22.5; // rotate sections to 90
}
}

well, the most straight forward way to get the face's "Axis" (known as it's "normal") is to use the polyInfo command with the -fn flag.

CODE
polyInfo -fn pCylinder1.f[17];
// Result: FACE_NORMAL     17: 0.000000 1.000000 0.000000

however, it returns a formatted string array (for some dumb-ass reason) so you'll need to tokenize it...
CODE
{
    string $fNormal[] = polyInfo -fn pCylinder1.f[17];
    string $tokens[5];
    tokenize $fNormal[0] $tokens;
    vector $FN = <>;
}

:nathaN

Thanks for the quick responses! I tired to

it's really important that you understand scope if you want to use MEL effectively.
any variable declared after an open curly brace { ONLY EXISTS inside that block of braces. when the block is closed with a close brace } ALL THOSE variables inside are destroyed.

CODE
float $varA;
{
    float $varB = 1.5;
    float $varC = 9.99;
    $varA = 5.0;
}

print $varA;
print $varB;
print $varC;

$varB and $varC now no longer exist, whereas $varA does, because it was declared OUTSIDE the curly braces.
also, you must always refer to vectors using the correct syntax for vectors <>

if ($FN = <>) print "worked!";

hope this helps sort you out (but this basic stuff is all explained really well and very clearly in Maya's built-in MEL docs...)
:nathaN

Thanks Naughty! that worked great! I'll post my script in a few days, once I've done more testing. : )