AutoCAD 2010 DWG Export

Today is a public holiday in Neuchâtel, the jeûne fédéral or Federal Fast holiday. I will use that for a hike in the Swiss mountains, that I so sorely neglected and missed this summer.

Meanwhile, here is a simple question on the AutoCAD file format version used for DWG export.

Question: How can I set the AutoCAD 2010 version as the destination file format for DWG export?

The ACADVersion enumeration only has options for 2000, 2004, and 2007.

In the user interface, it is possible to select 2010 as well.

Answer: Looking at the ACADVersion enumeration, I see the following entries:

The AutoCAD 2010 file format was recently added as another format in the DWG export options. It is currently created by specifying the 'Default' value.

Because this is a simple enum wrapper, you can also cause Revit to export the AutoCAD 2010 file format by passing in '4' to the options settings. Using Reflector, you can see that the numerical values of the existing entries are 0-3, which makes it very probable that 4 is the next one. In any case it worked, for example, using the following code:

  DWGExportOptions options = new DWGExportOptions();
 
  options.FileVersion = ( ACADVersion ) ( 4 );
 
  ViewSet views = new ViewSet();
 
  views.Insert( uiDoc.Document.ActiveView );
 
  uiDoc.Document.Export( @"d:\temp", @"junk.dwg", 
    views, options );

This creates a resulting DWG file in AutoCAD 2010 file format with a header of ac1024, equal to the ObjectARX enum value kDHL_1024 = 29, which stands for '2010 final'.

As said, ACADVersion.Default also results in an AutoCAD 2010 file format DWG, but that will obviously change in future releases.

Casting an integer to an enum value to pass into the settings is obviously not an officially supported way of using the Revit API, but it might help you get around this in the short term.