12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- /*-------------------------------------------------------------------------
- * 功能描述:ExternalCommand
- * 作者:xulisong
- * 创建时间: 2019/3/7 14:50:24
- * 版本号:v1.0
- * -------------------------------------------------------------------------*/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Autodesk.Revit.DB;
- using Autodesk.Revit.UI;
- using Autodesk.Revit.Attributes;
- namespace FWindSoft.Revit
- {
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- //[Journaling(JournalingMode.NoCommandData)]
- public class ExternalCommand : IExternalCommand, IExternalCommandAvailability
- {
- /// <summary>
- /// 应用级别显示,不用打开项目自动显示
- /// </summary>
- public bool ApplicationShow { get; set; }
- public virtual Result Execute(ExternalCommandData commandData, ref string message,ElementSet elements)
- {
- RevitCore.InitCore((UIApplication)commandData.Application);
- return Result.Succeeded;
- }
- public virtual bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- if (ApplicationShow)
- {
- return true;
- }
- return applicationData.ActiveUIDocument != null;
- }
- }
- }
|