Bake brep with coloured faces

I hope someone can help with this query.
In Rhino, I can subselect the faces of a brep and assign them different materials, see the screenshot, this is a closed polysrf.
In Grasshopper I can deconstruct the brep and custom preview the faces in different colours. Or I can assign the faces different colours with elefront and bake them into Rhino as seperate surfaces. BUt then if i re-join them in Rhino they of course all become the same material again.

What I would be really interested to know is, does anyone have a method for assigning colours to the brep faces in grasshopper and baking that into Rhino so that it is closed but has the different colours/materials on the different faces?


Minimum just as a POC:
2022-09-20 17_33_05-Window (12.7 KB)

I’m pretty sure there is no per-face-colors on native GH breps…


 private void RunScript(bool bake, List<Brep> B, List<System.Drawing.Color> C)
    brep = Brep.JoinBreps(B, this.RhinoDocument.ModelAbsoluteTolerance)[0];
    for(int i = 0;i < C.Count;i++){
      brep.Faces[i].PerFaceColor = C[i];
      GrasshopperDocument.ScheduleSolution(5, SolutionCallback);}
  // <Custom additional code> 
  Rhino.Geometry.Brep brep;
  private void SolutionCallback(GH_Document doc){

Wow, that is just what I needed.
Thank you very much!