Revit的构件颜色常见有三种。
1、材质颜色
2、视图的可见性过滤器
3、管道系统的特殊颜色
从我的作品中摘抄片段吧
1、获取构件材质
必须按面去获取
material = m_Document.GetElement(face.MaterialElementId) as Material;
2、获取过滤器的颜色
ICollection<ElementId> filterIds = v.GetFilters();
filterColors.Clear();
foreach (ElementId id in filterIds)
{
filterColors.Add(doc.GetElement(id) as ParameterFilterElement);
}
3、管道系统的材质颜色
if (elem is MEPCurve)
{
Parameter pm = elem.get_Parameter(BuiltInParameter.RBS_PIPING_SYSTEM_TYPE_PARAM);
if (pm != null)
{
MEPSystemType p = m_Document.GetElement(pm.AsElementId()) as MEPSystemType;
if (p != null)
{
Parameter mtrid = p.get_Parameter(BuiltInParameter.MATERIAL_ID_PARAM);
if (mtrid != null)
{
return m_Document.GetElement(mtrid.AsElementId()) as Material;
}
}
}