Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 20.0.0.0 (20.0.0.377)
Since:
2014
Syntax
Visual Basic |
---|
Public Class ExportLayerInfo _
Implements IDisposable |
Visual C++ |
---|
public ref class ExportLayerInfo : IDisposable |
Examples
CopyC#
public bool ExportDWGModifyLayerTable(Document document, View view)
{
bool exported = false;
IList<string> setupNames = BaseExportOptions.GetPredefinedSetupNames(document);
if (setupNames.Count > 0)
{
DWGExportOptions dwgOptions = DWGExportOptions.GetPredefinedOptions(document, setupNames[0]);
ExportLayerTable layerTable = dwgOptions.GetExportLayerTable();
string category = "Ceilings";
ExportLayerKey targetKey = layerTable.GetKeys().First<ExportLayerKey>(layerKey => layerKey.CategoryName == category);
ExportLayerInfo targetInfo = layerTable[targetKey];
targetInfo.ColorName = "31";
targetInfo.CutColorNumber = 31;
layerTable[targetKey] = targetInfo;
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;
}
CopyVB.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
Dim dwgOptions As DWGExportOptions = DWGExportOptions.GetPredefinedOptions(document, setupNames(0))
Dim layerTable As ExportLayerTable = dwgOptions.GetExportLayerTable()
Dim category As String = "Ceilings"
Dim targetKey As ExportLayerKey = layerTable.GetKeys().First(Function(layerKey) layerKey.CategoryName = category)
Dim targetInfo As ExportLayerInfo = layerTable(targetKey)
targetInfo.ColorName = "31"
targetInfo.CutColorNumber = 31
layerTable(targetKey) = targetInfo
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
Inheritance Hierarchy
See Also