A value used to represent the info stored in the
ExportLayerTable
.
Namespace:
Autodesk.Revit.DB
Assembly:
RevitAPI
(in RevitAPI.dll) Version: 17.0.0.0 (17.0.484.0)
Since:
2014
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Examples
Copy
C#
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;
}
Copy
VB.NET
Public Function ExportDWGModifyLayerTable(document As Document, view As View) As Boolean
Dim exported As Boolean = False
Dim setupNames As IList(Of String) = BaseExportOptions.GetPredefinedSetupNames(document)
If setupNames.Count > 0 Then
' Get the export options for the first predefined setup
Dim dwgOptions As DWGExportOptions = DWGExportOptions.GetPredefinedOptions(document, setupNames(0))
' Get the export layer table
Dim layerTable As ExportLayerTable = dwgOptions.GetExportLayerTable()
' Find the first mapping for the Ceilings category
Dim category As String = "Ceilings"
Dim targetKey As ExportLayerKey = layerTable.GetKeys().First(Function(layerKey) layerKey.CategoryName = category)
Dim targetInfo As ExportLayerInfo = 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)
Dim views As ICollection(Of ElementId) = New List(Of ElementId)()
views.Add(view.Id)
exported = document.Export(Path.GetDirectoryName(document.PathName), Path.GetFileNameWithoutExtension(document.PathName), views, dwgOptions)
End If
Return exported
End Function