Get/assign materials to individual faces

This post Possible to color individual BrepFace? asks the same question, and the answer is that it will be available in Rhino 6. That’s now! :tada:

I’m attempting to do the same thing: assigning and querying the material for individual brep faces, but I haven’t been able to figure it out.
I would imagine a MaterialRef would hold both the material, the guid for the brep and a face index. But I don’t see that being the case here: https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_DocObjects_MaterialRef.htm

Additionally I don’t understand how to query the MaterialRefs table. If it is a table at all?

Any advice would be greatly appreciated. Thanks!

Found it: using the ComponentIndex is the correct way.

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_DocObjects_RhinoObject_GetMaterial_1.htm