@BIMadmin Here is a working Python script to get the information on the Layers tab in the Modify DWG/DXF Export Setup window:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
settings = IN[0]
if not isinstance(settings,list):
settings = [settings]
def getExportInfo(set):
cattype = []
category = []
subcategory = []
colorname = []
colornumber = []
cutcolornumber = []
cutlayername = []
layername = []
options = set.GetDWGExportOptions()
table = options.GetExportLayerTable()
keys = table.GetKeys()
for key in keys:
category.append(key.CategoryName)
subcategory.append(key.SubCategoryName)
layerinfo = table.GetValues()
for i in layerinfo:
cattype.append(i.CategoryType)
colorname.append(i.ColorName)
colornumber.append(i.ColorNumber)
cutcolornumber.append(i.CutColorNumber)
cutlayername.append(i.CutLayerName)
layername.append(i.LayerName)
return zip(cattype,category,subcategory,layername,colorname,colornumber,cutlayername,cutcolornumber)
exportSettings = [getExportInfo(UnwrapElement(i)) for i in settings]
OUT = exportSettings
You’ll notice this output is not sorted by Category Type or Category so you’ll want to do some post processing (either in Dynamo, which I’d recommend for practice, or in Excel when you’ve exported it).
To get the information from the Lines and Patterns tab, you’d follow a similar workflow with the relevant API methods. This script is a bit more complex because it is made to work for a single DWGExportSettings element or a list; I hope it helps!