I'm having some problems exporting some adjusted layers in a DWG format from a Revit model. The project we're working on is using the duct families as place holders for future content. For this reason, we need to adjust the layer name and projection color ID on the export for the duct and duct fitting families in the project.
I initially looked at the LayerMapping property within the DWGExportOptions class, but found it only pointed at the standards and couldn't find a way to adjust single categories.
After spinning my wheels there, I started looking at SetExportLayerTable Method. I've tried setting up KeyValuePairs for single category overrides and adding them to the table, but doing so actually caused the exports to inherit subcategory values from object styles as the layer names and the one override I tried didn't work. (code below)
DWGExportOptions optDWG = new DWGExportOptions();
foreach (View3D vt in collection)
if (vt.Name.Contains("xxxxxxxx"))
{
ViewSet viewsToExport = new ViewSet();
viewsToExport.Insert(vt);
ICollection<ElementId> exportViews = new List<ElementId>();
foreach (View view in viewsToExport)
{
exportViews.Add(view.Id);
}
ExportLayerKey layerKey = new ExportLayerKey();
layerKey.CategoryName = "Ducts";
ExportLayerInfo layerInfo = new ExportLayerInfo();
layerInfo.LayerName = "E-DUCT-BANK";
layerInfo.ColorNumber = 1;
ExportLayerTable layerTable = new ExportLayerTable();
layerTable.Add(layerKey,layerInfo);
string viewName = vt.Name.Replace("xxxxxxxx", DateTime.Now.ToString("yyyyMMdd"));
optDWG.ExportOfSolids = SolidGeometry.ACIS;
optDWG.SharedCoords = true;
optDWG.PropOverrides = PropOverrideMode.ByLayer;
optDWG.LayerMapping = "AIA";
optDWG.SetExportLayerTable(layerTable);
doc.Export(folderNameDWG, viewName, exportViews, optDWG);
Can someone please help me understand what steps I would need to take to utilize the AIA standards for dwg layer naming on the exports by default and only override select categories to override color and layer name?
-Jared
Solved! Go to Solution.
I found the solution in the GetPredefinedOptions method within the DWGExportOptions class. I just used the method to pass in the settings that the user had set up in the project and it worked fine.
TomRam,
I work in a significant number of models on the day to day basis that have varying contractual requirements for what layer name, export color, line type etc the exports needed to have. So what I ended up doing was having project leads define their export settings in the project using the Modify DWG/DXF Export Setup like they would if they manually exported, save the settings with a specific title, then email me the title.
So if they emailed me and said my export setup is called "Standard Export Setup", when it came time to use the export method, it would look like
Document.Export(folderName, viewName, exportViewCollection, DWGExportOptions.GetPredefinedOptions(Document,"Standad Export Setup"));
Reply to this if you need more information
-JRegan