Autodesk.Revit.DB.INavisworksExporter是一个用于从Revit导出到Navisworks的接口,它位于Autodesk.Revit.DB命名空间中。
//创建Navisworks导出选项
NavisworksExportOptions exportOptions = new NavisworksExportOptions();
//设置导出范围
exportOptions.ExportScope = NavisworksExportScope.View;
//获取可导出的视图
IEnumerable<View3D> views = new FilteredElementCollector(document).OfClass(typeof(View3D)).Cast<View3D>();
//将视图添加到选定的视图列表中
List<ElementId> selectedViews = new List<ElementId>();
foreach (View3D view in views)
{
if (view.CanBePrinted)
{
selectedViews.Add(view.Id);
}
}
exportOptions.SelectedViews = selectedViews;
//实例化NavisworksExporter
INavisworksExporter exporter = RevitObjectFactory.Instance.NewNavisworksExporter();
//进行导出
exporter.Export(document, "output.nwd", exportOptions);
//释放COM对象和将它们指定为null
exporter.ReleaseCom();
exporter = null;