RVTDocs.com
Namespace: Autodesk.Revit.DB

ExportLayerInfo

Class
Description:
A value used to represent the info stored in the .
Inheritance Hierarchy:
System.Object
  Autodesk.Revit.DB.ExportLayerInfo
Syntax
public class ExportLayerInfo : IDisposable
Examples
public bool ExportDWGModifyLayerTable(Document document, View view)
{
    bool exported = false;
    IList<string> setupNames = BaseExportOptions.GetPredefinedSetupNames(document);
    if (setupNames.Count > 0)
    {
        // Get the export options for the first predefined setup
        DWGExportOptions dwgOptions = DWGExportOptions.GetPredefinedOptions(document, setupNames[0]);

        // Get the export layer table
        ExportLayerTable layerTable = dwgOptions.GetExportLayerTable();

        // Find the first mapping for the Ceilings category
        string category = "Ceilings";
        ExportLayerKey targetKey = layerTable.GetKeys().First<ExportLayerKey>(layerKey => layerKey.CategoryName == category);
        ExportLayerInfo targetInfo = layerTable[targetKey];

        // change the color name and cut color number for this mapping
        targetInfo.ColorName = "31";
        targetInfo.CutColorNumber = 31;

        // Set the change back to the map
        layerTable[targetKey] = targetInfo;

        // Set the modified table back to the options
        dwgOptions.SetExportLayerTable(layerTable);

        ICollection<ElementId> views = new List<ElementId>();
        views.Add(view.Id);

        exported = document.Export(Path.GetDirectoryName(document.PathName),
            Path.GetFileNameWithoutExtension(document.PathName), views, dwgOptions);
    }

    return exported;
}