Create material not visible in Rhino

Hi,

I’m trying to add a new material but its not showing… The MaterialIndex is changing if I add more… why?


    Dim Mat As New DocObjects.Material
            Mat.Default()
            Mat.AmbientColor = Drawing.Color.Red
            Mat.Name = "MeshMat"
            Mat.CommitChanges()
            Dim MatInt As Integer = doc.Materials.Add(Mat)

–EDIT:
Seems I was using Rhinodoc.Activedoc.Materials somewhere. When I changed it to doc.materials it started working… It’s “Solved”