You are currently reviewing an older revision of this page.
Similar to levels (see here), you can also change the color of elements to either a color index from the color table or any RGB value assigned. To put these RGB values onto the color index, you can use the following approach. Note that the following is modified exclusively for non-complex structures, so it will not change any cells or any other nested elements.
Dim eE As ElementEnumeratorSet eE = ActiveModelReference.GraphicalElementCache.ScanDo While eE.MoveNext With eE.Current If (.Color > 255) And (.Type <> 2) Then .Color = ActiveModelReference.InternalColorToIndexedColor(.Color) .Rewrite End If End WithLoop