Enabling DGN files with any file extension
To enable DGN files, follow these steps:
-
Instantiate a CAD Workspace Factory.
-
Cast the workspace factory to the ICadSettings interface.
-
Set the EnableAllDgnFileExtensions property to true to enable support to examine all files for the DGN format.
See the following code:
[C#] //Set CadSettings to a new CadWorkspaceFactory.
ESRI.ArcGIS.DataSourcesFile.ICadSettings pCadSettings=new
ESRI.ArcGIS.DataSourcesFile.CadWorkspaceFactory()as
ESRI.ArcGIS.DataSourcesFile.ICadSettings;
//Enable support to examine all files for DGN format.
pCadSettings.EnableAllDgnFileExtensions=true;
//Print the results to the console.
Console.WriteLine("EnableAllDgnFileExtensions={0}",
pCadSettings.EnableAllDgnFileExtensions);
[VB.NET] 'Set CadSettings to a new CadWorkspaceFactory.
Dim pCadSettings As ESRI.ArcGIS.DataSourcesFile.ICadSettings=TryCast(New ESRI.ArcGIS.DataSourcesFile.CadWorkspaceFactory(), ESRI.ArcGIS.DataSourcesFile.ICadSettings)
'Enable support to examine all files for DGN format.
pCadSettings.EnableAllDgnFileExtensions=True
'Print the results to the console.
Console.WriteLine("EnableAllDgnFileExtensions={0}", pCadSettings.EnableAllDgnFileExtensions)
To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
- ESRI.ArcGIS.System (ESRI.ArcGIS.esriSystem)
- ESRI.ArcGIS.Version (ESRI.ArcGIS)
- ESRI.ArcGIS.DataSourcesFile
- ESRI.ArcGIS.Geodatabase
Development licensing | Deployment licensing |
---|---|
ArcGIS Desktop Basic | ArcGIS Desktop Basic |
ArcGIS Desktop Standard | ArcGIS Desktop Standard |
ArcGIS Desktop Advanced | ArcGIS Desktop Advanced |