How to retrieve the color of a point (in a BRep model)

How to retrieve the color of a point (in a BRep model)

1. Get the ModelData_BRepRepresentation of a part;
2. Get a list of all the Bodies that belong to this Part: ModelData_BodyList aBodyList = theBRep.Get();
3. Use Appearance(aBody) method of the ModelData_BRepRepresentation object to retrieve appearance of the Body;
4. Use ToColor method of the ModelData_Appearance object to get the color.

Here's an example of code for a viewer:
  1. class PartBRepVisitor : ModelData_Model.VoidElementVisitor
  2. {
  3.     public PartBRepVisitor()
  4.     {
  5.     }

  6.     public override void Apply(ModelData_Part thePart)
  7.     {
  8.         ModelData_BRepRepresentation aBRep = thePart.BRepRepresentation();
  9.         if (aBRep != null)
  10.         {
  11.             ExploreBRep(aBRep);
  12.         }
  13.     }

  14.     private void ExploreBRep(ModelData_BRepRepresentation theBRep)
  15.     {
  16.         ModelData_BodyList aBodyList = theBRep.Get();
  17.         for (uint i = 0; i < aBodyList.Size(); ++i)
  18.         {
  19.             ModelData_Body aBody = aBodyList.Access(i);
  20.             if (aBody.BodyType() == ModelData_BodyType.ModelData_BT_Acorn)
  21.             {
  22.                 ModelData_Appearance anApperance = theBRep.Appearance(aBody);
  23.                 ModelData_Color aColor = new ModelData_Color();
  24.                 anApperance.ToColor(aColor);
  25.                 Console.WriteLine(aColor.R());
  26.                 Console.WriteLine(aColor.G());
  27.                 Console.WriteLine(aColor.B());
  28.             }
  29.         }
  30.     }
  31. }