Autodesk.Revit.DB.ExportLayerInfo
类表示要导出到DWG或DXF格式的Revit文档中的图层信息。该类包含以下属性:
以下示例展示了如何获取文档中所有图层的ExportLayerInfo
对象:
UIDocument uidoc = this.ActiveUIDocument;
Document doc = uidoc.Document;
List<ExportLayerInfo> layerInfos = new List<ExportLayerInfo>();
FilteredElementCollector collector = new FilteredElementCollector(doc);
ICollection<Element> elements = collector.OfClass(typeof(View)).ToElements();
foreach (Element element in elements)
{
View view = element as View;
if (view == null || !view.CanBePrinted || view.ViewType != ViewType.FloorPlan)
continue;
ExportLayerInfo[] viewLayerInfos = view.GetExportLayerInfo();
foreach (ExportLayerInfo layerInfo in viewLayerInfos)
{
if (!layerInfos.Contains(layerInfo))
layerInfos.Add(layerInfo);
}
}