//设置实体颜色
public void SetElementColor(Element element, RvtDb.Color color)
{
if (element == null || color == null)
return;
OverrideGraphicSettings ogs = new OverrideGraphicSettings();
#if _REVIT2018_
ogs.SetProjectionLineColor(color); //投影表面线的颜色
ogs.SetCutFillColor(color); //切割面填充颜色
#else
ogs.SetProjectionLineColor(color); //投影表面线的颜色
ogs.SetCutForegroundPatternColor(color); //切割面填充颜色
#endif
List<RvtDb.View> views = GetElements<RvtDb.View>(element.Document);
foreach (RvtDb.View view in views)
{
if (view.ViewType != ViewType.FloorPlan && view.ViewType != ViewType.ThreeD)
continue;
view.SetElementOverrides(element.Id, ogs);
}
}