RevitAPI: How to get DWGExportOptions

By Aaron Lu

As we know we can export DWG from Revit, before exporting we can config some settings, question is how to access DWGExportOptions in Revit?

Since DWGExportOptions inherits from Element, we can use ElementFilter to filter it.

after that we can call ExportDWGSettings.GetDWGExportOptoins() to get the entry point of all information related with DWG export, below is the example code on how to find ExportDWGSettings and how to get its layers information:

var dwgSettingsFilter =      new ElementClassFilter(typeof(ExportDWGSettings)); FilteredElementCollectorsettings =      new FilteredElementCollector(RevitDoc); settings = settings.WherePasses(dwgSettingsFilter); foreach (ExportDWGSetting selement in settings) {     var options = element.GetDWGExportOptions();     var layerTable = options.GetExportLayerTable();     foreach (var layerItem in layerTable)     {         var layerInfo = layerItem.Value;         if (layerInfo.CategoryType == LayerCategoryType.Model)         {             var modifiers = layerInfo.GetLayerModifiers();             foreach (var modifier in modifiers)             {                 // get modifier type                 var modifierType = modifier.ModifierType;                 // get separator                 var separater = modifier.Separator;              
}         }     } }

中文链接


Comments

2 responses to “RevitAPI: How to get DWGExportOptions”

  1. Dan Tartaglia Avatar
    Dan Tartaglia

    Hi,
    This is a great blog but you really need to make sure the code is put in the article correctly. It didn’t take me long to fix it but it may frustrate a new Revit API programmer.

  2. Thanks, did not aware the code format is destroyed by typepad. already updated.

Leave a Reply to Dan TartagliaCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading