123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- /*-------------------------------------------------------------------------
- * 功能描述:MbiExportCommand
- * 作者:xulisong
- * 创建时间: 2019/6/28 10:52:24
- * 版本号:v1.0
- * -------------------------------------------------------------------------*/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Autodesk.Revit.Attributes;
- using Autodesk.Revit.DB;
- using Autodesk.Revit.UI;
- namespace RevitToJBim
- {
- /// <summary>
- /// 提取数据
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class MbiExportCommand : IExternalCommand, IExternalCommandAvailability
- {
- public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- try
- {
- var document = commandData.Application.ActiveUIDocument.Document;
- MbiExport.Export(document);
- TaskDialog dialog = new TaskDialog("导出");
- dialog.MainInstruction = "导出成功";
- dialog.Show();
- }
- catch (Exception e)
- {
- TaskDialog dialog = new TaskDialog("导出");
- dialog.MainInstruction = e.Message + "\n\t" + e.StackTrace.ToString();
- dialog.Show();
- return Result.Cancelled;
- }
- return Result.Succeeded;
- }
- /// <summary>
- /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
- /// when a document is open.
- /// </summary>
- public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return false;
- }
- }
- }
|