Here's a sample proc that might help answer both your questions...
Basically you want to create a "renderable" set, and connect it to a shading node (this is how the "assignment" of the shader to those faces is done):
/*
Example usage:
string $shape = "pSphere1";
string $facesetAttrName = "yourFacesetAttr";
int $faceIDs[] = getAttr($shape+"."+$facesetAttrName);
createShaderFromFaceIDs($shape, $faceIDs, "lambert");
*/
global proc createShaderFromFaceIDs(string $shape, int $faceIDs[], string $shaderType)
{
// Create a new set for this shader
string $sSet = `sets -r true -nss true -em -n "shaderSet"`;
// Create a shadingnode and connect it to the set
string $sNode = `shadingNode -as $shaderType -n ($sSet + "_shader")`;
connectAttr -f ($sNode + ".outColor") ($sSet + ".surfaceShader");
// Add each face to the set
for ($faceID in $faceIDs)
{
sets -fe $sSet ($shape+".f["+$faceID+"]");
}
}
Obviously if you were writing a script to re-assign shaders to facesets after loading an abc file into maya, you'd want to loop over all the shapes, and for each shape loop over all the facesets (presumably naming the shaders more appropriately to match the faceset names).
Francois.