Autodesk.Revit.DB.DGNFileFormat是一个Revit API中的类,用于处理DGN格式的文件。
Autodesk.Revit.DB.DGNFileFormat提供了以下功能:
Autodesk.Revit.DB.DGNFileFormat用于集成Revit与MicroStation的工作流程,使得在两个软件之间进行数据交换变得更加简单。
DGNImportOptions options = new DGNImportOptions();
options.Unit = DisplayUnitType.Millimeters;
options.ColorMode = ImportColorMode.Indexed;
options.ImportAsModel = true;
Document document = Application.ActiveDocument;
using (Transaction transaction = new Transaction(document, "Import DGN"))
{
transaction.Start();
DGNImport dgnImport = DGNImport.GetInstance(document);
dgnImport.Setup(options);
dgnImport.Execute("path/to/dgn/file.dgn");
transaction.Commit();
}
DGNExportOptions options = new DGNExportOptions();
options.ColorMode = ExportColorMode.Indexed;
Document document = Application.ActiveDocument;
using (Transaction transaction = new Transaction(document, "Export DGN"))
{
transaction.Start();
DGNExport dgnEport = DGNExport.GetInstance(document);
dgnExport.Setup(options);
dgnExport.Execute("path/to/dgn/file.dgn");
transaction.Commit();
}