1、“图形” 页
Material Color类;
2、“外观”页
AppearanceAssetElement类。
修改元素轮廓线颜色
Color red = new Color(227, 23, 13); Color orange = new Color(255, 97, 0); Color green = new Color(50, 205, 50); ElementId Sen1 = new ElementId(381608); ElementId Sen2 = new ElementId(381609); ElementId Sen3 = new ElementId(381610); ElementId Sen4 = new ElementId(381611); OverrideGraphicSettings ogsred = new OverrideGraphicSettings(); ogsred.SetProjectionLineColor(red); doc.ActiveView.SetElementOverrides(Sen1, ogsred);
//更改材质颜色的方法 public static void ChangeColor(Document doc, Color color, Element elem) { ICollection<ElementId> ids = elem.GetMaterialIds(false); ElementId matid = null; if (ids.Count == 1) { foreach (ElementId i in ids) { matid = i; Material mat = doc.GetElement(i) as Material; mat.Color = color; } } else { TaskDialog.Show("错误", "您的构件可能有多个材质或者没有材质!"); } } #endregion